/* ============================================
   RefundPro - Responsive Overrides
   Comprehensive breakpoints for all pages
   ============================================ */

/* ---- Mobile menu overlay backdrop ---- */
.navbar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
}
.navbar-overlay.active { display: block; }

/* ---- Dashboard sidebar overlay backdrop ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ============================================
   BREAKPOINT: 1200px — Large Desktop
   ============================================ */
@media (max-width: 1200px) {
    .container { max-width: 1000px; }
    .hero h1 { font-size: 3.2rem; }
    .hero-small h1 { font-size: 2.5rem; }
    .section-header h2 { font-size: 2rem; }
    .footer-grid { gap: 30px; }
    .cta-banner h2 { font-size: 2rem; }
    .team-grid,
    .features-grid,
    .steps-grid,
    .drives-grid { gap: 24px; }
}

/* ============================================
   BREAKPOINT: 992px — Desktop / Tablet Landscape
   ============================================ */
@media (max-width: 992px) {
    /* Public pages */
    .hero h1 { font-size: 2.8rem; }
    .hero p { font-size: 1.1rem; }
    .hero-small h1 { font-size: 2.3rem; }
    .section { padding: 70px 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .team-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-grid::before { display: none; }
    .drives-grid { grid-template-columns: repeat(2, 1fr); }
    .services-grid { grid-template-columns: 1fr; }
    .services-grid-home { grid-template-columns: 1fr; }
    .why-grid { grid-template-columns: repeat(2, 1fr); }
    .mvv-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .story-grid { gap: 30px; }
    .contact-grid { gap: 30px; }

    /* Dashboard */
    .sidebar { width: 220px; }
    .main-wrapper { margin-left: 220px; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    /* Admin */
    .charts-row { grid-template-columns: 1fr; }
    .charts-grid-4 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   BREAKPOINT: 768px — Tablet Portrait
   ============================================ */
@media (max-width: 768px) {
    /* ---------- Public Navbar: mobile hamburger ---------- */
    .navbar { padding: 12px 0; }
    .navbar-toggler { display: block; }
    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--white);
        flex-direction: column;
        padding: 80px 24px 24px;
        box-shadow: -4px 0 20px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 999;
        align-items: flex-start;
        overflow-y: auto;
    }
    .navbar-menu.active { right: 0; }

    /* Close button inside mobile nav panel */
    .navbar-close {
        position: absolute;
        top: 16px;
        right: 16px;
        background: #F1F5F9;
        border: none;
        font-size: 1.25rem;
        color: #334155;
        cursor: pointer;
        width: 44px;
        height: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
        z-index: 1001;
        pointer-events: auto;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        line-height: 1;
        padding: 0;
    }
    .navbar-close:hover,
    .navbar-close:active {
        background: #E2E8F0;
        color: #DC2626;
        transform: scale(1.05);
    }
    .navbar-nav {
        flex-direction: column;
        width: 100%;
        gap: 4px;
    }
    .nav-link {
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
    }
    .nav-link::after { display: none; }
    .nav-link:hover,
    .nav-link.active { background: #F1F5F9; }
    .navbar-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--border);
    }
    .navbar-actions .btn { width: 100%; justify-content: center; }

    /* ---------- Hero sections ---------- */
    .hero { min-height: auto; padding: 120px 20px 60px; }
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1.05rem; margin-bottom: 28px; }
    .hero-small { min-height: 300px; padding: 120px 20px 60px; }
    .hero-small h1 { font-size: 2rem; }
    .hero-small p { font-size: 1rem; }

    /* ---------- Sections general ---------- */
    .section { padding: 50px 0; }
    .section-header { margin-bottom: 40px; }
    .section-header h2 { font-size: 1.8rem; }
    .section-header .section-subtitle { font-size: 1rem; }

    /* ---------- Stats section ---------- */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }

    /* ---------- Growth Chart ---------- */
    .growth-chart-card { height: 300px; padding: 20px 16px; }
    .growth-chart-legend { gap: 20px; }
    .legend-item { font-size: 0.88rem; }

    /* ---------- Feature / Service cards ---------- */
    .features-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
    .drives-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
    .feature-card { padding: 30px 18px; }

    /* ---------- Team grid ---------- */
    .team-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
    .team-card { padding: 30px 18px; }

    /* ---------- Steps grid ---------- */
    .steps-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
    .steps-grid::before { display: none; }

    /* ---------- Contact two-columns ---------- */
    .contact-grid { grid-template-columns: 1fr; gap: 30px; }

    /* ---------- About story two-columns ---------- */
    .story-grid { grid-template-columns: 1fr; gap: 30px; }
    .story-grid img { max-height: 300px; object-fit: cover; }

    /* ---------- MVV / Why grids ---------- */
    .mvv-grid { grid-template-columns: 1fr; }
    .why-grid { grid-template-columns: 1fr; }

    /* ---------- Timeline ---------- */
    .timeline::before { left: 20px; }
    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        padding-left: 50px;
        padding-right: 0;
        justify-content: flex-start;
    }
    .timeline-dot { left: 20px; }

    /* ---------- Testimonials ---------- */
    .testimonial-inner { padding: 28px 20px; }
    .carousel-nav { display: none; }
    .testimonial-card { padding: 0 10px; }

    /* ---------- FAQ accordion ---------- */
    .faq-question { padding: 14px 18px; font-size: 0.95rem; }
    .faq-answer { padding: 0 18px; }
    .faq-item.active .faq-answer { padding: 0 18px 16px; }
    .faq-search { max-width: 100%; }

    /* ---------- CTA Banner ---------- */
    .cta-banner { padding: 50px 20px; }
    .cta-banner h2 { font-size: 1.8rem; }
    .cta-banner p { font-size: 1rem; }

    /* ---------- Footer ---------- */
    .footer-grid { grid-template-columns: 1fr; gap: 30px; }
    .footer { padding: 40px 0 0; }
    .newsletter-form { max-width: 100%; }

    /* ---------- Tables: horizontal scroll ---------- */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* ---------- Pagination ---------- */
    .pagination a,
    .pagination span { min-width: 40px; min-height: 40px; height: 40px; font-size: 0.82rem; padding: 0 8px; }

    /* ---------- Modal: nearly full screen ---------- */
    .modal-overlay.active,
    .modal-overlay.show { align-items: flex-end; }
    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
    }

    /* ---------- Auth cards ---------- */
    .auth-section { padding: 100px 16px 40px; }
    .auth-card { padding: 32px 24px; max-width: 95%; }
    .auth-card--login,
    .auth-card--register,
    .auth-card--forgot { max-width: 95%; }

    /* ---------- Dashboard Sidebar: hidden, overlay ---------- */
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-toggle { display: block; }
    .main-wrapper { margin-left: 0; }
    .main-content { padding: 20px 16px; }
    .topbar { padding: 0 16px; }

    /* ---------- Dashboard KPI / Summary cards ---------- */
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }

    /* ---------- Dashboard charts ---------- */
    .charts-row { grid-template-columns: 1fr; }
    .charts-grid-4 { grid-template-columns: 1fr; }

    /* ---------- Dashboard tables ---------- */
    .admin-table-wrapper { overflow-x: auto; }
    .admin-table { min-width: 600px; }
    .data-table { min-width: 500px; }

    /* ---------- Dashboard quick actions ---------- */
    .quick-actions { grid-template-columns: 1fr 1fr; }

    /* ---------- Filter bars: stack ---------- */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-input,
    .filter-bar .form-select,
    .filter-bar .filter-group,
    .filter-bar input,
    .filter-bar select { min-width: 100%; width: 100%; }

    /* ---------- Multi-step form ---------- */
    .step-progress { flex-direction: column; gap: 10px; padding: 16px; }
    .step-line { width: 2px; height: 20px; margin: 0; }
    .step-item { font-size: 0.82rem; }

    /* ---------- Detail grids ---------- */
    .detail-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    /* ---------- Message bubbles ---------- */
    .message-bubble { max-width: 90%; }

    /* ---------- Map ---------- */
    .map-container iframe { height: 280px; }

    /* ---------- Legal content ---------- */
    .legal-content { padding: 0 8px; }

    /* ---------- Brands row ---------- */
    .brands-row { gap: 30px; }
    .brand-name { font-size: 1.25rem; }

    /* ---------- Topbar search on admin ---------- */
    .topbar-search {
        display: none;
        width: 100%;
        order: 3;
        margin-top: 8px;
    }
    .search-wrapper {
        width: 100%;
    }
    .search-wrapper:focus-within {
        width: 100%;
    }
    .search-dropdown {
        min-width: 100%;
        left: 0;
        right: 0;
    }
    .search-result-item {
        padding: 8px 12px;
    }
    .result-customer {
        max-width: 160px;
    }

    /* ---------- Customer profile ---------- */
    .profile-header { flex-direction: column; text-align: center; }
    .account-stats { grid-template-columns: 1fr 1fr; }
    .welcome-banner { padding: 24px 20px; }
    .welcome-banner h2 { font-size: 1.2rem; }

    /* ---------- Touch targets for tablet ---------- */
    .pagination a,
    .pagination span {
        min-width: 40px;
        min-height: 40px;
    }
}

/* ============================================
   BREAKPOINT: 576px — Mobile
   ============================================ */
@media (max-width: 576px) {
    /* ---------- General ---------- */
    body { font-size: 15px; }
    .container { padding: 0 16px; }
    .section { padding: 40px 0; }
    .section-header { margin-bottom: 30px; }
    .section-header h2 { font-size: 1.5rem; }

    /* ---------- Hero ---------- */
    .hero { padding: 100px 16px 50px; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 0.95rem; }
    .hero-buttons { flex-direction: row; align-items: center; width: 100%; justify-content: center; gap: 14px; }
    .hero-buttons .btn { 
        width: auto; 
        min-height: 50px; 
        padding: 15px 28px; 
        font-size: 1.05rem;
        white-space: nowrap;
    }
    .hero-small { min-height: 250px; padding: 100px 16px 50px; }
    .hero-small h1 { font-size: 1.7rem; }

    /* ---------- Buttons ---------- */
    .btn { padding: 10px 22px; font-size: 0.9rem; }
    .btn-lg { padding: 13px 28px; font-size: 1rem; }

    /* ---------- Stats: single col ---------- */
    .stats-grid { grid-template-columns: 1fr; }
    .stat-number { font-size: 2rem; }

    /* ---------- Growth Chart: smaller ---------- */
    .growth-chart-card { height: 260px; padding: 16px 12px; }
    .growth-chart-legend { flex-direction: column; align-items: center; gap: 10px; }

    /* ---------- Grids: single column ---------- */
    .features-grid,
    .team-grid,
    .steps-grid,
    .drives-grid { grid-template-columns: 1fr; gap: 16px; }
    .feature-card,
    .team-card { padding: 28px 16px; }
    .services-grid { grid-template-columns: 1fr; }
    .services-grid-home { grid-template-columns: 1fr; }

    /* ---------- Cards general ---------- */
    .card { padding: 24px 18px; }
    .card:hover { transform: none; }

    /* ---------- Footer ---------- */
    .footer-grid { grid-template-columns: 1fr; }
    .newsletter-form { flex-direction: column; }
    .newsletter-form input,
    .newsletter-form .btn { width: 100%; }

    /* ---------- Contact form ---------- */
    .contact-grid { grid-template-columns: 1fr; }

    /* ---------- CTA ---------- */
    .cta-banner { padding: 40px 16px; }
    .cta-banner h2 { font-size: 1.5rem; }

    /* ---------- Brands ---------- */
    .brands-row { gap: 20px; flex-direction: column; }
    .brand-name { font-size: 1.15rem; }

    /* ---------- Testimonials ---------- */
    .testimonial-inner { padding: 24px 16px; }
    .testimonial-inner .quote { font-size: 1rem; }
    .testimonial-person { flex-direction: column; gap: 10px; }

    /* ---------- Timeline ---------- */
    .timeline-content { max-width: 100%; }

    /* ---------- Auth ---------- */
    .auth-section { padding: 90px 12px 30px; }
    .auth-card { padding: 24px 18px; border-radius: 12px; }
    .auth-header h2 { font-size: 20px; }
    .auth-header-icon { width: 52px; height: 52px; font-size: 20px; }
    .social-buttons { gap: 8px; }
    .form-options { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* ---------- Dashboard ---------- */
    .main-content { padding: 16px 12px; }
    .topbar { padding: 0 12px; height: 56px; }
    .topbar-title { font-size: 1rem; }
    .topbar-user-name { display: none; }
    .topbar-right { gap: 12px; }
    .topbar-icons { gap: 4px; }

    /* ---------- Dashboard KPI cards: 1 col ---------- */
    .summary-cards { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
    .summary-card { padding: 18px; }
    .kpi-card { padding: 1.1rem; }

    /* ---------- Dashboard quick actions: 1 col ---------- */
    .quick-actions { grid-template-columns: 1fr; }

    /* ---------- Dashboard tables: smaller text ---------- */
    .data-table { font-size: 0.8rem; }
    .data-table thead th,
    .data-table tbody td { padding: 10px 8px; }
    .admin-table th,
    .admin-table td { padding: 0.65rem 0.6rem; font-size: 0.8rem; }

    /* ---------- Filter bar ---------- */
    .filter-bar { padding: 12px; gap: 10px; }
    .filter-bar .btn-filter,
    .filter-bar .btn-reset { width: 100%; text-align: center; justify-content: center; }

    /* ---------- Message thread ---------- */
    .message-bubble { max-width: 95%; font-size: 0.85rem; }
    .message-thread { max-height: 400px; }

    /* ---------- Modals: full screen ---------- */
    .modal { border-radius: 12px 12px 0 0; }
    .modal-header { padding: 16px 18px; }
    .modal-body { padding: 18px; }
    .modal-footer { padding: 14px 18px; }

    /* ---------- Pagination compact ---------- */
    .pagination { gap: 4px; }
    .pagination a,
    .pagination span { min-width: 30px; height: 30px; font-size: 0.78rem; padding: 0 6px; }

    /* ---------- Customer specific ---------- */
    .welcome-banner { padding: 20px 16px; }
    .welcome-banner h2 { font-size: 1.1rem; }
    .welcome-banner p { font-size: 0.85rem; }
    .account-stats { grid-template-columns: 1fr; }
    .profile-header .profile-info h2 { font-size: 1.1rem; }

    /* ---------- Step progress compact ---------- */
    .step-progress { padding: 12px; gap: 6px; }
    .step-circle { width: 30px; height: 30px; font-size: 0.78rem; }
    .step-item { font-size: 0.78rem; gap: 6px; }
    .step-line { height: 14px; }

    /* ---------- Upload area ---------- */
    .upload-area { padding: 28px 16px; }
    .upload-area i { font-size: 1.8rem; }

    /* ---------- Review rows ---------- */
    .review-row { flex-direction: column; gap: 4px; }

    /* ---------- Tabs ---------- */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { white-space: nowrap; padding: 10px 14px; font-size: 0.82rem; }

    /* ---------- Settings tabs ---------- */
    .settings-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .settings-tab { white-space: nowrap; padding: 0.65rem 1rem; font-size: 0.82rem; }

    /* ---------- Activity feed ---------- */
    .activity-item { padding: 0.6rem 0; gap: 0.5rem; }
    .activity-text { font-size: 0.82rem; }
    .activity-time { font-size: 0.7rem; }

    /* ---------- Notifications ---------- */
    .notification-item { padding: 12px 14px; gap: 10px; }
    .notification-title { font-size: 0.84rem; }
    .notification-text { font-size: 0.78rem; }

    /* ---------- Messages list ---------- */
    .message-list-item { padding: 12px 14px; gap: 10px; }
    .message-item { padding: 0.75rem; gap: 0.5rem; }

    /* ---------- Charts ---------- */
    .chart-container { height: 220px; }

    /* ---------- Bulk actions ---------- */
    .bulk-actions { flex-direction: column; align-items: stretch; }
    .action-buttons { flex-direction: column; }
    .action-buttons .btn { width: 100%; justify-content: center; }

    /* ---------- Report cards ---------- */
    .report-summary { grid-template-columns: 1fr 1fr; }
    .report-card .report-value { font-size: 1.3rem; }

    /* ── Mobile Card Layout for Data Tables ── */
    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 14px 16px;
        margin-bottom: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        text-align: right;
        font-size: 0.85rem;
    }

    .data-table tbody td:last-child {
        border-bottom: none;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: #64748b;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        margin-right: 12px;
    }

    /* Remove min-width that forces horizontal scroll */
    .data-table {
        min-width: unset !important;
    }

    .table-responsive {
        overflow-x: visible;
    }

    /* ── Touch Target Improvements ── */

    /* Pagination items - ensure 44px minimum */
    .pagination a,
    .pagination span {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Filter bar buttons full-width */
    .filter-bar .btn,
    .filter-bar button {
        width: 100%;
        min-height: 44px;
    }

    /* Notification items - larger tap area */
    .notification-item {
        padding: 14px 16px;
        min-height: 44px;
    }

    /* Message list items - larger tap area */
    .message-item {
        padding: 14px 16px;
        min-height: 44px;
    }

    /* General button minimum touch target */
    .btn, button {
        min-height: 44px;
    }

    /* Small buttons still need touch-friendly sizing */
    .btn-sm {
        min-height: 40px;
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Action links in table cards */
    .data-table tbody td .btn,
    .data-table tbody td a.btn {
        min-height: 40px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Nav links in sidebar */
    .sidebar .nav-link {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* ── Small Screen Polish ── */

    /* Reduce empty state padding */
    .empty-state {
        padding: 40px 20px;
    }

    /* Welcome banner text overflow prevention */
    .welcome-banner h2,
    .welcome-banner p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Message thread max-height on small screens */
    .message-thread,
    .messages-container {
        max-height: 350px;
    }
}

/* ============================================
   BREAKPOINT: 400px — Very small mobile
   ============================================ */
@media (max-width: 400px) {
    .hero h1 { font-size: 1.55rem; }
    .hero-small h1 { font-size: 1.45rem; }
    .section-header h2 { font-size: 1.35rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-number { font-size: 1.6rem; }
    .report-summary { grid-template-columns: 1fr; }
    .summary-card { gap: 12px; }
    .summary-icon { width: 42px; height: 42px; font-size: 1rem; }
    .kpi-icon { width: 46px; height: 46px; font-size: 1.1rem; }

    /* ── Very Small Screen Polish ── */

    /* Dashboard card padding reduction */
    .dashboard-card {
        padding: 16px 14px;
    }

    /* Message bubbles wider on tiny screens */
    .message-bubble {
        max-width: 95%;
    }

    /* Welcome banner even tighter */
    .welcome-banner {
        padding: 16px;
    }

    .welcome-banner h2 {
        font-size: 1rem;
    }

    /* Empty state even more compact */
    .empty-state {
        padding: 30px 16px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .navbar,
    .footer,
    .sidebar,
    .topbar,
    .navbar-overlay,
    .sidebar-overlay,
    .carousel-nav,
    .carousel-dots,
    .btn,
    .filter-bar,
    .quick-actions,
    .hero-buttons,
    .cta-banner,
    .navbar-toggler,
    .sidebar-toggle { display: none !important; }

    body,
    .dashboard-body { background: #fff !important; color: #000 !important; font-size: 12pt; }
    .main-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
    .hero,
    .hero-small { min-height: auto; padding: 20px; }
    .hero::before,
    .hero-small::before { display: none; }
    .hero h1,
    .hero-small h1 { color: #000; font-size: 24pt; }

    .card,
    .dashboard-card,
    .summary-card,
    .kpi-card,
    .chart-card,
    .detail-card { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }

    a { color: #000 !important; text-decoration: underline; }
    .badge { border: 1px solid #999; }
    table { border-collapse: collapse; }
    table th,
    table td { border: 1px solid #ccc; padding: 8px; }
}
