/**
 * PROMOTE Platform - Responsive Stylesheet
 * Mobile-first responsive styles
 */

/* ============================================================================
   MOBILE FIRST APPROACH
   ========================================================================= */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Container */
    .container,
    .container-fluid {
        padding: 0 var(--spacing-md);
    }
    
    /* Header */
    .header-container {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .main-nav ul {
        flex-direction: column;
        width: 100%;
    }
    
    .main-nav a {
        display: block;
        width: 100%;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        display: block;
    }
    
    .btn-sm {
        width: auto;
        display: inline-block;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Dashboard */
    .dashboard-container {
        flex-direction: column;
    }
    
    .dashboard-sidebar {
        width: 100%;
        position: static;
        height: auto;
    }
    
    .dashboard-main {
        padding: var(--spacing-md);
    }
    
    /* Admin */
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        position: static;
        height: auto;
    }
    
    .admin-main {
        padding: var(--spacing-md);
    }
    
    /* Cards */
    .order-header-card,
    .ticket-header-card {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .order-header-right,
    .ticket-header-right {
        align-items: flex-start;
    }
    
    /* Activity Grid */
    .activity-grid {
        grid-template-columns: 1fr;
    }
    
    /* Filters */
    .filters-form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-actions {
        width: 100%;
    }
    
    .filter-actions .btn {
        flex: 1;
    }
    
    /* Status Tabs */
    .status-tabs,
    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Order Details */
    .order-info-grid {
        grid-template-columns: 1fr;
    }
    
    /* Approval Forms */
    .approval-forms {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Form Row */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Activity Grid */
    .activity-grid {
        grid-template-columns: 1fr;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Dashboard Sidebar */
    .dashboard-sidebar {
        width: 240px;
    }
    
    /* Admin Sidebar */
    .admin-sidebar {
        width: 240px;
    }
    
    /* Activity Grid */
    .activity-grid {
        grid-template-columns: 1fr;
    }
    
    /* Order Info Grid */
    .order-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Activity Grid */
    .activity-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Activity Grid */
    .activity-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================================
   PRINT STYLES
   ========================================================================= */
@media print {
    /* Hide non-essential elements */
    .site-header,
    .site-footer,
    .dashboard-sidebar,
    .admin-sidebar,
    .sidebar-toggle,
    .btn,
    .alert,
    .filters-section,
    .status-tabs,
    .filter-tabs,
    .pagination {
        display: none !important;
    }
    
    /* Adjust layout */
    .dashboard-container,
    .admin-container {
        display: block;
    }
    
    .dashboard-main,
    .admin-main {
        padding: 0;
        max-width: 100%;
    }
    
    /* Optimize for print */
    body {
        background-color: white;
        color: black;
    }
    
    .card,
    .table-container,
    .info-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    /* Links */
    a {
        color: black;
        text-decoration: underline;
    }
    
    /* Tables */
    table {
        page-break-inside: avoid;
    }
    
    th {
        background-color: #f5f5f5 !important;
    }
}

/* ============================================================================
   LANDSCAPE ORIENTATION
   ========================================================================= */
@media (orientation: landscape) and (max-width: 767.98px) {
    .dashboard-sidebar,
    .admin-sidebar {
        width: 200px;
    }
}

/* ============================================================================
   HIGH DPI DISPLAYS
   ========================================================================= */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ============================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   DARK MODE SUPPORT (Optional)
   ========================================================================= */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support */
    /*
    :root {
        --gray-100: #212529;
        --gray-200: #343a40;
        --gray-300: #495057;
        --gray-900: #f8f9fa;
    }
    
    body {
        background-color: var(--gray-100);
        color: var(--gray-900);
    }
    */
}

/* ============================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================= */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .form-control,
    .sidebar-nav a,
    .status-tab,
    .filter-tab {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .sidebar-nav a:hover,
    .status-tab:hover,
    .filter-tab:hover {
        transform: none;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ========================================================================= */
@media (prefers-contrast: high) {
    /* Increase contrast for better accessibility */
    :root {
        --border-color: #000;
    }
    
    .btn-outline {
        border-width: 2px;
    }
}

/* ============================================================================
   UTILITY RESPONSIVE CLASSES
   ========================================================================= */

/* Hide on mobile */
@media (max-width: 767.98px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 992px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Show only on mobile */
@media (min-width: 768px) {
    .show-mobile-only {
        display: none !important;
    }
}

/* Show only on tablet */
@media (max-width: 767.98px), (min-width: 992px) {
    .show-tablet-only {
        display: none !important;
    }
}

/* Show only on desktop */
@media (max-width: 991.98px) {
    .show-desktop-only {
        display: none !important;
    }
}