/* ==========================
   REGISTRATION PAGE - PREMIUM BLUE & GOLD
   ========================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-blue: #1A237E;
    --luxury-gold: #FFD700;
    --deep-gold: #B8860B;
    --soft-white: rgba(255, 255, 255, 0.92);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --error-red: #c62828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px; /* CHANGED: Was 0, added for breathing room */
    font-family: 'Poppins', sans-serif;
    background: url("/static/images/bac.23d9e781b37e.jpg") no-repeat center center;
    background-size: cover;
    background-attachment: scroll; /* CHANGED: fixed breaks flex center on desktop */
    min-height: 100vh;
    min-height: 100dvh; /* ADDED: Fixes laptop centering */
    min-height: -webkit-fill-available; /* ADDED: iOS Safari fix */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Dark Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(26, 35, 126, 0.8), rgba(0, 0, 0, 0.6));
    z-index: -1;
}

/* Main Container */
.registration-container {
    max-width: 600px;
    width: 95%;
    margin: auto; /* CHANGED: Was 40px auto, now centers properly */
    padding: 50px 40px;
    background: var(--soft-white);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
    border: 1px solid rgba(255, 215, 0, 0.3);
    animation: containerSlideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: calc(100dvh - 40px); /* ADDED: Prevent overflow on laptops */
    overflow-y: auto; /* ADDED: Scroll inside if form too long */
}

/* Heading - Clean Blue & Gold Gradient */
.registration-container h2 {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 30px;
    background: linear-gradient(to right, var(--primary-blue), var(--deep-gold));
    -webkit-background-clip: text;
    background-clip: text; /* ADDED: Kills linter warning */
    -webkit-text-fill-color: transparent;
    color: transparent; /* ADDED: Fallback */
    letter-spacing: -1px;
}

/* Form Groups Layout */
form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Labels */
label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: -10px;
    margin-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inputs & Selects */
input, select, .searchable-select input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    background: white;
    font-family: 'Poppins', sans-serif;
    font-size: 16px; /* CHANGED: 16px stops iOS zoom */
    color: var(--primary-blue);
    transition: all 0.3s ease;
    box-sizing: border-box;
    touch-action: manipulation; /* ADDED: Prevent double-tap zoom */
    min-height: 48px; /* ADDED: Touch target */
}

/* ADDED: File input styling */
input[type="file"] {
    padding: 10px 18px;
    background: #f8f9fa;
    cursor: pointer;
}

input:focus, select:focus, .searchable-select input[type="text"]:focus {
    outline: none;
    border-color: var(--luxury-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

/* Searchable Dropdown Styling */
.searchable-select {
    position: relative; /* ADDED: Anchor for dropdown */
}

.searchable-select ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--luxury-gold);
    border-radius: 12px;
    position: absolute;
    width: 100%;
    z-index: 100;
    margin-top: 5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 0; /* ADDED: Remove default ul padding */
}

.searchable-select ul li {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.searchable-select ul li:hover {
    background: var(--luxury-gold);
    color: var(--primary-blue);
    font-weight: 600;
}

/* Button - Luxury Gold */
button[type="submit"] {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, var(--luxury-gold), var(--deep-gold));
    color: var(--primary-blue);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(184, 134, 11, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase; /* ADDED */
    letter-spacing: 1px; /* ADDED */
    min-height: 48px; /* ADDED: Touch target */
    touch-action: manipulation; /* ADDED */
}

button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(184, 134, 11, 0.4);
    filter: brightness(1.1);
}

button[type="submit"]:active {
    transform: translateY(-1px); /* ADDED */
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
    word-break: break-word; /* ADDED */
}
.error { background: #ffebee; color: var(--error-red); border: 1px solid #ffcdd2; }
.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }

/* Animations */
@keyframes containerSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   STRICT MOBILE "BOLD" VIEW (Registration)
   ========================================= */
@media (max-width: 850px) {
    body {
        display: block;
        padding: 20px 0;
        background-attachment: scroll; /* ADDED: Better mobile perf */
    }

    .registration-container {
        width: 92%;
        max-width: 500px;
        margin: 0 auto;
        padding: 40px 25px;
        border-radius: 20px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
        border: 2px solid rgba(255, 215, 0, 0.4);
        box-sizing: border-box;
        max-height: none; /* ADDED: Let it grow on mobile */
    }

    .registration-container h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
        line-height: 1.2;
    }

    form {
        gap: 20px;
    }

    label {
        font-size: 0.9rem;
        margin-left: 2px;
    }

    input, select, .searchable-select input[type="text"] {
        padding: 16px;
        font-size: 16px;
        border-radius: 14px;
        background: #fff;
    }

    .searchable-select ul li {
        padding: 15px 20px;
        font-size: 1rem;
    }

    button[type="submit"] {
        padding: 18px;
        font-size: 1.2rem;
        margin-top: 10px;
        border-radius: 14px;
        box-shadow: 0 8px 15px rgba(184, 134, 11, 0.4);
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .registration-container {
        padding: 35px 20px;
    }
    
    .registration-container h2 {
        font-size: 1.6rem;
    }
}

/* --- DJANGO FORM ERROR & HELP TEXT SYNC --- */
.field-error {
    color: var(--error-red);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 4px;
    margin-left: 5px;
    animation: containerSlideUp 0.3s ease;
}

.help-text {
    color: #777777;
    display: block;
    font-size: 0.8rem;
    margin-top: 2px;
    margin-left: 5px;
}

/* =====================================
   ADDED RESPONSIVENESS - REGISTRATION PAGE
   Mobile + Laptop refinements only
   Does not modify existing rules
   ===================================== */

/* --- LAPTOP / DESKTOP 1024px - 1439px --- */
@media (min-width: 1024px) and (max-width: 1439px) {
    .registration-container {
        max-width: 640px; /* Slightly wider for long forms on laptop */
        padding: 60px 50px;
        max-height: calc(100vh - 80px); /* More breathing room than 40px */
    }

    .registration-container h2 {
        font-size: 2.4rem;
        margin-bottom: 35px;
    }

    form {
        gap: 18px; /* More space between fields on desktop */
    }

    label {
        font-size: 0.9rem; /* Better readability */
    }

    input, select, .searchable-select input[type="text"] {
        padding: 15px 20px;
        font-size: 16px;
    }

    button[type="submit"] {
        padding: 18px;
        font-size: 1.15rem;
        margin-top: 25px;
    }
}

/* --- LARGE DESKTOP 1440px+ --- */
@media (min-width: 1440px) {
    body {
        padding: 40px; /* More outer space on 4K/ultra-wide */
    }

    .registration-container {
        max-width: 700px; /* Prevent form looking too skinny on big screens */
        transform: scale(1.02); /* Subtle luxury scale */
    }

    .registration-container h2 {
        font-size: 2.6rem;
    }
}

/* --- TABLET 600px - 1023px --- */
@media (min-width: 600px) and (max-width: 1023px) {
    .registration-container {
        max-width: 580px;
        width: 90%;
        padding: 45px 35px;
        max-height: none; /* Tablets can scroll, no height lock */
    }

    .registration-container h2 {
        font-size: 2.1rem;
    }
}

/* --- MOBILE LANDSCAPE / SHORT HEIGHT FIX --- */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 15px 0;
    }

    .registration-container {
        margin: 10px auto;
        padding: 30px 25px;
        max-height: none; /* Let it scroll naturally in landscape */
        overflow-y: visible;
    }

    .registration-container h2 {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }

    form {
        gap: 12px;
    }

    input, select, .searchable-select input[type="text"] {
        padding: 12px 14px;
        margin-bottom: 0; /* Gap handles spacing */
    }

    button[type="submit"] {
        padding: 14px;
        margin-top: 15px;
    }
}

/* --- EXTRA SMALL PHONES 320px - 360px --- */
@media (max-width: 360px) {
    .registration-container {
        width: 94%;
        padding: 30px 18px;
    }

    .registration-container h2 {
        font-size: 1.5rem;
        letter-spacing: -0.5px;
    }

    input, select, .searchable-select input[type="text"] {
        padding: 14px 12px;
        font-size: 16px; /* Still prevents iOS zoom */
    }

    button[type="submit"] {
        font-size: 1.1rem;
        letter-spacing: 0.5px;
    }
}

/* --- TOUCH DEVICE OPTIMIZATION --- */
@media (hover: none) and (pointer: coarse) {
    button[type="submit"]:hover {
        transform: none; /* Remove lift on touch */
        filter: brightness(1);
        box-shadow: 0 10px 20px rgba(184, 134, 11, 0.3);
    }

    .searchable-select ul li {
        min-height: 48px; /* Ensure 44px+ tap targets in dropdown */
        display: flex;
        align-items: center;
    }

    input:focus, select:focus {
        transform: none; /* Prevent jumpy focus on mobile */
    }
}

/* --- PREVENT BODY SCROLL LOCK ON LAPTOP --- */
@media (min-width: 851px) {
    body {
        overflow-y: auto; /* Override any mobile block */
    }
    
    .registration-container {
        overflow-y: auto;
        scrollbar-width: thin; /* Firefox */
        scrollbar-color: var(--luxury-gold) #f1f1f1; /* Firefox */
    }

    /* Webkit scrollbar styling for desktop */
    .registration-container::-webkit-scrollbar {
        width: 8px;
    }
    
    .registration-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .registration-container::-webkit-scrollbar-thumb {
        background: var(--luxury-gold);
        border-radius: 10px;
    }
    
    .registration-container::-webkit-scrollbar-thumb:hover {
        background: var(--deep-gold);
    }
}