/* ===================================================================
   RESPONSIVE — Consolidated responsive rules
   Replaces: responsive.css, mobile-enhancements.css,
             mobile-enhancements-clean.css
   4 Standard breakpoints: 1200 → 992 → 768 → 576
   =================================================================== */

/* ── Accessibility ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
}

/* ===================================================================
   ≤ 1199px — Large desktops down
   =================================================================== */
@media (max-width: 1199.98px) {
    .page-hero {
        padding: 6rem 0;
    }
    .section-padding {
        padding: 5rem 0;
    }
    .hero-image-container,
    #heroCarousel {
        width: 520px;
        height: 390px;
    }
    .why-carousel-container,
    #whyChooseCarousel {
        max-width: 440px;
        height: 350px;
    }
}

/* ===================================================================
   ≤ 991px — Tablets landscape
   =================================================================== */
@media (max-width: 991.98px) {
    /* ── Navigation ── */
    .navbar {
        padding: 0.5rem 1rem;
    }
    .navbar-brand img {
        height: 45px;
    }
    .navbar-collapse {
        background: var(--color-bg);
        border-radius: 0.5rem;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: var(--shadow-md);
    }
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--color-border-light);
        font-size: 1rem;
    }
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    .dropdown-menu {
        border: none;
        background-color: var(--color-bg-light);
        padding-left: 1rem;
        margin-left: 1rem;
    }

    /* ── Hero ── */
    .page-hero {
        padding: 5rem 0;
        text-align: center;
    }
    .section-padding {
        padding: 4rem 0;
    }

    /* ── Cards ── */
    .card {
        margin-bottom: 2rem;
    }

    /* ── Admin Sidebar ── */
    .admin-sidebar {
        position: fixed;
        left: -250px;
        top: 76px;
        width: 250px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    .admin-sidebar.show {
        left: 0;
    }
    .admin-content {
        margin-left: 0;
    }

    /* ── Services horizontal scroll ── */
    .services-row-scroll {
        flex-direction: column;
        align-items: center;
        overflow-x: visible;
    }
    .service-card-wrapper {
        width: 100%;
        max-width: 400px;
        margin-bottom: 1.5rem;
    }
    .service-card {
        min-width: auto;
        width: 100%;
    }
}

/* ===================================================================
   ≤ 767px — Tablets portrait / phones landscape
   =================================================================== */
@media (max-width: 767.98px) {
    /* ── Typography ── */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    .lead { font-size: 1.1rem; line-height: 1.5; }

    .navbar-brand { font-size: 1.25rem; }

    /* ── Hero ── */
    .page-hero {
        min-height: 60vh;
        padding: 3rem 0;
        text-align: center;
    }
    .hero-image-container,
    #heroCarousel {
        width: 100%;
        max-width: 400px;
        height: 280px;
        margin: 0 auto;
    }
    .why-carousel-container,
    #whyChooseCarousel {
        width: 100%;
        max-width: 360px;
        height: 250px;
        margin: 0 auto;
    }
    .why-image-container {
        height: 200px;
        margin-top: 1.5rem;
    }
    .hero-img-float {
        max-width: 100%;
        max-height: 300px;
        margin: 0 auto;
    }

    /* ── Sections ── */
    .section-padding {
        padding: 3rem 0;
    }
    .section-title {
        margin-bottom: 2rem;
    }
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* ── Cards ── */
    .card {
        margin-bottom: 1.5rem;
        border-radius: 1rem;
    }
    .card-body {
        padding: 1.5rem;
    }
    .service-card,
    .about-section-card,
    .job-card {
        margin-bottom: 1.5rem;
    }
    .hover-card,
    .dramatic-card {
        border-radius: 1rem;
    }

    /* ── Buttons ── */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
        min-height: 44px;
    }
    .btn-lg {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
    .d-flex.gap-3 {
        flex-direction: column;
        gap: 1rem;
    }
    .d-flex.gap-3 .btn {
        width: 100%;
    }

    /* ── Forms ── */
    .form-control,
    .form-select {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 0.5rem;
        min-height: 48px;
    }
    .form-control:focus,
    .form-select:focus {
        border-color: var(--color-secondary);
        box-shadow: 0 0 0 0.2rem rgba(184, 74, 90, 0.25);
    }
    textarea.form-control {
        min-height: 120px;
    }
    .input-group {
        flex-direction: column;
    }
    .input-group .btn {
        border-radius: 0.5rem;
        margin-top: 0.5rem;
    }

    /* ── Tables ── */
    .table-responsive {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    .table { font-size: 0.875rem; }
    .table th,
    .table td { padding: 0.5rem; vertical-align: middle; }

    /* ── Footer ── */
    footer {
        text-align: center;
        padding: 2rem 0;
    }
    footer .row > div {
        margin-bottom: 2rem;
    }
    .social-links {
        justify-content: center;
        margin-top: 1rem;
    }
    .social-links a {
        margin: 0 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    /* ── Jobs ── */
    .job-card { min-height: 340px; }
    .job-card .card-body { padding: 1rem; }

    /* ── Contact ── */
    .contact-form,
    .contact-info {
        padding: 1.5rem;
        border-radius: 1rem;
    }
    .contact-info { margin-bottom: 2rem; }

    /* ── About ── */
    .about-sections .card-body {
        padding: 2rem 1.5rem;
    }
    .overview-icon {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }

    /* ── Team ── */
    .team-card { margin-bottom: 2rem; border-radius: 1rem; }
    .team-img-wrapper { height: 280px; }
    .ceo-card .team-img-wrapper { height: 320px; }
    .director-card .team-img-wrapper { height: 300px; }
    .team-overlay {
        opacity: 1;
        background: linear-gradient(transparent 0%, rgba(100,32,39,0.6) 100%);
    }
    .team-social .btn { width: 35px; height: 35px; font-size: 0.875rem; }

    /* ── Moments ── */
    .training-carousel-wrapper { padding: 1rem; }
    .carousel-image-container { border-radius: 1rem; margin-bottom: 1rem; }

    /* ── Values ── */
    .core-diagram {
        width: 320px;
        height: 320px;
    }
    .lightbulb-icon {
        font-size: 10rem;
    }

    /* ── History timeline ── */
    .timeline::before { left: 20px; }
    .timeline-dot { left: 14px; }
    .timeline-point { left: 10px; }
    .timeline-year { left: 30px; transform: none; }
    .timeline-content { margin-left: 45px; margin-right: 0; }

    /* ── Glass card fallback ── */
    .glass-card {
        backdrop-filter: none;
        background: var(--color-bg);
        border: 1px solid var(--color-border-light);
    }

    /* ── Carousels ── */
    .carousel-caption {
        bottom: 0.5rem;
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
    }
    .carousel-caption h5 { font-size: 1rem; }
    .carousel-caption p  { font-size: 0.85rem; }
    .carousel-control-prev,
    .carousel-control-next { width: 8%; }
    .carousel-indicators [data-bs-target] {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

    /* ── Modals ── */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    .modal-content { border-radius: 1rem; }
    .modal-footer {
        flex-direction: column;
    }
    .modal-footer .btn { width: 100%; margin-bottom: 0.5rem; }

    /* ── Grid helpers ── */
    .col-md-6,
    .col-lg-4,
    .col-lg-6,
    .col-lg-8 {
        margin-bottom: 1.5rem;
    }

    /* ── Spacing override helpers ── */
    .row.g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1.5rem; }
    .row.g-5 { --bs-gutter-x: 1rem; --bs-gutter-y: 2rem; }

    /* ── Touch-friendly targets ── */
    .btn,
    .nav-link,
    .dropdown-item,
    .page-link {
        min-height: 44px;
        min-width: 44px;
    }

    /* ── Performance ── */
    .hero-bg-slide,
    .carousel-item,
    .card {
        will-change: transform, opacity;
        backface-visibility: hidden;
    }

    /* ── Visibility utilities ── */
    .hide-on-mobile { display: none; }
}

@media (min-width: 768px) {
    .hide-on-desktop { display: none; }
    .hide-on-mobile  { display: block; }
}

/* ===================================================================
   ≤ 575px — Small phones
   =================================================================== */
@media (max-width: 575.98px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    .page-hero {
        min-height: 50vh;
        padding: 2rem 0;
    }
    .page-hero h1,
    h1 { font-size: 1.75rem; }
    .section-padding { padding: 2.5rem 0; }

    /* Hero images smaller */
    .hero-image-container,
    #heroCarousel {
        max-width: 320px;
        height: 220px;
    }
    .why-carousel-container,
    #whyChooseCarousel {
        max-width: 280px;
        height: 200px;
    }
    .why-image-container { height: 180px; }

    /* Cards */
    .card { margin-bottom: 1.5rem; }
    .form-control { font-size: 0.9rem; }

    /* Footer */
    footer h6 { margin-top: 1.5rem; }
    .social-links a { width: 32px; height: 32px; line-height: 32px; }

    /* Jobs */
    .job-card { min-height: 310px; }

    /* Values */
    .core-diagram { width: 260px; height: 260px; }
    .lightbulb-icon { font-size: 7rem; }

    /* Team */
    .team-img-wrapper { height: 240px; }
    .ceo-card .team-img-wrapper { height: 280px; }
}

/* ===================================================================
   ADMIN PANEL — Mobile-Specific Fixes (≤ 767px)
   =================================================================== */
@media (max-width: 767.98px) {
    /* ── Touch Targets ── */
    .admin-sidebar .nav-link,
    .admin-sidebar .sidebar-accordion-btn,
    .btn-close,
    .page-link,
    .form-check-input {
        min-height: 44px;
        min-width: 44px;
    }
    .btn-sm, .btn-group-sm > .btn {
        min-height: 36px;
        min-width: 36px;
        padding: 0.375rem 0.75rem;
    }
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    /* ── Tables ── */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--color-border-light);
    }
    .table-responsive table {
        min-width: 600px;
    }

    /* ── Modals ── */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }
    .modal-content {
        border-radius: 0;
        height: 100%;
        border: none;
    }
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-border-light);
    }
    .modal-body {
        padding: 1rem;
        overflow-y: auto;
    }
    .modal-footer {
        padding: 1rem;
        border-top: 1px solid var(--color-border-light);
        flex-direction: column;
        gap: 0.5rem;
    }
    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
    }
    .modal-fullscreen-sm-down .modal-content {
        height: 100vh;
    }

    /* ── Admin Sidebar ── */
    .admin-sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .admin-sidebar .sidebar-inner {
        padding-bottom: 100px;
    }
    .admin-overlay {
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
    }

    /* ── Alerts & Notifications ── */
    .alert-dismissible .btn-close {
        width: 44px;
        height: 44px;
        padding: 0;
    }
    .toast-container {
        bottom: 1rem !important;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        transform: translateX(-50%);
        padding: 0 1rem;
    }
    .toast {
        min-height: 48px;
        width: 100%;
        max-width: 350px;
    }

    /* ── Forms ── */
    .form-label {
        font-weight: 500;
        margin-bottom: 0.5rem;
    }
    .form-text {
        font-size: 0.875rem;
    }
    .invalid-feedback, .valid-feedback {
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }

    /* ── Pagination ── */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    .page-item {
        margin: 0;
    }
    .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }

    /* ── Prevent iOS Zoom ── */
    @supports (-webkit-touch-callout: none) {
        .form-control, .form-select, textarea {
            font-size: 16px !important;
        }
    }

    /* ── Pull to Refresh Prevention ── */
    body {
        overscroll-behavior-y: contain;
    }
}
