/* ==========================================
   MASTER RESPONSIVE STYLES
   Complete Site-Wide Responsive Design
   ========================================== */

/* Prevent horizontal scroll on all devices */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* Global Captcha Image Fix - Apply to all captcha images site-wide */
img[src*="/captcha/generate"],
img[alt*="captcha" i],
img[alt*="Math Question"],
.captcha-image,
#gitCaptchaImage,
#cmbCaptchaImage,
#contactCaptchaImage,
#enquiryCaptchaImage {
    height: 45px !important;
    max-height: 45px !important;
    width: auto !important;
    max-width: 150px !important;
    object-fit: contain !important;
    aspect-ratio: auto !important;
}

/* Container responsive padding */
.container {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* Topbar - Always Visible on All Devices */
.topbar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ==========================================
   LARGE DESKTOP (1400px+)
   ========================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ==========================================
   DESKTOP (1200px - 1399px)
   ========================================== */
@media (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }
}

/* ==========================================
   LARGE TABLET / SMALL DESKTOP (992px - 1199px)
   ========================================== */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    /* Reduce font sizes slightly */
    h1 { font-size: 2.25rem !important; }
    h2 { font-size: 1.875rem !important; }
    h3 { font-size: 1.5rem !important; }
    
    /* Adjust section padding */
    section {
        padding: 60px 0 !important;
    }
}

/* ==========================================
   TABLET (768px - 991px)
   ========================================== */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 720px;
    }
    
    /* Typography adjustments */
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.75rem !important; }
    h3 { font-size: 1.375rem !important; }
    h4 { font-size: 1.125rem !important; }
    
    body {
        font-size: 0.95rem;
    }
    
    /* Section padding */
    section {
        padding: 50px 0 !important;
    }
    
    /* Button sizing */
    .btn, .button {
        padding: 12px 24px !important;
        font-size: 0.95rem !important;
    }
    
    /* Grid columns */
    .row > [class*='col-'] {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* ==========================================
   MOBILE LANDSCAPE / SMALL TABLET (576px - 767px)
   ========================================== */
@media (min-width: 576px) and (max-width: 767px) {
    .container {
        max-width: 540px;
    }
    
    /* Typography */
    h1 { font-size: 1.875rem !important; }
    h2 { font-size: 1.625rem !important; }
    h3 { font-size: 1.25rem !important; }
    h4 { font-size: 1.063rem !important; }
    h5 { font-size: 0.938rem !important; }
    
    body {
        font-size: 0.9rem;
    }
    
    /* Section padding */
    section {
        padding: 40px 0 !important;
    }
    
    /* Button sizing */
    .btn, .button {
        padding: 11px 20px !important;
        font-size: 0.9rem !important;
    }
    
    /* Grid adjustments */
    .row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }
    
    .row > [class*='col-'] {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    /* Force full width on most columns */
    [class*='col-md-'],
    [class*='col-lg-'] {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Topbar Mobile Enhancement */
    .topbar {
        display: block !important;
        padding: 10px 0 !important;
    }
    
    .topbar-content {
        justify-content: center !important;
        gap: 12px !important;
    }
    
    .topbar-link {
        min-width: 36px !important;
        min-height: 36px !important;
    }
}

/* ==========================================
   MOBILE PORTRAIT (400px - 575px)
   ========================================== */
@media (min-width: 400px) and (max-width: 575px) {
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* Typography */
    h1 { font-size: 1.75rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.188rem !important; }
    h4 { font-size: 1rem !important; }
    h5 { font-size: 0.875rem !important; }
    h6 { font-size: 0.813rem !important; }
    
    body {
        font-size: 0.875rem;
        line-height: 1.6;
    }
    
    /* Section padding */
    section {
        padding: 35px 0 !important;
    }
    
    /* Button sizing */
    .btn, .button {
        padding: 10px 18px !important;
        font-size: 0.875rem !important;
        width: 100%;
        display: block;
        text-align: center;
    }
    
    /* Grid */
    .row {
        margin-left: -8px !important;
        margin-right: -8px !important;
    }
    
    .row > [class*='col-'] {
        padding-left: 8px !important;
        padding-right: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Tables */
    table {
        font-size: 0.813rem;
    }
    
    /* Topbar Mobile Enhancement */
    .topbar {
        display: block !important;
        padding: 8px 0 !important;
    }
    
    .topbar-content {
        justify-content: center !important;
    }
    
    .topbar-link {
        min-width: 34px !important;
        min-height: 34px !important;
    }
}

/* ==========================================
   SMALL MOBILE (320px - 399px)
   ========================================== */
@media (max-width: 399px) {
    .container {
        width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* Typography - Extra compact */
    h1 { font-size: 1.625rem !important; }
    h2 { font-size: 1.375rem !important; }
    h3 { font-size: 1.125rem !important; }
    h4 { font-size: 0.938rem !important; }
    h5 { font-size: 0.813rem !important; }
    h6 { font-size: 0.75rem !important; }
    
    body {
        font-size: 0.813rem;
        line-height: 1.5;
    }
    
    /* Section padding - Compact */
    section {
        padding: 30px 0 !important;
    }
    
    /* Buttons */
    .btn, .button {
        padding: 9px 15px !important;
        font-size: 0.813rem !important;
        width: 100%;
    }
    
    /* Grid */
    .row {
        margin-left: -6px !important;
        margin-right: -6px !important;
    }
    
    .row > [class*='col-'] {
        padding-left: 6px !important;
        padding-right: 6px !important;
        width: 100% !important;
    }
    
    /* Topbar Mobile Enhancement */
    .topbar {
        display: block !important;
        padding: 8px 0 !important;
    }
    
    .topbar-content {
        justify-content: center !important;
        flex-direction: row !important;
    }
    
    .topbar-link {
        min-width: 32px !important;
        min-height: 32px !important;
        font-size: 0.95rem !important;
    }
}

/* ==========================================
   HERO SECTIONS - ALL BREAKPOINTS
   ========================================== */

/* Desktop */
.hero-section,
.hero-banner,
.pkg-hero,
.pd-hero {
    min-height: 500px !important;
    padding: 80px 0 !important;
}

/* Tablet */
@media (max-width: 991px) {
    .hero-section,
    .hero-banner,
    .pkg-hero,
    .pd-hero {
        min-height: 450px !important;
        padding: 60px 0 !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .hero-section,
    .hero-banner,
    .pkg-hero,
    .pd-hero {
        min-height: 400px !important;
        padding: 50px 0 !important;
    }
}

@media (max-width: 575px) {
    .hero-section,
    .hero-banner,
    .pkg-hero,
    .pd-hero {
        min-height: 350px !important;
        padding: 40px 0 !important;
    }
}

/* ==========================================
   CARDS & BOXES - RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
    .card,
    .box,
    .info-card,
    .pkg-card,
    .pd-info-card {
        margin-bottom: 20px !important;
    }
}

@media (max-width: 575px) {
    .card,
    .box,
    .info-card {
        padding: 20px !important;
    }
}

/* ==========================================
   FORMS - RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important; /* Prevent zoom on iOS */
        padding: 12px !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 575px) {
    .form-group {
        margin-bottom: 18px !important;
    }
    
    input,
    textarea,
    select {
        padding: 11px !important;
    }
}

/* ==========================================
   MODALS - RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }
    
    .modal-content {
        border-radius: 12px !important;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px !important;
    }
}

@media (max-width: 575px) {
    .modal-dialog {
        margin: 5px !important;
        max-width: calc(100% - 10px) !important;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px !important;
    }
}

/* ==========================================
   TABLES - RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 10px 8px !important;
    }
}

/* ==========================================
   IMAGES & MEDIA - RESPONSIVE
   ========================================== */
img {
    max-width: 100% !important;
    height: auto !important;
}

@media (max-width: 767px) {
    .img-fluid,
    img {
        width: 100% !important;
        height: auto !important;
    }
}

/* ==========================================
   SPACING UTILITIES - RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
    .mb-5 { margin-bottom: 3rem !important; }
    .mb-4 { margin-bottom: 2rem !important; }
    .mb-3 { margin-bottom: 1.5rem !important; }
    
    .mt-5 { margin-top: 3rem !important; }
    .mt-4 { margin-top: 2rem !important; }
    .mt-3 { margin-top: 1.5rem !important; }
    
    .py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
    .py-4 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
}

@media (max-width: 575px) {
    .mb-5 { margin-bottom: 2rem !important; }
    .mb-4 { margin-bottom: 1.5rem !important; }
    
    .mt-5 { margin-top: 2rem !important; }
    .mt-4 { margin-top: 1.5rem !important; }
    
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
}

/* ==========================================
   TEXT ALIGNMENT - RESPONSIVE
   ========================================== */
@media (max-width: 767px) {
    .text-md-center { text-align: center !important; }
    .text-md-left { text-align: left !important; }
    .text-md-right { text-align: right !important; }
}

@media (max-width: 575px) {
    .text-sm-center { text-align: center !important; }
    .text-sm-left { text-align: left !important; }
    .text-sm-right { text-align: right !important; }
}

/* ==========================================
   UTILITY CLASSES - HIDE/SHOW ON BREAKPOINTS
   ========================================== */
@media (max-width: 991px) {
    .hide-tablet { display: none !important; }
}

@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
    .show-mobile-only { display: none !important; }
}

@media (min-width: 992px) {
    .show-tablet-only { display: none !important; }
}

/* ==========================================
   PERFORMANCE - SMOOTH SCROLLING
   ========================================== */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .topbar,
    .navbar,
    .mobile-menu-toggle,
    .floating-buttons-container,
    .back-to-top,
    footer {
        display: none !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}
