/* ===========================
   Responsive Design Utilities
   =========================== */

/* Breakpoint Custom Properties */
:root {
    --mobile-max: 768px;
    --tablet-min: 768px;
    --tablet-max: 1024px;
    --desktop-min: 1024px;
    --desktop-max: 1440px;
    --large-min: 1440px;

    /* Responsive spacing */
    --spacing-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 1vw, 1rem);
    --spacing-md: clamp(1rem, 2vw, 1.5rem);
    --spacing-lg: clamp(1.5rem, 3vw, 2rem);
    --spacing-xl: clamp(2rem, 4vw, 3rem);
}

/* ===========================
   Container Queries (Progressive Enhancement)
   =========================== */
@container (max-width: 768px) {
    .responsive-container {
        padding: 1rem;
    }
}

/* ===========================
   Mobile (<768px)
   =========================== */
@media (max-width: 767px) {
    /* Data Tables - Horizontal Scroll */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    /* Card Mode for Tables */
    .responsive-table.card-mode {
        display: block;
    }

    .responsive-table.card-mode thead {
        display: none;
    }

    .responsive-table.card-mode tbody {
        display: block;
    }

    .responsive-table.card-mode tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        background: white;
    }

    .responsive-table.card-mode td {
        display: block;
        text-align: left !important;
        padding: 0.5rem 0;
        border: none;
    }

    .responsive-table.card-mode td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 0.25rem;
        color: #6b7280;
    }

    /* Dashboard KPI Cards - 1 Column */
    .kpi-grid,
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    /* Forms - Full Width */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    textarea,
    select {
        width: 100%;
        font-size: 16px; /* Prevent iOS zoom */
    }

    /* Modals - Full Screen */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }

    /* Hero Section - Stacked */
    .hero-section {
        flex-direction: column;
        text-align: center;
    }

    .hero-content,
    .hero-image {
        width: 100%;
    }

    /* Feature Cards - 1 Column */
    .feature-grid {
        grid-template-columns: 1fr !important;
    }

    /* Pricing Cards - Horizontal Scroll */
    .pricing-grid {
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .pricing-card {
        min-width: 280px;
        scroll-snap-align: start;
    }

    /* Text Sizing */
    h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }

    h2 {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    h3 {
        font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    }

    /* Buttons - Full Width Option */
    .btn-mobile-full {
        width: 100%;
        display: block;
    }

    /* Navigation - Hamburger */
    .navbar-toggler {
        display: block;
    }

    .navbar-collapse {
        display: none;
    }

    .navbar-collapse.show {
        display: block;
    }
}

/* ===========================
   Tablet (768px - 1024px)
   =========================== */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Dashboard KPI Cards - 2 Columns */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Feature Cards - 2 Columns */
    .feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Data Tables - Horizontal Scroll */
    .data-table-wrapper {
        overflow-x: auto;
    }
}

/* ===========================
   Desktop (1024px - 1440px)
   =========================== */
@media (min-width: 1024px) and (max-width: 1439px) {
    /* Dashboard KPI Cards - 4 Columns */
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Feature Cards - 3 Columns */
    .feature-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

}

/* ===========================
   Large Desktop (>1440px)
   =========================== */
@media (min-width: 1440px) {
    /* Dashboard KPI Cards - 4 Columns */
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Feature Cards - 4 Columns */
    .feature-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Max-width container */
    .container-xl {
        max-width: 1400px;
    }
}

/* ===========================
   Landscape Orientation
   =========================== */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-dialog {
        overflow-y: auto;
    }

    .hero-section {
        min-height: auto;
    }
}

/* ===========================
   Touch Device Optimizations
   =========================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    *:hover {
        background-color: initial;
    }

    /* A tablet may still have a keyboard, so keep a heavier ring for it — but
       on `:focus-visible`, not `:focus`. Ringing on plain `:focus` here meant a
       tap left the ring stuck on the button until something else took focus. */
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
        outline: 3px solid var(--g-accent-hover);
        outline-offset: 2px;
    }
}

/* ===========================
   Utility Classes
   =========================== */

/* Hide on Mobile */

/* Hide on Tablet */

/* Hide on Desktop */

/* Show only on Mobile */

/* Responsive Text Alignment */

/* Responsive Spacing */
