/* Shared styles for all pages */
:root {
    --primary-color: #4361ee;
    --primary-hover: #3553e0;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --accent-hover: #3b83dc;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --bg-light: #ffffff;
    --bg-dark: #2c2f33;
    --bg-hover: #f1f3f5;
    --border-color: #e5e7eb;
    --text-secondary: #6b7280;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* Educational Semantic Colors */
    --success-color: #06d6a0;
    --success-light: #e8f9f5;
    --warning-color: #ffd60a;
    --warning-light: #fff9e6;
    --error-color: #ef476f;
    --error-light: #fdeef2;
    --info-color: #4cc9f0;
    --info-light: #e8f7fb;
    --purple-accent: #7209b7;
    --purple-light: #f3e5ff;
    
    /* Gradients */
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #4361ee 0%, #4cc9f0 100%);
    --gradient-3: linear-gradient(135deg, #06d6a0 0%, #4895ef 100%);
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(67, 97, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
}

.fade-in-up {
    animation-duration: 0.8s;
    animation-fill-mode: both;
    animation-name: fadeInUp;
}

/* Scroll Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent any element from creating horizontal overflow on mobile */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Restored Mesh Gradient */
    background-color: #f0f4f8;
    background-image: 
        radial-gradient(at 0% 0%, rgba(67, 97, 238, 0.2) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(63, 55, 201, 0.2) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(72, 149, 239, 0.2) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(6, 214, 160, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    background-size: 150% 150%;
    animation: gradientAnimation 25s ease infinite;
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scroll from decorative elements */
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    color: var(--dark-color);
    margin-bottom: 0.5em;
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
p { margin-bottom: 1rem; color: var(--text-secondary); }

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: none;
    text-align: center;
    font-family: inherit;
}

.btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1);
}

.btn-primary, .btn-dashboard {
    background: var(--gradient-2);
    color: white;
    box-shadow: 
        6px 6px 12px rgba(67, 97, 238, 0.2), 
        -6px -6px 12px rgba(255, 255, 255, 0.8);
}

.btn-primary:hover, .btn-dashboard:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #3b83dc 100%);
    transform: translateY(-3px);
    box-shadow: 
        8px 8px 16px rgba(67, 97, 238, 0.3), 
        -8px -8px 16px rgba(255, 255, 255, 0.9);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.btn-secondary:hover {
    background-color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.btn-logout {
    background-color: rgba(239, 71, 111, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.btn-logout:hover {
    background-color: var(--error-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(239, 71, 111, 0.2);
}

/* Micro-interactions & Focus States */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.4);
    border-radius: 4px;
}

/* Decorative Floating Shapes */
.shape-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.floating-shape {
    position: absolute;
    /* Removed expensive backdrop blur, using radial gradients below instead */
    border-radius: 50%;
    animation: float 20s infinite linear;
    will-change: transform;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -50px;
    left: -100px;
    animation-duration: 25s;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.4) 0%, rgba(67, 97, 238, 0) 70%);
}

.shape-2 {
    width: 200px;
    height: 200px;
    top: 40%;
    right: -50px;
    animation-duration: 30s;
    animation-delay: -5s;
    background: radial-gradient(circle, rgba(6, 214, 160, 0.4) 0%, rgba(6, 214, 160, 0) 70%);
}

.shape-3 {
    width: 150px;
    height: 150px;
    bottom: 10%;
    left: 20%;
    animation-duration: 20s;
    animation-delay: -10s;
    background: radial-gradient(circle, rgba(239, 71, 111, 0.4) 0%, rgba(239, 71, 111, 0) 70%);
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -50px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

/* Navbar Styles */
.navbar {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand-group {
    display: flex;
    align-items: center;
    gap: 40px;
}

.secondary-logo {
    height: 60px;
    width: auto;
}

.navbar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-logo img {
    height: 46px;
    margin-right: 10px;
}

.navbar-logo h1 {
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

/* Common Logo Style for Auth Pages */
.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 15px;
    text-decoration: none;
    gap: 8px;
}

.logo img {
    height: 80px;
    width: auto;
}

.logo-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.navbar-links {
    display: flex;
    list-style: none;
}

.navbar-links li {
    margin-left: 0.4rem;
}

.navbar-links a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.97rem;
    transition: var(--transition);
    padding: 0.5rem 0.65rem;
    border-radius: 4px;
    white-space: nowrap;
    position: relative;
}

.navbar-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-links a:hover::after,
.navbar-links a.active::after {
    width: 80%;
}

.navbar-links a:hover,
.navbar-links a.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.navbar-links { flex: 0 1 auto; }
.auth-buttons { margin-left: auto; }

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    white-space: nowrap;
    /* Soft Claymorphism */
    box-shadow: 
        8px 8px 16px rgba(0, 0, 0, 0.1), 
        -8px -8px 16px rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:active {
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.1), 
        inset -4px -4px 8px rgba(255, 255, 255, 0.8);
    transform: scale(0.98);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        10px 10px 20px rgba(0, 0, 0, 0.12), 
        -10px -10px 20px rgba(255, 255, 255, 0.9);
}

.btn-login {
    background-color: #ffffff;
    color: var(--primary-color);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn-signup {
    background: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 
        6px 6px 12px rgba(67, 97, 238, 0.2), 
        -6px -6px 12px rgba(255, 255, 255, 0.8);
}

.btn-signup:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary-color));
    transform: translateY(-3px);
}

.auth-buttons .btn-dashboard {
    background-color: var(--accent-color);
    color: white;
}

.auth-buttons .btn-logout {
    background-color: #e74c3c;
    color: white;
}

/* Back to home button for login/registration pages */
.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color 0.3s;
}

.back-to-home:hover {
    color: var(--primary-hover);
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--dark-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.navbar-toggle:hover {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
}

/* Form Input Styles - Glassmorphism */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-family: inherit;
    font-size: 1rem;
    color: var(--dark-color);
    transition: all 0.3s ease;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
    transform: translateY(-1px);
}

/* Footer Styles */
.footer {
    background-color: var(--dark-color);
    color: white;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
    color: #ffffff;
}

.footer-section h3 a {
    color: inherit;
    text-decoration: none;
}

.footer-section h3 a:hover {
    text-decoration: underline;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 2px;
    background-color: var(--accent-color);
}

.footer-section p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #adb5bd;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-logos {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
}

.footer-ict-logo {
    height: 44px;
    width: auto;
    opacity: 0.85;
}

.footer-nsu-logo {
    height: 60px;
    width: auto;
}

.footer-section:first-child h3 {
    font-size: 1.45rem;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-container {
        flex-wrap: wrap;
        gap: 0;
    }

    .navbar-brand-group {
        flex: 1;
        min-width: 0;
    }

    .navbar-toggle {
        display: block;
        flex-shrink: 0;
    }

    .navbar-menu {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: var(--transition);
    }

    .navbar-menu.active {
        max-height: 500px;
        padding-bottom: 0.5rem;
    }

    .navbar-links {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }

    .navbar-links li {
        margin: 0;
        width: 100%;
    }

    .navbar-links a {
        display: block;
        padding: 0.75rem 0;
        font-size: 1rem;
    }

    .auth-buttons {
        margin-top: 1rem;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .footer-container {
        grid-template-columns: 1fr;
    }
}

/* ── Mobile perf: background-attachment:fixed disables GPU compositing on
   iOS Safari and Android Chrome, causing full-page repaint on every scroll.
   Also stop the infinite gradient animation to free CPU on mobile. ── */
@media (max-width: 1024px) {
    body {
        background-attachment: scroll;
        animation: none;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-logo h1 {
        font-size: 1.2rem;
    }

    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    .footer-container {
        padding: 0 1rem;
    }
}

/* Floating Decorative Shapes */
.shape-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    /* filter: blur(50px) is extremely heavy. We mimic the blur via radial gradients! */
    opacity: 0.6;
    animation: float-animation 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.3) 0%, rgba(72, 149, 239, 0.1) 40%, transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6, 214, 160, 0.3) 0%, rgba(63, 55, 201, 0.1) 40%, transparent 70%);
    bottom: 10%;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(114, 9, 183, 0.3) 0%, rgba(247, 37, 133, 0.1) 40%, transparent 70%);
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float-animation {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, 50px) rotate(10deg); }
    66% { transform: translate(-20px, 20px) rotate(-5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
