/*
 * USS Survey Theme - Animations
 * 平滑动画效果
 */

/* ========== Fade In ========== */
@keyframes uss-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes uss-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes uss-fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Question Card Entry ========== */
.question-container {
    animation: uss-fadeInUp 0.35s ease both;
}

.question-container:nth-child(1) { animation-delay: 0s; }
.question-container:nth-child(2) { animation-delay: 0.05s; }
.question-container:nth-child(3) { animation-delay: 0.1s; }
.question-container:nth-child(4) { animation-delay: 0.15s; }
.question-container:nth-child(5) { animation-delay: 0.2s; }

/* ========== Button Hover ========== */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* ========== Answer Item Hover ========== */
.answer-item {
    transition: all 0.2s ease;
}

.answer-item:hover {
    transform: translateX(2px);
}

/* ========== Selected State ========== */
.answer-item.selected {
    border-color: var(--uss-primary);
    background: var(--uss-primary-light);
}

/* ========== Progress Bar Animation ========== */
.progress-bar {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Focus Ring Animation ========== */
input:focus,
textarea:focus,
select:focus,
button:focus {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

/* ========== Nav Dropdown ========== */
.dropdown-menu {
    animation: uss-fadeInDown 0.2s ease both;
}

/* ========== Modal/Alert ========== */
.modal.fade .modal-dialog {
    animation: uss-fadeInUp 0.3s ease both;
}

/* ========== Loading Spinner ========== */
@keyframes uss-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.uss-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--uss-gray-300);
    border-top-color: var(--uss-primary);
    border-radius: 50%;
    animation: uss-spin 0.6s linear infinite;
}

/* ========== Pulse for required fields ========== */
@keyframes uss-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.asterisk {
    display: inline-block;
}

/* ========== Smooth Scroll for anchor links ========== */
html {
    scroll-behavior: smooth;
}

/* ========== Reduced motion preference ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
