/* ====================================
   📱 RESPONSIVE DESIGN ENHANCEMENTS
   Phase 4 Enhancement
   ==================================== */

/* Mobile: 0-640px */
@media (max-width: 640px) {

    /* Sidebar */
    .fi-sidebar {
        width: 100% !important;
    }

    .fi-sidebar-item-label {
        font-size: 0.9rem;
    }

    /* Stats Grid */
    .fi-wi-stats-overview-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Cards */
    .fi-section,
    .fi-card {
        padding: 1rem !important;
        margin: 0.5rem 0 !important;
    }

    /* Buttons */
    .fi-btn {
        width: 100%;
        justify-content: center;
    }

    /* Tables */
    .fi-table {
        font-size: 0.875rem;
    }

    .fi-table thead {
        display: none;
    }

    .fi-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(0, 184, 212, 0.2);
        border-radius: 0.5rem;
        padding: 0.75rem;
    }

    .fi-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .fi-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
    }

    /* Disable hover transforms on mobile */
    .fi-section:hover,
    .fi-card:hover,
    .fi-btn:hover {
        transform: none !important;
    }

    /* Modal adjustments */
    .fi-modal {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem !important;
    }
}

/* Tablet: 641px-1024px */
@media (min-width: 641px) and (max-width: 1024px) {

    /* Stats Grid */
    .fi-wi-stats-overview-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Dashboard layout */
    .fi-main {
        padding: 1.5rem !important;
    }

    /* Sidebar */
    .fi-sidebar {
        width: 240px;
    }

    /* Reduce font sizes slightly */
    .fi-header-heading {
        font-size: 1.5rem !important;
    }
}

/* Desktop: 1025px+ */
@media (min-width: 1025px) {

    /* Large screen optimizations */
    .fi-main-content {
        max-width: 1400px;
        margin: 0 auto;
    }

    /* Stats Grid */
    .fi-wi-stats-overview-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .fi-btn,
    .fi-sidebar-item-button,
    button {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    /* Remove hover effects */
    *:hover {
        transform: none !important;
    }

    /* Larger form inputs */
    input,
    textarea,
    select {
        font-size: 16px;
        /* Prevents zoom on iOS */
        min-height: 44px;
    }
}

/* Landscape mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .fi-sidebar {
        position: fixed;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .fi-sidebar.open {
        transform: translateX(0);
    }
}

/* Print styles */
@media print {

    .fi-sidebar,
    .fi-topbar,
    .fi-btn {
        display: none !important;
    }

    .fi-section,
    .fi-card {
        break-inside: avoid;
        box-shadow: none !important;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Sharper borders */
    .fi-section,
    .fi-card {
        border-width: 0.5px;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        /* Auto dark mode when user preference is dark */
        color-scheme: dark;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}