/**
 * STREAMLINE DASHBOARD - COMPLETE RESPONSIVE SYSTEM FOR ALL RESOURCES
 * Comprehensive responsive styles for ALL views, components, and pages
 * Mobile-first approach: 300px → Desktop
 */

/* ============================================
   GLOBAL RESPONSIVE UTILITIES
   ============================================ */

/* Prevent horizontal overflow everywhere */
* {
    max-width: 100%;
    box-sizing: border-box !important;
}

html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

img {
    max-width: 100% !important;
    height: auto !important;
}

/* ============================================
   MOBILE STYLES (< 768px) - ALL PAGES
   ============================================ */
@media (max-width: 768px) {

    /* === GENERAL CONTAINERS === */
    .container,
    .content-container,
    .page-container,
    .section-container,
    .wrapper {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* === GRIDS - All patterns === */
    .grid,
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6,
    [class*="grid-cols-"],
    .stats-grid,
    .analytics-grid,
    .bonus-grid,
    .rewards-grid,
    .users-grid,
    .servers-grid,
    .panels-grid,
    .campaigns-grid,
    .notifications-grid,
    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* === FLEXBOX - Stack vertically === */
    .flex-row,
    .flex-between,
    .flex-center,
    .flex-space-between,
    [class*="flex-"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    /* === CARDS === */
    .card,
    .stats-card,
    .analytics-card,
    .bonus-card,
    .reward-card,
    .user-card,
    .server-card,
    .panel-card,
    .campaign-card,
    .notification-card,
    .metric-card,
    .info-card,
    .dashboard-card {
        width: 100% !important;
        margin-bottom: 1rem !important;
        padding: 1rem !important;
        border-radius: 12px !important;
    }

    .card-header,
    .card-title,
    .card-body,
    .card-footer {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    /* === TABLES === */
    .table-wrapper,
    .table-container,
    .data-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        margin: 0 !important;
    }

    table {
        min-width: 600px !important;
        font-size: 0.75rem !important;
        width: 100% !important;
    }

    table th,
    table td {
        padding: 0.5rem !important;
        white-space: nowrap !important;
        font-size: 0.75rem !important;
    }

    table thead th {
        position: sticky !important;
        top: 0 !important;
        background: var(--color-panel, #111418) !important;
        z-index: 10 !important;
    }

    /* === FORMS === */
    .form-group,
    .input-group,
    .form-row {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }

    .form-row {
        flex-direction: column !important;
    }

    input,
    select,
    textarea,
    .form-input,
    .form-select,
    .form-textarea {
        width: 100% !important;
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 0.75rem !important;
        min-height: 44px !important;
        border-radius: 8px !important;
    }

    label {
        display: block !important;
        margin-bottom: 0.5rem !important;
        font-size: 0.875rem !important;
    }

    /* === BUTTONS === */
    button,
    .btn,
    .button,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-warning,
    .btn-info,
    .action-btn,
    .submit-btn {
        width: 100% !important;
        padding: 0.875rem 1rem !important;
        font-size: 0.875rem !important;
        min-height: 44px !important;
        border-radius: 8px !important;
        margin-bottom: 0.5rem !important;
    }

    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
    }

    .btn-group button,
    .btn-group .btn {
        width: 100% !important;
        border-radius: 8px !important;
        margin-bottom: 0.5rem !important;
    }

    /* === ADMIN SPECIFIC === */
    .admin-panel,
    .admin-section,
    .admin-content {
        padding: 1rem !important;
    }

    .admin-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .admin-actions {
        width: 100% !important;
        flex-direction: column !important;
    }

    /* === ANALYTICS === */
    .analytics-chart,
    .chart-container,
    canvas {
        max-height: 250px !important;
        width: 100% !important;
    }

    .analytics-filters {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* === BONUS SYSTEM === */
    .bonus-tiers,
    .bonus-events,
    .bonus-config {
        grid-template-columns: 1fr !important;
    }

    .tier-card,
    .event-card {
        padding: 1rem !important;
    }

    /* === REWARDS === */
    .rewards-list,
    .reward-items {
        grid-template-columns: 1fr !important;
    }

    .reward-item {
        padding: 1rem !important;
    }

    /* === USERS MANAGEMENT === */
    .users-table {
        overflow-x: auto !important;
    }

    .user-actions {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .user-filters {
        flex-direction: column !important;
    }

    /* === SERVERS === */
    .servers-list {
        grid-template-columns: 1fr !important;
    }

    .server-status {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* === PANELS === */
    .panels-grid {
        grid-template-columns: 1fr !important;
    }

    .panel-editor {
        flex-direction: column !important;
    }

    .panel-preview {
        width: 100% !important;
        max-height: 400px !important;
        overflow-y: auto !important;
    }

    /* === CAMPAIGNS === */
    .campaigns-list {
        grid-template-columns: 1fr !important;
    }

    .campaign-metrics {
        flex-direction: column !important;
    }

    /* === NOTIFICATIONS === */
    .notifications-list {
        width: 100% !important;
    }

    .notification-item {
        padding: 0.875rem !important;
        font-size: 0.875rem !important;
    }

    /* === SETTINGS === */
    .settings-section {
        padding: 1rem !important;
    }

    .settings-row {
        flex-direction: column !important;
    }

    .setting-label {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }

    .setting-input {
        width: 100% !important;
    }

    /* === MONITORING / SYSTEM === */
    .system-metrics {
        grid-template-columns: 1fr !important;
    }

    .metric-value {
        font-size: 1.5rem !important;
    }

    .system-health {
        grid-template-columns: 1fr !important;
    }

    /* === LEADERBOARD === */
    .leaderboard-table {
        overflow-x: auto !important;
    }

    .leaderboard-rank {
        padding: 0.75rem !important;
    }

    /* === API MANAGER === */
    .api-endpoints {
        grid-template-columns: 1fr !important;
    }

    .endpoint-card {
        padding: 1rem !important;
    }

    /* === TUTORIALS === */
    .tutorials-grid {
        grid-template-columns: 1fr !important;
    }

    .tutorial-card {
        padding: 1rem !important;
    }

    /* === MODALS === */
    .modal,
    .modal-content,
    .modal-dialog {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem auto !important;
        padding: 1rem !important;
    }

    .modal-header,
    .modal-footer {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* === DROPDOWNS === */
    .dropdown-menu {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 70vh !important;
        border-radius: 16px 16px 0 0 !important;
        overflow-y: auto !important;
    }

    /* === BADGES & TAGS === */
    .badge,
    .tag,
    .status-badge {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* === PAGINATION === */
    .pagination {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }

    .pagination-item,
    .page-link {
        min-width: 40px !important;
        min-height: 40px !important;
    }

    /* === BREADCRUMBS === */
    .breadcrumb {
        flex-wrap: wrap !important;
        font-size: 0.75rem !important;
    }

    /* === TABS === */
    .tabs,
    .tab-list {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .tab {
        flex-shrink: 0 !important;
        min-width: auto !important;
        padding: 0.75rem 1rem !important;
    }

    /* === ALERTS === */
    .alert {
        padding: 1rem !important;
        font-size: 0.875rem !important;
        border-radius: 8px !important;
    }

    /* === PROGRESS BARS === */
    .progress {
        height: 8px !important;
        border-radius: 4px !important;
    }

    /* === TOOLTIPS === */
    .tooltip {
        font-size: 0.75rem !important;
        max-width: 200px !important;
    }

    /* === AVATARS === */
    .avatar {
        width: 40px !important;
        height: 40px !important;
    }

    .avatar-large {
        width: 60px !important;
        height: 60px !important;
    }

    /* === SEARCH BARS === */
    .search-bar,
    .search-input {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }

    /* === FILTERS === */
    .filters,
    .filter-group {
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    .filter-item {
        width: 100% !important;
    }

    /* === SIDEBAR CONTENT (not main sidebar) === */
    .content-sidebar,
    .info-sidebar {
        position: relative !important;
        width: 100% !important;
        margin-top: 1rem !important;
    }

    /* === TWO COLUMN LAYOUTS === */
    .two-column,
    .split-view,
    .dual-pane {
        flex-direction: column !important;
    }

    .column-left,
    .column-right,
    .pane-left,
    .pane-right {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* === DRAG & DROP === */
    .sortable-list,
    .draggable-item {
        touch-action: none !important;
    }

    /* === CODE BLOCKS === */
    pre,
    code {
        overflow-x: auto !important;
        font-size: 0.75rem !important;
        padding: 0.75rem !important;
    }

    /* === VIDEO/IFRAME === */
    iframe,
    video {
        max-width: 100% !important;
        height: auto !important;
    }

    .video-container {
        position: relative !important;
        padding-bottom: 56.25% !important; /* 16:9 */
        height: 0 !important;
        overflow: hidden !important;
    }

    .video-container iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* === LISTS === */
    .list-group-item {
        padding: 0.875rem !important;
    }

    /* === HEADER ACTIONS === */
    .header-actions,
    .page-actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }

    /* === STAT BLOCKS === */
    .stat-block {
        padding: 1rem !important;
    }

    .stat-value {
        font-size: 1.75rem !important;
    }

    .stat-label {
        font-size: 0.875rem !important;
    }

    /* === EMPTY STATES === */
    .empty-state {
        padding: 2rem 1rem !important;
        text-align: center !important;
    }

    /* === LOADING STATES === */
    .loading-overlay {
        padding: 2rem 1rem !important;
    }

    /* === CALENDAR/DATEPICKER === */
    .calendar,
    .datepicker {
        width: 100% !important;
        font-size: 0.875rem !important;
    }

    /* === HIDE ON MOBILE === */
    .hide-mobile,
    .desktop-only {
        display: none !important;
    }

    /* === SHOW ON MOBILE === */
    .show-mobile,
    .mobile-only {
        display: block !important;
    }
}

/* ============================================
   EXTRA SMALL (< 480px)
   ============================================ */
@media (max-width: 480px) {
    .container,
    .content-container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .card {
        padding: 0.75rem !important;
    }

    table {
        font-size: 0.7rem !important;
    }

    table th,
    table td {
        padding: 0.375rem !important;
    }

    button,
    .btn {
        padding: 0.75rem !important;
        font-size: 0.8125rem !important;
    }

    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    h3 {
        font-size: 1.125rem !important;
    }
}

/* ============================================
   ULTRA SMALL (< 375px)
   ============================================ */
@media (max-width: 375px) {
    .container,
    .content-container,
    .card,
    .admin-panel {
        padding: 0.5rem !important;
    }

    table {
        min-width: 500px !important;
        font-size: 0.65rem !important;
    }

    table th,
    table td {
        padding: 0.25rem !important;
    }

    button,
    .btn {
        padding: 0.625rem 0.75rem !important;
    }

    input,
    select,
    textarea {
        padding: 0.625rem !important;
    }

    .modal-content {
        width: 98% !important;
        padding: 0.75rem !important;
    }
}

/* ============================================
   MINIMUM SUPPORT (300px - 320px)
   ============================================ */
@media (max-width: 320px) {
    html {
        font-size: 14px !important;
    }

    .container,
    .content-container {
        padding: 0.375rem !important;
    }

    .card {
        padding: 0.375rem !important;
        margin-bottom: 0.5rem !important;
    }

    button,
    .btn {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }

    table {
        font-size: 0.625rem !important;
    }

    h1 {
        font-size: 1.25rem !important;
    }

    h2 {
        font-size: 1.125rem !important;
    }

    h3 {
        font-size: 1rem !important;
    }
}

/* ============================================
   TABLET (768px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6,
    .stats-grid,
    .analytics-grid,
    .bonus-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .container,
    .content-container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .navbar,
    .burger-menu,
    .btn,
    button,
    .action-btn,
    .filters {
        display: none !important;
    }

    .container,
    .content-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    table {
        font-size: 10pt !important;
    }
}
