/* ===================================
   MOBILE-FIRST CSS REWRITE
   Base styles: 320px - 480px (mobile)
   Progressive enhancement for larger screens
   =================================== */

/* ===================================
   RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background: #ffffff !important;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Mobile-first: Start with mobile padding */
    padding: 0.875rem;
    padding-top: 0;
}

/* ===================================
   LANGUAGE DROPDOWN - Mobile First
   =================================== */
.language-dropdown {
    position: fixed;
    top: 0.875rem;
    left: 0.875rem;
    z-index: 120;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4375rem 0.6875rem;
    border-radius: 9999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Ensure minimum touch target size on mobile */
    min-height: 44px;
    min-width: 44px;
}

.language-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
}

.language-button:active {
    transform: scale(0.95);
}

.language-button .caret {
    font-size: 0.75rem;
    opacity: 0.6;
}

.language-menu {
    position: absolute;
    left: 0;
    margin-top: 0.5rem;
    min-width: 130px;
    border-radius: 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: 0 10px 30px rgba(15,23,42,0.12);
    padding: 0.25rem;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease;
}

.language-dropdown.open .language-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.language-menu .language-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
    /* Mobile-first touch targets */
    min-height: 44px;
}

.language-menu .language-option:hover {
    background: #f8fafc;
}

.language-menu .language-option.active {
    background: #eef2ff;
    color: #4338ca;
}

/* ===================================
   LOGO & BRANDING - Mobile First
   =================================== */
#search-wrapper {
    width: 100%;
    max-width: 100%;
    margin-top: 4rem;
}

.logo-image {
    width: auto !important;
    height: 102px !important;
    margin-bottom: 0.625rem !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-image:hover {
    transform: scale(1.1);
}

.logo-text {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.875rem !important;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 0.625rem;
    line-height: 1.1;
}

.logo-text-gradient {
    color: #5F192B !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
}

.logo-subtitle {
    font-size: 0.65rem;
    color: #64748b;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.75rem;
}

/* ===================================
   SEARCH BAR - Mobile First (Perfect Fit)
   =================================== */
.search-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08),
                0 12px 20px -5px rgb(0 0 0 / 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.search-input-wrapper:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08),
                0 25px 50px -12px rgb(0 0 0 / 0.12),
                0 0 0 1px rgb(0 0 0 / 0.05);
}

.search-input-wrapper:focus-within {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08),
                0 25px 50px -12px rgb(0 0 0 / 0.12),
                0 0 0 2px #d97706;
}

.search-input-wrapper:active {
    transform: scale(0.995);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    z-index: 10;
    width: 18px;
    height: 18px;
}

.search-input {
    width: 100%;
    padding: 0.875rem 2.75rem;
    font-size: 0.9375rem;
    border: none;
    outline: none;
    background: transparent;
    color: #1e293b;
    font-weight: 400;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.875rem;
}

.clear-button {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Ensure good touch target */
    min-width: 44px;
    min-height: 44px;
}

.clear-button.visible {
    opacity: 1;
    pointer-events: all;
}

.clear-button:hover {
    background: #e2e8f0;
    transform: translateY(-50%) scale(1.1);
}

.clear-button:active {
    transform: translateY(-50%) scale(0.9);
}

/* ===================================
   DROPDOWN RESULTS - Mobile First
   =================================== */
.dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.12),
                0 10px 10px -5px rgb(0 0 0 / 0.06),
                0 0 0 1px rgb(0 0 0 / 0.03);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
}

.dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.dropdown-item {
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    /* Good touch target */
    min-height: 64px;
}

.dropdown-item:hover {
    background: #f8fafc;
    border-left-color: #d97706;
}

.dropdown-item:active {
    background: #e2e8f0;
    transform: scale(0.98);
}

.student-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9375rem;
}

.student-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: #64748b;
    flex-wrap: wrap;
    /* Improved readability on mobile */
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.2rem 0.625rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
}

/* ===================================
   DASHBOARD BUTTON - Mobile First
   =================================== */
.login-button {
    position: fixed;
    top: 0.875rem;
    right: 0.875rem;
    padding: 0.5rem 0.875rem;
    background: #C2A580;
    color: white;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    z-index: 110;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Good touch target */
    min-height: 44px;
}

.login-button i {
    width: 14px !important;
    height: 14px !important;
}

.login-button:hover {
    background: #B39570;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.15), 0 4px 6px -2px rgb(0 0 0 / 0.08);
}

.login-button:active {
    transform: translateY(1px) scale(0.97);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.chess-pattern {
    display: none;
}

/* ===================================
   LANGUAGE TOGGLE (Alternative Style)
   =================================== */
.language-toggle {
    position: fixed;
    top: 0.875rem;
    right: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 50;
    min-height: 44px;
}

.language-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
}

.language-icon {
    font-size: 1rem;
}

.language-code {
    letter-spacing: 0.08em;
}

.language-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    color: #1e293b;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 44px;
}

.language-toggle-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px -18px rgba(15, 23, 42, 0.6);
}

.language-toggle-icon {
    width: 18px;
    height: 18px;
    color: #0f172a;
}

.language-toggle-label {
    letter-spacing: 0.08em;
}

/* ===================================
   TABLET BREAKPOINT (481px+)
   Progressive Enhancement
   =================================== */
@media (min-width: 481px) {
    body {
        padding: 1rem;
        padding-top: 0;
    }

    #search-wrapper {
        margin-top: 4.5rem;
    }

    .logo-image {
        width: auto !important;
        height: 117px !important;
        margin-bottom: 0.75rem !important;
    }

    .logo-text {
        font-size: 2.25rem !important;
        margin-bottom: 0.75rem;
    }

    .logo-subtitle {
        font-size: 0.7rem;
        margin-bottom: 2rem;
        letter-spacing: 0.08em;
    }

    .language-dropdown {
        top: 1rem;
        left: 1rem;
    }

    .language-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .login-button {
        top: 1rem;
        right: 1rem;
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        gap: 0.375rem;
    }

    .login-button i {
        width: 16px !important;
        height: 16px !important;
    }

    .language-toggle {
        top: 1rem;
        right: 1rem;
        font-size: 0.8125rem;
    }

    .language-toggle-button {
        font-size: 0.8125rem;
    }

    .search-input {
        padding: 1rem 3rem;
        font-size: 1rem;
    }

    .search-input::placeholder {
        font-size: 0.9375rem;
    }

    .search-icon {
        left: 16px;
        width: 20px;
        height: 20px;
    }

    .clear-button {
        right: 16px;
        width: 28px;
        height: 28px;
    }

    .dropdown {
        max-height: 320px;
    }

    .dropdown-item {
        padding: 1rem 1.125rem;
    }

    .student-name {
        font-size: 1rem;
    }

    .student-meta {
        font-size: 0.875rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }
}

/* ===================================
   DESKTOP BREAKPOINT (769px+)
   Enhanced Desktop Experience
   =================================== */
@media (min-width: 769px) {
    body {
        padding: 0;
        align-items: center;
        justify-content: center;
    }

    #search-wrapper {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
        margin-top: 0;
    }

    .search-container {
        /* Desktop: Constrain to 640px centered */
        max-width: 640px;
        margin: 0 auto;
        margin-top: -10px;
    }

    .logo-image {
        width: auto !important;
        height: 281px !important;
        margin-bottom: 0.5rem !important;
    }

    .logo-text {
        font-size: 3.5rem !important;
        margin-bottom: 0.25rem;
        margin-top: -20px;
        line-height: 1.2;
    }

    .logo-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .language-dropdown {
        top: 1.5rem;
        left: 1.5rem;
    }

    .language-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        min-height: auto;
        min-width: auto;
    }

    .language-button:active {
        transform: translateY(-2px) scale(0.98);
    }

    .login-button {
        top: 2rem;
        right: 2rem;
        padding: 0.75rem 1.75rem;
        font-size: 0.9375rem;
        gap: 0.5rem;
        min-height: auto;
    }

    .login-button i {
        width: 18px !important;
        height: 18px !important;
    }

    .login-button:active {
        transform: translateY(0);
    }

    .language-toggle {
        top: 1.5rem;
        right: 1.5rem;
        font-size: 0.875rem;
        min-height: auto;
    }

    .language-toggle-button {
        font-size: 0.875rem;
        min-height: auto;
    }

    .search-input-wrapper {
        width: 640px;
        max-width: 100%;
        border-radius: 9999px;
        box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05),
                    0 20px 25px -5px rgb(0 0 0 / 0.05),
                    0 0 0 1px rgb(0 0 0 / 0.03);
    }

    .search-input-wrapper:active {
        transform: none;
    }

    .search-input {
        padding: 1.25rem 3.5rem;
        font-size: 1.125rem;
    }

    .search-icon {
        left: 24px;
        width: 24px;
        height: 24px;
    }

    .clear-button {
        right: 24px;
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .dropdown {
        max-height: 400px;
    }

    .dropdown-item {
        padding: 1rem 1.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        min-height: auto;
    }

    .dropdown-item:active {
        background: #f1f5f9;
        transform: none;
    }

    .student-name {
        font-size: 1rem;
    }

    .student-meta {
        font-size: 0.875rem;
        flex-wrap: nowrap;
        font-weight: 400;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }

    .language-menu .language-option {
        min-height: auto;
    }
}

/* ===================================
   LARGE DESKTOP (1400px+)
   Maximum Experience
   =================================== */
@media (min-width: 1400px) {
    .language-dropdown {
        right: 17rem;
    }
}
