/* Smooth and Elegant Animations for BinarySquad */

/* Reset any conflicting transitions */
*,
*::before,
*::after {
    transition: none;
}

/* Core animation keyframes */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes slideDown {
    0% {
        transform: translate3d(0, -100%, 0);
        opacity: 0;
    }
    100% {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    0% {
        transform: scale3d(0.95, 0.95, 1);
        opacity: 0;
    }
    100% {
        transform: scale3d(1, 1, 1);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes float {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -5px, 0);
    }
}

@keyframes buttonGlow {
    0%,
    100% {
        box-shadow: 0 10px 30px -10px var(--ring);
    }
    50% {
        box-shadow: 0 15px 35px -5px var(--ring);
    }
}

/* Base transition classes */
.transition-smooth {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-fast {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-slow {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header animations */
.site-header {
    animation: slideDown 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand:hover {
    transform: translate3d(0, -2px, 0);
}

.logo {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.brand:hover .logo::before {
    animation: shimmer 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Navigation */
.nav-list a {
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-list a::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.nav-list a:hover {
    transform: translate3d(0, -1px, 0);
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.nav-list a:hover::before {
    width: 80%;
}

/* Hero section */
.hero {
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero h1 {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.hero p {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

.hero-ctas {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}

.hero-bg {
    animation: float 8s ease-in-out infinite;
}

/* Buttons */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translate3d(0, -2px, 0);
}

.btn:hover::before {
    animation: shimmer 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: translate3d(0, 0, 0) scale(0.98);
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    animation: buttonGlow 2s ease-in-out infinite;
}

/* Cards */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    will-change: transform, box-shadow;
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}
.card:nth-child(2) {
    animation-delay: 0.15s;
}
.card:nth-child(3) {
    animation-delay: 0.2s;
}
.card:nth-child(4) {
    animation-delay: 0.25s;
}
.card:nth-child(5) {
    animation-delay: 0.3s;
}
.card:nth-child(6) {
    animation-delay: 0.35s;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translate3d(0, -4px, 0);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.2),
        0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Forms */
input,
textarea {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus,
textarea:focus {
    transform: translate3d(0, -1px, 0);
    box-shadow:
        0 0 0 3px var(--ring),
        0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Alerts */
.alert {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* Dashboard specific */
.dashboard-card {
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-card:hover {
    transform: translate3d(0, -2px, 0);
}

.course-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.course-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-item:hover::before {
    transform: scaleY(1);
}

.course-item:hover {
    transform: translate3d(3px, -2px, 0);
    background: rgba(59, 130, 246, 0.15);
}

/* Stats */
.stat-number {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item:hover .stat-number {
    transform: scale(1.05);
    color: var(--primary);
}

/* Schedule specific */
.day-column {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.day-column:nth-child(1) {
    animation-delay: 0.05s;
}
.day-column:nth-child(2) {
    animation-delay: 0.1s;
}
.day-column:nth-child(3) {
    animation-delay: 0.15s;
}
.day-column:nth-child(4) {
    animation-delay: 0.2s;
}
.day-column:nth-child(5) {
    animation-delay: 0.25s;
}
.day-column:nth-child(6) {
    animation-delay: 0.3s;
}
.day-column:nth-child(7) {
    animation-delay: 0.35s;
}

.day-column:hover {
    transform: translate3d(0, -2px, 0);
}

.class-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.class-item:hover {
    transform: translate3d(2px, -1px, 0);
}

/* Interactive elements */
.interactive {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translate3d(0, -2px, 0);
}

.hover-glow:hover {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* Navigation specific */
.nav-item {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 0;
    height: 0;
    border: 4px solid transparent;
    border-left: 6px solid var(--primary);
    transform: translateY(-50%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    transform: translate3d(5px, 0, 0);
    background: rgba(255, 255, 255, 0.06);
    border-left: 3px solid var(--primary);
}

.nav-item:hover::after {
    opacity: 1;
    right: 0.75rem;
}

/* Glass effects */
.glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Scroll-triggered animations */
.animate-on-scroll {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.in-view {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

/* Theme toggle */
.theme-toggle {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
    transform: scale(1.05);
}

/* Success/Error animations */
.success-bounce {
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-2px);
    }
    20%,
    40%,
    60%,
    80% {
        transform: translateX(2px);
    }
}

.error-shake {
    animation: shake 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    .hero-bg {
        animation: none !important;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .card:hover {
        transform: translate3d(0, -2px, 0);
    }

    .course-item:hover {
        transform: translate3d(1px, -1px, 0);
    }

    .nav-item:hover {
        transform: translate3d(2px, 0, 0);
    }
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Remove will-change after animation */
.animate-on-scroll.in-view {
    will-change: auto;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--panel);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-600);
}
