:root {
    --primary-color: #6366f1;
    --secondary-color: #ec4899;
    --accent-color: #8b5cf6;
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --glass-blur: blur(8px);
    --input-bg: rgba(255, 255, 255, 0.9);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --secondary-color: #f472b6;
    --accent-color: #a78bfa;
    --bg-color: #111827;
    --text-color: #f9fafb;
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(31, 41, 55, 0.9);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Dark Theme Background - Blue/Red/Purple */
[data-theme="dark"] body,
body:not([data-theme]) {
    background-image:
        radial-gradient(at 0% 0%, hsla(240, 70%, 20%, 1) 0, transparent 50%),
        radial-gradient(at 50% 30%, hsla(260, 60%, 25%, 1) 0, transparent 55%),
        radial-gradient(at 100% 0%, hsla(350, 70%, 25%, 1) 0, transparent 50%),
        radial-gradient(at 80% 80%, hsla(220, 60%, 15%, 1) 0, transparent 50%);
    background-size: 200% 200%;
    animation: gradient-animation 15s ease infinite;
}

[data-theme="light"] body {
    background-image:
        radial-gradient(at 40% 20%, hsla(28, 100%, 74%, 1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 1) 0px, transparent 50%);
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%
    }

    50% {
        background-position: 100% 50%
    }

    100% {
        background-position: 0% 50%
    }
}

/* Glassmorphism Classes */
.glass {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Base Styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0;
    border-top: 0;
    border-left: 0;
    border-right: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    margin-left: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.logo {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.logo img {
    height: 50px;
    width: auto;
    transition: var(--transition);
}

.logo img:hover {
    transform: scale(1.05);
}

/* Forms */
.auth-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 3rem;
    width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: 1rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Improved Inputs for Mobile */
input,
select,
textarea,
.input-style {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    /* Prevents iOS Zoom */
    transition: var(--transition);
    appearance: none;
    /* Uniform appearance */
}

input:focus,
select:focus,
textarea:focus,
.input-style:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-color);
    margin-top: 1rem;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Grid System */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Alerts */
.hidden {
    display: none !important;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.alert-success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #22c55e;
}

/* Animations */
.float-anim {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Loading Spinner */
.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========== RECOVERY PAGE ========== */
.recovery-card {
    max-width: 450px;
    width: 90%;
    margin: 5rem auto;
    padding: 2.5rem;
    text-align: center;
}

.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px dashed var(--primary-color);
    border-radius: 15px;
    display: none;
    animation: fadeIn 0.5s ease;
}

/* Mobile Adjustments for Auth/Recovery */
@media (max-width: 768px) {

    .auth-container,
    .recovery-card {
        margin-top: 2rem !important;
        /* Override inline styles if any */
        padding: 1.5rem;
        width: 100%;
    }

    .register-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== TEXT UTILITIES ========== */
/* =========================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================= */

/* Tablet & Smaller Desktops (Max 1024px) */
@media (max-width: 1024px) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    body {
        background-image: none !important;
        background-color: var(--bg-color) !important;
    }

    .container {
        padding: 1rem;
    }

    .glass {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--card-bg);
        /* Fallback to solid usually */
    }

    /* Ensure glass isn't transparent on mobile to improve readability */
    [data-theme="light"] .glass {
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    [data-theme="dark"] .glass {
        background: rgba(17, 24, 39, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .float-anim {
        transform: none !important;
    }

    /* Adjust Grids */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .desktop-only {
        display: none !important;
    }

    /* Bigger text for readability */
    body {
        font-size: 16px;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

/* Mobile Devices (Max 768px) */
@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }

    .logo img {
        height: 40px;
    }

    /* Stack Nav Elements nicely */
    #user-nav-container {
        gap: 0.5rem;
    }

    /* Profile Page Specifics */
    .profile-header {
        margin-bottom: 1.5rem;
    }

    .avatar-container {
        width: 120px;
        height: 120px;
    }

    /* Adjust Modal */
    #guide-modal .glass {
        width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
    }
}

/* Small Phones (Max 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0.8rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .glass {
        padding: 1.2rem !important;
    }

    /* Full width buttons */
    .btn {
        padding: 1rem;
        font-size: 1rem;
    }

    /* Navigation adjustments for very small screens */
    #nav-user-name {
        display: none !important;
        /* Hide name on very small screens, show only avatar */
    }

    .user-dropdown {
        gap: 5px;
        padding: 2px;
    }
}

/* --- PERFORMANCE OPTIMIZATIONS (PWA/Mobile) --- */
@media (max-width: 768px),
(prefers-reduced-motion: reduce) {

    /* 1. Global Animation Nuke for Mobile */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* 2. Glassmorphism Optimization (Solid/Opaque backgrounds for speed) */
    .glass {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: var(--card-bg);
    }

    /* 3. Disable Infinite Gradient on Body */
    body {
        animation: none !important;
        background-size: cover !important;
        /* Static background */
    }
}