:root {
    --primary-color: #4F46E5; /* Indigo */
    --primary-dark: #3730A3;
    --secondary-color: #10B981; /* Emerald */
    --accent-color: #F59E0B; /* Amber */
    --bg-color: #F9FAFB;
    --dark-bg: #111827;
    --text-color: #1F2937;
    --text-light: #F3F4F6;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-dark-bg: rgba(17, 24, 39, 0.7);
    --font-primary: 'Outfit', sans-serif;
    --font-urdu: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 18px; /* Modern readable base size */
    transition: all 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.lang-ur {
    font-family: var(--font-urdu), var(--font-primary);
    direction: rtl; /* Right to left for Urdu */
    font-size: 20px; /* Reduced from 24px for better balanced layout */
}

/* Specifically target components that need the 30px size */
body.lang-ur .logo span,
body.lang-ur .nav-links a,
body.lang-ur .hero-content p,
body.lang-ur .reg-section-title,
body.lang-ur .reg-label,
body.lang-ur .declaration,
body.lang-ur .sig-box {
    font-size: 30px;
}

/* Fix English text distortion in Urdu mode */
body.lang-ur .contact-card p,
body.lang-ur .footer p,
body.lang-ur a[href^="tel:"],
body.lang-ur a[href^="mailto:"],
body.lang-ur .map-container {
    font-family: var(--font-primary) !important;
    font-size: 16px !important; /* Standard size for English text */
    direction: ltr !important; /* Force Left-to-Right for English info */
    unicode-bidi: isolate;
}

body.lang-ur .contact-card p a {
    font-size: 18px !important;
    font-weight: 400;
}

body.lang-ur .section-title {
    font-size: 3.5rem; /* Slightly larger for headings in Urdu */
}

body.lang-ur .school-info h1 {
    font-size: 3.5rem;
}

body.lang-ur .reg-title h2 {
    font-size: 2.8rem;
}

/* Strong Reset for Admission Form - MUST STAY ENGLISH/LTR/OUTFIT ALWAYS */
#admission-form, 
.registration-card,
.registration-card *,
body.lang-ur #admission-form,
body.lang-ur .registration-card,
body.lang-ur .registration-card * {
    direction: ltr !important;
    text-align: left !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a !important;
}

#admission-form h1, body.lang-ur #admission-form h1,
#admission-form h2, body.lang-ur #admission-form h2 {
    font-family: 'Outfit', sans-serif !important;
    text-transform: uppercase !important;
    font-weight: 800 !important;
}

#admission-form .reg-section-title, body.lang-ur #admission-form .reg-section-title {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    background: transparent !important;
}

#admission-form .reg-label, body.lang-ur #admission-form .reg-label {
    font-size: 0.9rem !important;
    font-weight: 700 !important;
}

#admission-form input, body.lang-ur #admission-form input,
#admission-form select, body.lang-ur #admission-form select,
#admission-form textarea, body.lang-ur #admission-form textarea {
    font-size: 1rem !important;
    font-family: 'Outfit', sans-serif !important;
    color: #000 !important;
}

/* Specific exception for Urdu Name field inside English Form */
#admission-form [dir="rtl"], body.lang-ur #admission-form [dir="rtl"] {
    direction: rtl !important;
    text-align: right !important;
    font-family: var(--font-urdu), serif !important;
}

body.lang-ur #admission-form input,
body.lang-ur #admission-form select,
body.lang-ur #admission-form textarea {
    font-family: var(--font-primary) !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

/* Allow Urdu input field to remain RTL */
#admission-form [dir="rtl"] {
    direction: rtl !important;
    font-family: var(--font-urdu), var(--font-primary) !important;
    text-align: right !important;
}

/* Language specific sizing for the rest of the site */
body.lang-ur .school-info p {
    font-size: 22px;
}

body.lang-ur input:not(#admission-form input),
body.lang-ur select:not(#admission-form select),
body.lang-ur textarea:not(#admission-form textarea) {
    font-family: var(--font-urdu), 'Outfit', sans-serif !important;
    font-size: 28px !important;
    line-height: 2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px; /* Slightly reduced padding for mobile */
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll from children */
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.text-center { text-align: center; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

.btn-secondary {
    background-color: var(--text-color);
    color: white;
}
.btn-secondary:hover { background-color: var(--primary-dark); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 6px 15px;
    font-size: 0.9rem;
}

/* Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.glass-dark {
    background: var(--glass-dark-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    -webkit-text-fill-color: initial;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
}

.nav-links a {
    font-weight: 600;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after { width: 100%; }

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(rgba(17, 24, 39, 0.7), rgba(17, 24, 39, 0.7)), url('school.png') center/cover no-repeat;
    color: white;
    padding: 100px 20px;
}

.hero-content h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
    animation: fadeInDown 1s ease;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 30px;
    animation: fadeInUp 1s ease 0.3s;
    animation-fill-mode: backwards;
}

/* Sections */
.section { padding: 80px 0; }
.section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -10px;
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.bg-light { background-color: #fff; }
.bg-dark { background-color: var(--dark-bg); }

/* Form */
.form-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 600px;
    transition: transform 0.3s;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}
body.lang-ur .form-group { text-align: right; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.success-message {
    color: var(--secondary-color);
    font-weight: 600;
    padding: 15px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
}

/* Registration Form Specific Styles */
.registration-card {
    background: white;
    padding: 30px; /* Reduced from 40px */
    border-radius: 5px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    font-family: var(--font-primary);
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    position: relative;
    overflow-x: auto; /* Allow horizontal scroll if content still overflows on tiny screens */
}

.reg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
}

.school-info {
    flex: 1;
    text-align: center;
}

.school-logo-small {
    width: 80px;
    height: auto;
    margin-bottom: 10px;
}

.school-info h1 {
    font-size: 1.8rem;
    color: #8b7355; /* Goldish color from image */
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 800;
}

.school-info p {
    font-size: 0.9rem;
    margin: 2px 0;
}

.photo-box {
    width: 140px;
    height: 160px;
    border: 3px double #ccc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px;
    font-size: 0.8rem;
    background: #fdfdfd;
    cursor: pointer;
    position: relative;
}

.photo-box input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.photo-preview {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    display: none;
}

.reg-title {
    text-align: center;
    margin: 15px 0;
}

.reg-title h2 {
    font-size: 1.6rem;
    text-transform: uppercase;
    text-decoration: underline;
    margin-bottom: 5px;
}

.session-row {
    font-weight: bold;
    font-size: 1.1rem;
}

.reg-section-title {
    font-weight: 800;
    font-size: 1.1rem;
    background: transparent;
    color: #000;
    padding: 5px 0;
    margin-top: 15px;
    text-transform: uppercase;
}

.reg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #333;
    margin-bottom: 10px;
}

.reg-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    border: 0.5px solid #333;
    background: #f3f4f6; /* Grayish background for labels */
}

.reg-full-row {
    grid-column: span 2;
    background: #f3f4f6;
    border: 0.5px solid #333;
    padding: 5px 10px;
}

.reg-label {
    padding: 8px 10px;
    font-weight: 700;
    font-size: 0.9rem;
    border-right: 1px solid #333;
}

.reg-input-field {
    padding: 8px 10px;
    background: white;
}

.reg-input-field input, .reg-input-field select {
    width: 100%;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    background: transparent;
}

.reg-note {
    font-size: 0.85rem;
    margin: 10px 0;
    font-weight: 600;
}

.emergency-contacts {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border: 1px solid #333;
}

.emergency-item {
    padding: 8px;
    border-right: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.emergency-item:last-child { border-right: none; }

.declaration {
    margin-top: 20px;
    font-size: 1rem;
}

.signature-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
    text-align: center;
}

.sig-box {
    border-top: 1px solid #000;
    padding-top: 5px;
    min-width: 250px;
}

.office-use {
    margin-top: 30px;
}

.office-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid #333;
}

.reg-checklist {
    margin-top: 20px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Print Specific - Fix: Print only the form */
@media print {
    /* Hide all major components except the admission section */
    nav, .navbar, header, footer, .hero, #about, #gallery, #contact, #lightbox, .section:not(#admission) {
        display: none !important;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    section#admission {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Remove card styling for a clean print */
    .registration-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Hide all buttons and interactive elements */
    .btn, button, #form-message, .mt-1 {
        display: none !important;
    }

    /* Ensure form grids and borders are sharp */
    .reg-grid, .office-grid, .emergency-contacts {
        border: 1px solid #000 !important;
    }

    .reg-row, .reg-full-row, .reg-label, .emergency-item, .sig-box {
        border-color: #000 !important;
    }

    .reg-row {
        border: 0.5px solid #000 !important;
    }

    /* Keep the grayish background for labels for better readability */
    .reg-row, .reg-full-row, .reg-section-title {
        background-color: #f3f4f6 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .reg-input-field {
        background: white !important;
    }

    /* Ensure text is black for clarity */
    body, h1, h2, h3, p, label, input, select, textarea {
        color: #000 !important;
    }

    /* Make sure inputs show their content clearly and keep their bottom border if defined */
    input, select, textarea {
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: 1px solid #000 !important;
        appearance: none;
        -moz-appearance: none;
        -webkit-appearance: none;
    }

    /* Except for specific grids where we don't want extra lines */
    .reg-input-field input, .reg-input-field select {
        border-bottom: none !important;
    }
}

/* Gallery */
.upload-container { display: flex; justify-content: center; margin-bottom: 30px;}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.gallery-item {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    height: 250px;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img { transform: scale(1.1); }

.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}

.gallery-item:hover::before { opacity: 1; }

/* Contact Section */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.contact-card {
    padding: 40px 20px;
    border-radius: 16px;
    text-align: center;
    transition: transform 0.3s, background 0.3s;
}

.contact-card:hover {
    transform: translateY(-10px);
    background: rgba(255,255,255,0.1);
}

.icon-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    font-size: 30px;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.4);
}

.contact-card h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    color: #e9f2f0 !important; /* Softer tinted white */
    font-weight: 700;
}

.contact-card p a {
    color: #e9f2f0 !important;
    opacity: 0.95;
    transition: opacity 0.3s;
}

.contact-card p a:hover {
    opacity: 1;
    text-decoration: underline;
}

.text-white { color: #e9f2f0 !important; }

.map-container {
    width: 100%;
    margin-top: 50px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.map-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.map-container iframe {
    width: 100%;
    border: none;
    display: block;
    filter: contrast(1.1) brightness(0.9);
    transition: filter 0.3s ease;
}

.map-container:hover iframe {
    filter: contrast(1) brightness(1);
}

/* Footer */
.footer {
    padding: 30px;
    background: #000;
    color: #9CA3AF;
}

/* Lightbox Overlay */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    cursor: zoom-out;
}

.lightbox.hidden {
    display: none;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: zoomIn 0.3s ease;
}

#lightbox-img, #lightbox-video {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.close-lightbox {
    position: absolute;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    line-height: 1;
    transition: transform 0.3s;
}

.close-lightbox:hover { transform: rotate(90deg); }

/* Video Overlay */
.video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.video-overlay i {
    color: white;
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    transition: transform 0.3s;
}

.gallery-item:hover .video-overlay i {
    transform: scale(1.2);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 992px) {
    .registration-card {
        padding: 15px;
    }
    .reg-header {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    .school-info {
        margin-bottom: 10px;
    }
    .reg-grid {
        grid-template-columns: 1fr;
    }
    .reg-row {
        grid-template-columns: 1fr;
    }
    .reg-label {
        border-right: none;
        border-bottom: 1px solid #333;
        background: #f3f4f6;
    }
    .emergency-contacts {
        grid-template-columns: 1fr;
    }
    .emergency-item {
        border-right: none;
        border-bottom: 1px solid #333;
    }
    .office-grid {
        grid-template-columns: 1fr;
    }
    .school-info h1 {
        font-size: 1.4rem;
    }
    #about .gallery-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: auto;
        flex-direction: column;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 40px 0;
        transition: 0.4s ease;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        gap: 20px;
    }

    body.lang-ur .nav-links {
        left: auto;
        right: -100%;
    }

    .nav-links.active {
        left: 0;
    }

    body.lang-ur .nav-links.active {
        right: 0;
    }

    .hero-content h1 { font-size: 2.5rem; }
    .hero-content { padding-top: 60px; }
    
    .section-title { font-size: 2rem; }
}

@media (max-width: 480px) {
    .hero-content h1 { font-size: 2rem; }
    .logo span { font-size: 1rem; }
    .nav-links li a { font-size: 1.1rem; }
    .card { padding: 1.5rem !important; }
}
