/**
 * Responsive CSS for AI Command Center
 * Mobile, Tablet, and Desktop Compatibility
 */

/* Mobile First - Base Styles */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Touch-friendly buttons */
button, .btn, a.btn, input[type="submit"], .panel-link, .channel-btn, .worker-item {
    min-height: 44px; /* iOS recommended touch target */
    min-width: 44px;
    touch-action: manipulation;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

/* Mobile Styles (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* Typography */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 24px !important;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    h3 {
        font-size: 18px !important;
    }
    
    /* Containers */
    .container {
        padding: 10px !important;
        max-width: 100% !important;
    }
    
    /* Headers */
    .header {
        padding: 15px 20px !important;
        margin-bottom: 15px !important;
    }
    
    .header h1 {
        font-size: 20px !important;
        letter-spacing: 1px !important;
    }
    
    /* Grids - Stack on mobile */
    .config-grid,
    .stats-grid,
    .panel-grid,
    .link-grid,
    .overview-stats {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    /* Two-column layouts become single column */
    .video-interface,
    .two-column,
    .split-layout {
        grid-template-columns: 1fr !important;
    }
    
    /* Panels */
    .panel,
    .section,
    .config-card,
    .stat-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    /* Buttons */
    .btn,
    button.btn {
        padding: 12px 20px !important;
        font-size: 14px !important;
        width: 100% !important;
        margin-bottom: 10px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 15px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        box-sizing: border-box;
    }
    
    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Navigation */
    .nav-menu,
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: #0a0a1a;
        z-index: 1000;
        transition: left 0.3s;
        overflow-y: auto;
    }
    
    .nav-menu.open,
    .sidebar.open {
        left: 0;
    }
    
    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1001;
        background: rgba(0, 100, 200, 0.9);
        border: 2px solid #00ffff;
        border-radius: 8px;
        padding: 10px;
        color: #00ffff;
        font-size: 20px;
    }
    
    /* Video Interface */
    .video-container {
        aspect-ratio: 16/9;
        width: 100%;
    }
    
    .video-interface {
        grid-template-columns: 1fr !important;
    }
    
    .worker-list-panel {
        max-height: 300px;
        margin-bottom: 15px;
    }
    
    /* Channel Buttons */
    .channel-buttons {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .channel-btn {
        padding: 15px 10px !important;
        font-size: 12px !important;
    }
    
    /* Worker List */
    .worker-item {
        padding: 15px !important;
        font-size: 14px;
    }
    
    /* Cards */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Hide less important elements on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-specific elements */
    .mobile-only {
        display: block !important;
    }
    
    /* Spacing adjustments */
    .section {
        margin-bottom: 20px;
    }
    
    /* Text adjustments */
    small {
        font-size: 11px;
    }
    
    /* Badges */
    .badge,
    .link-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* Tablet Styles (768px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    /* Typography */
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 28px !important;
    }
    
    /* Containers */
    .container {
        padding: 15px;
        max-width: 100%;
    }
    
    /* Grids - 2 columns on tablet */
    .config-grid,
    .stats-grid,
    .panel-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    /* Video Interface - Stack on tablet */
    .video-interface {
        grid-template-columns: 1fr !important;
    }
    
    /* Channel Buttons - 3 columns */
    .channel-buttons {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Panels */
    .panel,
    .section {
        padding: 20px;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 24px;
    }
    
    /* Hide mobile menu toggle */
    .mobile-menu-toggle {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
    
    .mobile-only {
        display: none;
    }
}

/* Desktop Styles (min-width: 1025px) */
@media screen and (min-width: 1025px) {
    /* Full desktop layout */
    .container {
        max-width: 1800px;
        margin: 0 auto;
        padding: 20px;
    }
    
    /* Hide mobile menu toggle */
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .desktop-only {
        display: block;
    }
    
    .mobile-only {
        display: none;
    }
}

/* Landscape Mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .worker-list-panel {
        max-height: 200px;
    }
    
    .video-container {
        max-height: 60vh;
    }
}

/* Print Styles */
@media print {
    .btn,
    .mobile-menu-toggle,
    .controls,
    .video-container {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
    * {
        border-width: 2px !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    /* Already dark, but can add adjustments */
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    button:hover,
    .btn:hover,
    .panel-link:hover {
        /* Remove hover effects on touch */
        transform: none;
    }
    
    /* Larger touch targets */
    .worker-item,
    .panel-link,
    .channel-btn {
        min-height: 48px;
        padding: 12px;
    }
}

/* Very Small Screens (max-width: 480px) */
@media screen and (max-width: 480px) {
    .header h1 {
        font-size: 18px !important;
    }
    
    .channel-buttons {
        grid-template-columns: 1fr !important;
    }
    
    .config-grid,
    .stats-grid {
        gap: 8px !important;
    }
    
    .panel,
    .section {
        padding: 12px !important;
    }
}

