/* ============================================
   RESPONSIVE.CSS - Mobile-First Responsive Design
   Federal Intermediate Bank
   ============================================ */

/* ====== CRITICAL OVERFLOW-X FIXES ====== */
html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

/* Table container fix - make tables scrollable on mobile */
.table-responsive,
.card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ----- CSS Custom Properties for Responsive ----- */
:root {
    --touch-target: 44px;
    --nav-height-desktop: 64px;
    --nav-height-mobile: 56px;
    --sidebar-width: 260px;
    --content-padding-desktop: 2rem;
    --content-padding-tablet: 1.25rem;
    --content-padding-mobile: 0.75rem;
}

/* ----- Base Responsive Typography ----- */
h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
h4 { font-size: clamp(1rem, 2vw, 1.25rem); }
p { font-size: clamp(0.875rem, 1.5vw, 1rem); }

/* ----- Responsive Container ----- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: clamp(0.75rem, 3vw, 2rem);
    padding-right: clamp(0.75rem, 3vw, 2rem);
}

/* ============================================
   MOBILE-FIRST: 320px - 767px
   ============================================ */
@media (max-width: 767px) {
    /* Typography scaling */
    .hero-title {
        font-size: clamp(1.75rem, 7vw, 2.5rem) !important;
    }
    
    .hero-subtitle {
        font-size: clamp(0.95rem, 3vw, 1.1rem) !important;
    }
    
    .balance-amount {
        font-size: clamp(1.5rem, 6vw, 2.2rem) !important;
    }
    
    .page-title {
        font-size: 1.25rem !important;
    }
    
    .stat-value {
        font-size: 1.5rem !important;
    }
    
    .nav-brand span {
        font-size: clamp(0.9rem, 3vw, 1rem);
    }
    
    /* Touch-friendly minimum target sizes */
    .nav-item,
    .nav-btn,
    .quick-action,
    .action-btn,
    .btn,
    .dropdown-item,
    .sidebar-link,
    .pagination a,
    .pagination span,
    .transaction-item,
    .pending-item,
    .filter-select,
    .currency-selector,
    .month-selector,
    .promo-cta,
    .social-links a,
    button,
    input[type="submit"],
    input[type="button"],
    .form-control,
    select {
        min-height: var(--touch-target);
    }
    
    /* Remove fixed background attachments (performance) */
    body {
        background-attachment: scroll !important;
    }
    
    .hero,
    .balance-hero,
    .contact-footer,
    .transactions-card {
        background-attachment: scroll !important;
    }
    
    /* Hide desktop noise texture on mobile for performance */
    body:not(.admin-page)::before {
        display: none;
    }

    /* ======== NAVIGATION MOBILE ======== */
    .top-nav {
        height: var(--nav-height-mobile) !important;
        padding: 0 0.75rem !important;
    }
    
    .nav-menu {
        display: flex !important;
        position: fixed;
        top: var(--nav-height-mobile);
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(rgba(10, 15, 30, 0.92), rgba(10, 15, 30, 0.92)), url('../images/dashboard-bg.jpg') center/cover no-repeat;
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        flex-direction: column !important;
        padding: 1rem;
        gap: 0.25rem !important;
        overflow-y: auto;
        z-index: 999;
        /* Hidden by default with smooth transition */
        pointer-events: none;
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .nav-menu.open {
        pointer-events: auto;
        opacity: 1;
        transform: translateY(0);
        z-index: 9999 !important;
        will-change: transform;
    }
    
    /* Staggered slide-in for nav items */
    .nav-menu.open .nav-item {
        animation: navItemSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
    .nav-menu.open .nav-item:nth-child(1)  { animation-delay: 0.03s; }
    .nav-menu.open .nav-item:nth-child(2)  { animation-delay: 0.06s; }
    .nav-menu.open .nav-item:nth-child(3)  { animation-delay: 0.09s; }
    .nav-menu.open .nav-item:nth-child(4)  { animation-delay: 0.12s; }
    .nav-menu.open .nav-item:nth-child(5)  { animation-delay: 0.15s; }
    .nav-menu.open .nav-item:nth-child(6)  { animation-delay: 0.18s; }
    .nav-menu.open .nav-item:nth-child(7)  { animation-delay: 0.21s; }
    .nav-menu.open .nav-item:nth-child(8)  { animation-delay: 0.24s; }
    .nav-menu.open .nav-item:nth-child(9)  { animation-delay: 0.27s; }
    .nav-menu.open .nav-item:nth-child(10) { animation-delay: 0.30s; }
    
    @keyframes navItemSlide {
        from {
            opacity: 0;
            transform: translateX(-16px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    .nav-item {
        padding: 0.85rem 1rem !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }
    
    .nav-item i {
        font-size: 1.15rem !important;
        margin-bottom: 0 !important;
    }
    
    .nav-item.active::after {
        display: none !important;
    }
    
    .nav-item.active {
        background: rgba(0, 212, 170, 0.12) !important;
    }
    
    .hamburger-btn {
        display: flex !important;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: rgba(0, 212, 170, 0.08);
        border: 1px solid rgba(0, 212, 170, 0.15);
        color: var(--accent);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    }
    
    .hamburger-btn:hover {
        background: rgba(0, 212, 170, 0.15);
        border-color: rgba(0, 212, 170, 0.3);
    }
    
    .hamburger-btn.open {
        background: rgba(0, 212, 170, 0.15);
        border-color: rgba(0, 212, 170, 0.3);
        box-shadow: 0 0 20px rgba(0, 212, 170, 0.15);
    }
    
    .hamburger-btn i {
        font-size: 1.2rem;
        transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .hamburger-btn.open i {
        transform: rotate(180deg);
    }
    
    /* ======== MAIN CONTENT MOBILE ======== */
    .main-content {
        padding: 1rem 0.75rem !important;
        margin-left: 0 !important;
    }
    
    .top-header {
        padding: 0.75rem 0 !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    .greeting h1 {
        font-size: 1.25rem !important;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* ======== SIDEBAR MOBILE ======== */
    .sidebar {
        width: 280px !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1001;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1000;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* ======== DASHBOARD LAYOUT MOBILE ======== */
    .left-col,
    .right-col {
        gap: 1rem !important;
    }
    
    /* Balance Hero */
    .balance-hero {
        padding: 1.25rem !important;
        border-radius: 16px !important;
    }
    
    .balance-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    
    .balance-row {
        gap: 0.75rem !important;
    }
    
    .toggle-balance {
        width: 40px !important;
        height: 40px !important;
    }
    
    .account-card {
        padding: 0.85rem 1rem !important;
    }
    
    .account-number-display {
        flex-wrap: wrap;
    }
    
    /* ======== QUICK ACTIONS MOBILE ======== */
    .quick-actions {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .quick-action {
        padding: 0.75rem 0.5rem !important;
        gap: 0.35rem !important;
    }
    
    .quick-action i {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }
    
    .quick-action span {
        font-size: 0.65rem !important;
    }
    
    /* ======== CARDS MOBILE ======== */
    .card {
        border-radius: 14px !important;
    }
    
    .card-header,
    .card-body {
        padding: 1rem !important;
    }
    
    .chart-card {
        padding: 1rem !important;
        border-radius: 16px !important;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    
    .donut-chart {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .chart-container {
        width: 140px !important;
        height: 140px !important;
    }
    
    /* ======== TRANSACTIONS MOBILE ======== */
    .transactions-card {
        border-radius: 16px !important;
    }
    
    .transactions-header {
        padding: 1rem !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    
    .transactions-header h2 {
        font-size: 1.1rem !important;
    }
    
    .transaction-item {
        grid-template-columns: 36px 1fr auto !important;
        gap: 0.65rem !important;
        padding: 0.75rem 0.85rem !important;
    }
    
    .merchant-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.85rem !important;
    }
    
    .merchant-name {
        font-size: 0.85rem !important;
    }
    
    .transaction-meta {
        flex-wrap: wrap;
        gap: 0.35rem !important;
    }
    
    .transaction-amount {
        font-size: 0.85rem !important;
    }
    
    .category-tag {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.4rem !important;
    }
    
    .transaction-time {
        font-size: 0.65rem !important;
    }
    
    /* ======== PENDING TRANSACTIONS MOBILE ======== */
    .pending-header {
        padding: 1rem !important;
    }
    
    .pending-item {
        padding: 0.75rem 1rem !important;
        grid-template-columns: 36px 1fr auto !important;
        gap: 0.65rem !important;
    }
    
    .pending-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.85rem !important;
    }
    
    .pending-name {
        font-size: 0.85rem !important;
    }
    
    .pending-amount {
        font-size: 0.85rem !important;
    }
    
    /* ======== FORMS MOBILE ======== */
    .auth-card {
        padding: 1.5rem !important;
    }
    
    .login-card {
        padding: 1.5rem !important;
    }
    
    .form-control {
        padding: 0.85rem 0.9rem !important;
    }
    
    .form-control,
    .form-input {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1.25rem !important;
        font-size: 0.9rem !important;
    }
    
    .btn-sm {
        width: auto;
        padding: 0.5rem 1rem !important;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 0.75rem !important;
    }
    
    .search-box {
        max-width: 100% !important;
        min-width: unset !important;
    }
    
    .filter-select {
        width: 100%;
    }
    
    /* ======== TABLES MOBILE ======== */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    .table {
        font-size: 0.75rem !important;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.6rem 0.5rem !important;
        white-space: nowrap;
    }
    
    /* Mobile card-style table fallback */
    .table-responsive-card {
        border: 0;
    }
    
    .table-responsive-card thead {
        display: none;
    }
    
    .table-responsive-card tbody tr {
        display: block;
        padding: 0.85rem;
        margin-bottom: 0.75rem;
        background: var(--glass);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
    }
    
    .table-responsive-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0 !important;
        border: none !important;
        min-height: 32px;
    }
    
    .table-responsive-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    
    /* ======== PROMO CAROUSEL MOBILE - Enhanced Eye-Catching Version ======== */
    .promo-carousel {
        padding: 0.85rem 1rem !important;
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px !important;
        background: 
            linear-gradient(135deg, 
                rgba(0, 212, 170, 0.12) 0%, 
                rgba(255, 179, 71, 0.08) 50%,
                rgba(15, 20, 35, 0.95) 100%
            ) !important;
    }
    
    .promo-track {
        min-width: 0 !important;
    }
    
    .promo-slide {
        min-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
    }
    
    .promo-content {
        gap: 0.75rem !important;
        flex-wrap: wrap !important;
        align-items: center !important;
    }
    
    .promo-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.1rem !important;
        flex-shrink: 0 !important;
        border-radius: 12px !important;
    }
    
    .promo-text {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .promo-text h3 {
        font-size: 0.95rem !important;
        color: #fff !important;
        font-weight: 700 !important;
    }
    
    .promo-text p {
        font-size: 0.75rem !important;
        color: #FFD700 !important;
    }
    
    .promo-cta {
        flex-shrink: 0 !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.75rem !important;
        border-radius: 8px !important;
        background: linear-gradient(135deg, var(--accent), #00a88a) !important;
        color: var(--primary) !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
    }
    
    .promo-dots .dot {
        width: 8px !important;
        height: 8px !important;
    }
    
    .promo-dots .dot.active {
        width: 22px !important;
        background: linear-gradient(135deg, var(--accent), #FFB347) !important;
    }
    
    /* ======== NOTIFICATIONS MOBILE ======== */
    .notif-dropdown {
        position: fixed !important;
        top: var(--nav-height-mobile) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - var(--nav-height-mobile));
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
    
    .notif-dropdown-body {
        max-height: calc(100vh - var(--nav-height-mobile) - 120px) !important;
    }
    
    .notif-dropdown-item {
        padding: 0.65rem 0.85rem !important;
    }
    
    .notif-item-delete {
        opacity: 1 !important;
        width: 32px !important;
        height: 32px !important;
    }
    
    /* ======== MODAL MOBILE ======== */
    .modal {
        padding: 0.5rem !important;
        align-items: flex-end !important;
    }
    
    .modal-content {
        margin-top: auto;
        border-radius: 20px 20px 0 0 !important;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem !important;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* ======== ACTION GRID MOBILE ======== */
    .action-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
    }
    
    .action-btn {
        padding: 1rem !important;
    }
    
    /* ======== VALUES SECTION MOBILE ======== */
    .values-section {
        padding: 2rem 0.75rem !important;
    }
    
    .values-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .value-card {
        padding: 1.5rem !important;
    }
    
    .value-icon {
        width: 56px !important;
        height: 56px !important;
    }
    
    /* ======== CONTACT FOOTER MOBILE ======== */
    .contact-footer {
        padding: 2rem 0.75rem 1rem !important;
    }
    
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .contact-section {
        padding: 1.15rem !important;
    }
    
    /* ======== BANKING LOGOS MOBILE ======== */
    .logos-grid {
        gap: 1.5rem !important;
    }
    
    .logo-svg {
        width: 50px !important;
        height: 50px !important;
    }
    
    .logo-item span {
        font-size: 0.55rem !important;
    }
    
    /* ======== STATS COUNTER MOBILE ======== */
    .stats-counter {
        gap: 1.5rem !important;
        flex-wrap: wrap;
    }
    
    .stat-number {
        font-size: 1.75rem !important;
    }
    
    /* ======== CHAT WIDGET MOBILE ======== */
    .chat-widget {
        bottom: 12px !important;
        right: 12px !important;
    }
    
    .chat-toggle {
        width: 52px !important;
        height: 52px !important;
    }
    
    .chat-box {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 85vh !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4) !important;
    }
    
    /* ======== FOOTER MOBILE ======== */
    .footer {
        padding: 2rem 0 !important;
    }
    
    /* ======== TRANSACTION STATUS GUIDE MOBILE ======== */
    .tx-status-badge {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.45rem !important;
    }
    
    /* ======== LOAN STATS MOBILE ======== */
    .loan-stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    /* ======== APP PREVIEW MOBILE ======== */
    .app-preview {
        padding: 1.5rem !important;
    }
    
    .app-screen {
        padding: 1rem !important;
    }
    
    /* ======== BANK CAROUSEL MOBILE ======== */
    .bank-carousel-inner .d-flex {
        flex-direction: column;
        align-items: center !important;
    }
    
    /* ======== TRANSACTION ALERT BANNERS MOBILE ======== */
    .balance-hero > div[style*="background: rgba(255,179,71"] {
        padding: 0.85rem !important;
    }
    
    .balance-hero > div[style*="background: rgba(71, 179, 255"] {
        padding: 0.85rem !important;
    }
    
    /* ======== TRANSFER FORM MOBILE ======== */
    .transfer-form {
        padding: 1rem !important;
    }
    
    /* ======== PROFILE PAGE MOBILE ======== */
    .profile-header {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
    }
    
    /* ======== PAGINATION MOBILE ======== */
    .pagination {
        flex-wrap: wrap;
        gap: 0.35rem !important;
    }
    
    .pagination a,
    .pagination span {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
        min-width: 36px;
        min-height: 36px;
    }
    
    /* ======== CONTAINER ADJUSTMENTS ======== */
    [style*="max-width: 1400px"] {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Fix overflow issues */
    .top-header,
    .main-content,
    .container,
    section {
        overflow-x: hidden;
    }
    
    /* Disable hover effects on mobile (prevents stuck hover state) */
    .transaction-item:hover,
    .quick-action:hover,
    .value-card:hover,
    .stat-card:hover,
    .action-btn:hover,
    .nav-item:hover {
        transform: none !important;
    }
    
    /* Ensure buttons have proper spacing */
    .d-flex.gap-3.flex-wrap {
        gap: 0.65rem !important;
    }
}

/* ============================================
   TABLET: 768px - 1024px
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Typography */
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    /* ======== NAVIGATION TABLET ======== */
    .top-nav {
        padding: 0 1.25rem !important;
    }
    
    .nav-menu {
        gap: 0.15rem !important;
    }
    
    .nav-item {
        padding: 0.55rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
    
    .nav-item i {
        font-size: 0.95rem !important;
    }
    
    .hamburger-btn {
        display: none !important;
    }
    
    /* ======== MAIN CONTENT TABLET ======== */
    .main-content {
        margin-left: 0 !important;
        padding: 1.25rem !important;
    }
    
    .top-header {
        padding: 0.85rem 0 !important;
    }
    
    /* ======== SIDEBAR TABLET ======== */
    .sidebar {
        width: 220px !important;
    }
    
    /* ======== DASHBOARD LAYOUT TABLET ======== */
    .main-content.grid-2col {
        grid-template-columns: 1fr !important;
    }
    
    .left-col,
    .right-col {
        gap: 1.25rem !important;
    }
    
    /* Balance Card */
    .balance-hero {
        padding: 1.5rem !important;
    }
    
    .balance-amount {
        font-size: 2.25rem !important;
    }
    
    /* Quick Actions */
    .quick-actions {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* ======== CARDS TABLET ======== */
    .card-header,
    .card-body {
        padding: 1.25rem !important;
    }
    
    .chart-card {
        padding: 1.25rem !important;
    }
    
    .donut-chart {
        gap: 1.5rem !important;
    }
    
    /* ======== TRANSACTIONS TABLET ======== */
    .transaction-item {
        padding: 0.85rem 1rem !important;
        gap: 0.75rem !important;
    }
    
    .merchant-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* ======== FORMS TABLET ======== */
    .auth-card {
        padding: 2rem !important;
    }
    
    .action-bar {
        flex-wrap: wrap;
    }
    
    .search-box {
        max-width: 250px !important;
    }
    
    /* ======== NOTIFICATIONS TABLET ======== */
    .notif-dropdown {
        right: -60px !important;
    }
    
    /* ======== VALUES SECTION TABLET ======== */
    .values-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* ======== CONTACT FOOTER TABLET ======== */
    .contact-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* ======== MODAL TABLET ======== */
    .modal-content {
        max-width: 90% !important;
    }
    
    /* ======== TABLE TABLET ======== */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* ======== PROMO CAROUSEL TABLET ======== */
    .promo-carousel {
        padding: 0.85rem 1rem !important;
    }
    
    /* ======== TRANSACTION STATUS GUIDE TABLET ======== */
    .transactions-card div[style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* ======== LOGOS TABLET ======== */
    .logos-grid {
        gap: 2rem !important;
    }
    
    .logo-svg {
        width: 60px !important;
        height: 60px !important;
    }
    
    /* ======== FOOTER TABLET ======== */
    .contact-footer {
        padding: 2.5rem 1.25rem 1.5rem !important;
    }
}

/* ============================================
   DESKTOP: 1025px+
   ============================================ */
@media (min-width: 1025px) {
    .hamburger-btn {
        display: none !important;
    }

    .nav-item {
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .nav-item i {
        margin-bottom: 0 !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .nav-menu {
        display: flex !important;
    }
}

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

/* ============================================
   UTILITY CLASSES FOR RESPONSIVE
   ============================================ */
.d-mobile-only {
    display: none;
}

.d-tablet-only {
    display: none;
}

.d-desktop-only {
    display: block;
}

@media (max-width: 767px) {
    .d-mobile-only {
        display: block;
    }
    
    .d-desktop-only {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .d-tablet-only {
        display: block;
    }
    
    .d-desktop-only {
        display: none;
    }
}

/* ============================================
   DROPDOWN Z-INDEX & COMPOSITING FIX
   Ensure dropdowns always appear on top of content.
   backdrop-filter on .top-nav creates a GPU compositing
   layer that traps child dropdowns inside it, making
   them render behind content below the nav even when
   z-index is set to 9999.  Multiple layered defenses:
   1) position:fixed removes the element from the
      parent's stacking context entirely.
   2) translateZ(1px) + will-change:transform force
      its own GPU compositing layer as a fallback.
   3) responsive.js dynamically applies position:fixed
      with exact viewport coordinates for maximum
      compatibility.
   ============================================ */

/* ----- Notification dropdown (.notif-dropdown) ----- */
@media (min-width: 768px) {
    .notif-dropdown.show,
    #notifDropdown.show {
        position: fixed !important;
        top: calc(60px + 8px) !important;
        right: 1rem !important;
        left: auto !important;
        bottom: auto !important;
        z-index: 9999 !important;
        transform: translateZ(1px);
        will-change: transform;
    }
}

/* ----- "More" / generic dropdown-menu ----- */
.dropdown-menu.show {
    z-index: 9999 !important;
    transform: translateX(-50%) translateZ(1px);
    will-change: transform;
}

/* ============================================
   ADMIN PAGE LAYOUT FIXES
   Override mobile/tablet/large-desktop rules
   that break the admin sidebar + content layout.
   ============================================ */

/* ----- Keep admin sidebar always visible (never slide off-screen) ----- */
body.admin-page .sidebar {
    position: fixed !important;
    transform: none !important;
}

body.admin-page .sidebar-overlay {
    display: none !important;
}

/* ----- Mobile: narrow sidebar + matching margin ----- */
@media (max-width: 767px) {
    body.admin-page .sidebar {
        width: 180px !important;
    }
    body.admin-page .main-content {
        margin-left: 180px !important;
        min-height: 100vh;
    }
}

/* ----- Tablet: restore proper margin offset ----- */
@media (min-width: 768px) and (max-width: 1024px) {
    body.admin-page .sidebar {
        width: 220px !important;
    }
    body.admin-page .main-content {
        margin-left: 220px !important;
        padding: 1.25rem !important;
    }
}

/* ----- Large desktop: keep sidebar offset instead of centering ----- */
@media (min-width: 1440px) {
    body.admin-page .main-content {
        margin-left: 260px !important;
        margin-right: 0 !important;
        max-width: none !important;
    }
}

/* ============================================
   ACCESSIBILITY & TOUCH OPTIMIZATION
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .transaction-item:hover,
    .quick-action:hover,
    .value-card:hover,
    .stat-card:hover,
    .card:hover,
    .action-btn:hover,
    .nav-item:hover,
    .logo-item:hover,
    .testimonial-card:hover {
        transform: none !important;
    }
    
    /* Improve tap targets */
    a, button, .nav-item, .quick-action, .action-btn {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 212, 170, 0.2);
    }
    
    /* Smooth scrolling */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   SAFARI / iOS FIXES
   ============================================ */
@supports (-webkit-touch-callout: none) {
    .form-control,
    .form-input,
    input,
    textarea,
    select {
        font-size: 16px !important; /* Prevent zoom on focus */
    }
    
    body {
        /* Fix 100vh on iOS Safari */
        min-height: -webkit-fill-available;
    }
}

/* ============================================
   FINAL MOBILE OVERFLOW-X PROTECTION
   ============================================ */
@media (max-width: 767px) {
    /* Force all containers to respect viewport */
    html,
    body,
    .container,
    .card,
    .row,
    .section,
    .d-flex,
    .grid,
    .email-layout,
    .stat-card,
    .chart-card,
    .transactions-card,
    .pending-card,
    .balance-hero,
    .left-col,
    .right-col,
    .promo-carousel,
    .promo-track,
    .promo-slide {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    
    /* Main-content special handling */
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* EXCEPTION: Admin pages need margin-left for sidebar */
    body.admin-page .main-content {
        width: auto !important;
        max-width: none !important;
        margin-left: 180px !important;
    }
    
    /* Make flex items wrap on mobile */
    .d-flex,
    .d-flex.flex-wrap {
        flex-wrap: wrap !important;
    }
    
    .d-flex.gap-3,
    .d-flex.gap-4 {
        gap: 0.75rem !important;
    }
    
    /* Fix any inline min-width styles */
    *[style*="min-width"] {
        min-width: 0 !important;
    }
    
    /* Make images responsive */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Fix table overflow - make container scrollable */
    .card-body {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        display: block !important;
        overflow-x: auto !important;
    }
    
    /* Donut chart fix */
    .donut-chart {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Additional protection: hide any overflow */
    body {
        overflow-x: hidden !important;
    }
    
    /* Fix any fixed widths on mobile */
    *[style*="width: 300px"],
    *[style*="width: 350px"],
    *[style*="width: 380px"],
    *[style*="width: 400px"],
    *[style*="width: 500px"],
    *[style*="width: 600px"] {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .top-nav,
    .sidebar,
    .chat-widget,
    .notif-dropdown,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}
