/* Responsive adjustments for Admin Dashboard across all screen sizes */

/* Desktop styles fine-tuning */
.sidebar {
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.admin-menu-toggle {
    display: none;
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.admin-menu-toggle:hover {
    background: #e2e8f0;
    color: #dc2626;
}

.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s;
}

.sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.6);
}

/* Ensure tables are scrollable horizontally without overflowing screen */
.table-container, .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

table {
    min-width: 600px;
}

/* Mobile & Tablet Styles (<= 992px) */
@media (max-width: 992px) {
    .sidebar {
        right: -290px !important;
        box-shadow: none;
    }

    .sidebar.open {
        right: 0 !important;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5) !important;
    }

    .sidebar-close-btn {
        display: flex !important;
    }

    .main-content {
        margin-right: 0 !important;
        padding: 1rem !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .admin-menu-toggle {
        display: inline-flex !important;
    }

    .top-bar {
        padding: 0.85rem 1rem !important;
        margin-bottom: 1.25rem !important;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

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

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
        gap: 1rem !important;
    }

    .modal-content {
        width: 94% !important;
        max-width: 94% !important;
        margin: 5% auto !important;
        padding: 1.25rem !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .filter-bar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .filter-select, .search-box {
        width: 100% !important;
    }

    .upload-area {
        padding: 0.75rem !important;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .top-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .user-info {
        gap: 0.5rem !important;
        font-size: 0.85rem;
    }

    .user-info span {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .btn-add {
        width: 100%;
        text-align: center;
        margin-bottom: 0.75rem;
    }
}
