/* --- Global Styles & Variables --- */
:root {
    --primary-blue: #0d6efd;
    --sidebar-bg: #ffffff;
    --content-bg: #f3f6f9;
    --text-main: #2d3748;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--content-bg);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
}

/* --- Layout Structure --- */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar: Desktop 340px */
.sidebar {
    width: 340px;
    background: var(--sidebar-bg);
    position: fixed;
    height: 100vh;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

/* Main Content Area: Adjusted to match 340px sidebar */
.content-area {
    margin-left: 340px;
    width: calc(100% - 340px);
    padding: 2.5rem;
    min-height: 100vh;
}

/* --- Sidebar Navigation --- */
.sidebar-header {
    padding: 3rem 2rem;
    border-bottom: 1px solid #f8fafc;
}

.sidebar-header h4,
.sidebar-header h5 {
    letter-spacing: 1px;
    font-size: 1.5rem;
    margin: 0;
}

.sidebar-header small {
    display: block;
}

.sidebar-menu {
    padding-top: 1.5rem;
    flex: 1;
}

.nav-link {
    color: var(--text-muted);
    padding: 1.1rem 2rem;
    margin: 0.4rem 1.2rem;
    border-radius: 14px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-link i {
    font-size: 1.4rem;
    margin-right: 15px;
    flex-shrink: 0;
}

.nav-link span {
    display: inline;
}

.nav-link:hover,
.nav-link.active {
    background: #eff6ff;
    color: var(--primary-blue);
    transform: translateX(5px);
}

.sidebar-footer {
    padding: 1.5rem;
    margin-top: auto;
}

/* Mobile Menu Toggle Button (Hidden by default) */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1200;
    width: 45px;
    height: 45px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.3);
}

.mobile-menu-toggle i {
    font-size: 1.4rem;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* --- Content Components --- */
.top-bar {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: flex;
    flex-wrap: wrap;
}

.top-bar h4 {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-profile span {
    display: inline;
}

.avatar {
    width: 44px;
    height: 44px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #475569;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.glass-card {
    background: white;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease;
}

/* Unified Border Styling (5px top blue bar) */
.unified-border {
    border: 1px solid var(--border-color) !important;
    border-top: 5px solid var(--primary-blue) !important;
}

.unified-border:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* --- Shared Form Styling --- */
.form-control,
.form-select {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    width: 100%;
    max-width: 100%;
}

/* Year Picker Styling */
.year-picker {
    font-weight: 700;
    text-align: center;
    color: var(--primary-blue);
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
}

.border-dashed {
    border: 2px dashed #cbd5e1 !important;
    transition: all 0.3s ease;
}

.upload-zone {
    padding: 2rem;
}

.upload-zone:hover {
    border-color: var(--primary-blue) !important;
    background-color: #f8fbff !important;
}

/* --- Members Table Styling --- */
.table {
    width: 100%;
    overflow-x: auto;
}

.table-responsive {
    overflow-x: auto;
}

.table thead tr th {
    border: none;
    font-size: 0.75rem;
    padding: 1rem;
    white-space: nowrap;
}

.table tbody tr td {
    border-color: #f1f5f9;
    padding: 1.2rem 1rem;
}

/* --- Buttons & Text Accents --- */
.btn-primary {
    background-color: var(--primary-blue);
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    border-radius: 50px;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 50px;
}

.btn-outline-danger {
    border: 2px solid #dc2626;
    color: #dc2626;
}

.btn-outline-danger:hover {
    background: #dc2626;
    color: white;
}

/* Report Category Colors */
.text-warning {
    color: #f59e0b !important;
}

.text-success {
    color: #10b981 !important;
}

.text-info {
    color: #0ea5e9 !important;
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-success {
    background: #10b981;
    color: white;
    border: none;
}

.btn-info {
    background: #0ea5e9;
    color: white;
    border: none;
}

/* --- Uploaded Files Section Styles --- */
.uploaded-files-section {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

.uploaded-files-section h6 {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
}

.files-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    -webkit-overflow-scrolling: touch;
}

.admin-files-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.admin-files-table thead {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

.admin-files-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.admin-files-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 0.9rem;
}

.admin-files-table tbody tr:hover {
    background: #f8f9fa;
}

.admin-files-table tbody tr:last-child td {
    border-bottom: none;
}

.file-name-cell {
    font-weight: 500;
    color: #0d6efd;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size-cell {
    color: #666;
    font-size: 0.85rem;
}

.file-date-cell {
    color: #666;
    font-size: 0.85rem;
}

/* Action Buttons */
.file-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    align-items: center;
}

.btn-action-small {
    padding: 0.5rem 0.9rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-action-small:active {
    transform: scale(0.95);
}

.btn-view-small {
    background: #3b82f6;
    color: white;
}

.btn-view-small:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-download-small {
    background: #10b981;
    color: white;
}

.btn-download-small:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-delete-small {
    background: #ef4444;
    color: white;
}

.btn-delete-small:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* Search Inputs */
input[type="text"][id*="Search"],
input[type="text"][id*="search"] {
    max-width: 100%;
}

/* --- Animations --- */
.admin-section {
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Animation for Mobile Menu */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ========================================
   RESPONSIVE BREAKPOINTS (Mobile-First)
   ======================================== */

/* --- Large Tablets & Small Desktops (max-width: 1200px) --- */
@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }

    .content-area {
        margin-left: 280px;
        width: calc(100% - 280px);
        padding: 2rem;
    }

    .sidebar-header {
        padding: 2rem 1.5rem;
    }

    .nav-link {
        padding: 1rem 1.5rem;
        margin: 0.3rem 1rem;
    }
}

/* --- Tablets (max-width: 992px) --- */
@media (max-width: 992px) {
    .sidebar {
        width: 85px;
    }

    .sidebar-header h4,
    .sidebar-header h5,
    .sidebar-header small,
    .sidebar-header p,
    .nav-link span,
    .admin-profile span {
        display: none;
    }

    .sidebar-header {
        padding: 2rem 0.5rem;
        text-align: center;
    }

    .nav-link {
        justify-content: center;
        padding: 1rem;
        margin: 0.3rem 0.5rem;
    }

    .nav-link i {
        margin-right: 0;
        font-size: 1.5rem;
    }

    .sidebar-footer {
        padding: 1rem 0.5rem;
    }

    .sidebar-footer .btn {
        padding: 0.75rem;
        font-size: 0;
    }

    .sidebar-footer .btn i {
        font-size: 1.25rem;
    }

    .content-area {
        margin-left: 85px;
        width: calc(100% - 85px);
        padding: 1.5rem;
    }

    .top-bar {
        padding: 1.25rem !important;
    }

    .admin-files-table {
        font-size: 0.85rem;
    }

    .admin-files-table th,
    .admin-files-table td {
        padding: 0.75rem 0.5rem;
    }

    .btn-action-small {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
        white-space: nowrap;
    }

    .file-actions {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .report-box {
        margin-bottom: 1.5rem;
    }

    .col-md-4,
    .col-md-6,
    .col-xl-4 {
        width: 100%;
    }
}

/* --- Large Mobile Devices (max-width: 768px) --- */
@media (max-width: 768px) {
    /* HAMBURGER MENU TOGGLE BUTTON */
    .mobile-menu-toggle {
        display: flex;
    }

    /* MOBILE MENU OVERLAY */
    .mobile-menu-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-menu-overlay.active {
        pointer-events: all;
    }

    /* SLIDE-IN SIDEBAR DRAWER - WIDER FOR BETTER READABILITY */
    .sidebar {
        width: 320px;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1200;
        border-right: none;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        display: block;
        padding: 2.5rem 2rem;
        border-bottom: 1px solid #f8fafc;
    }

    .sidebar-header h4,
    .sidebar-header h5 {
        display: block;
        font-size: 1.4rem;
        letter-spacing: 0.5px;
    }

    .sidebar-header small {
        display: block;
        margin-top: 0.5rem;
        font-size: 0.85rem;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
        padding-top: 1.5rem;
    }

    .nav-link {
        flex-direction: row;
        padding: 1.15rem 2rem;
        margin: 0.35rem 1.2rem;
        border-radius: 12px;
        font-size: 1rem;
        text-align: left;
    }

    .nav-link i {
        margin-right: 16px;
        font-size: 1.4rem;
    }

    .nav-link span {
        display: inline;
        font-size: 0.95rem;
    }

    .sidebar-footer {
        display: block;
        padding: 1.5rem 2rem;
        margin-top: auto;
    }

    .sidebar-footer .btn {
        width: 100%;
        padding: 1rem;
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.6rem;
        font-weight: 600;
    }

    .sidebar-footer .btn i {
        font-size: 1.15rem;
        display: inline;
    }

    /* CONTENT ADJUSTMENTS */
    .content-area {
        margin-left: 0;
        margin-bottom: 0;
        width: 100%;
        padding: 1.25rem;
        padding-top: 5rem;
    }

    .top-bar {
        padding: 1rem !important;
    }

    .top-bar h4 {
        font-size: 1.15rem;
    }

    .admin-profile span {
        display: none;
    }

    .uploaded-files-section {
        padding: 1rem;
    }

    .admin-files-table {
        min-width: 600px;
    }

    .file-name-cell {
        max-width: 200px;
    }

    .glass-card {
        padding: 1.25rem !important;
        margin-bottom: 1.25rem;
    }

    .upload-zone {
        padding: 1.5rem !important;
    }

    /* Search inputs full width */
    input[type="text"][id*="Search"],
    input[type="text"][id*="search"] {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem;
    }

    /* Search container adjustments */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }

    .d-flex.justify-content-between > div[style*="width: 320px"] {
        width: 100% !important;
    }
}

/* --- Small Mobile Devices (max-width: 600px) --- */
@media (max-width: 600px) {
    .mobile-menu-toggle {
        width: 42px;
        height: 42px;
        top: 0.75rem;
        left: 0.75rem;
    }

    .mobile-menu-toggle i {
        font-size: 1.2rem;
    }

    .sidebar {
        width: 300px;
    }

    .sidebar-header {
        padding: 2rem 1.75rem;
    }

    .sidebar-header h4,
    .sidebar-header h5 {
        font-size: 1.3rem;
    }

    .nav-link {
        padding: 1.1rem 1.75rem;
        margin: 0.3rem 1rem;
        font-size: 0.95rem;
    }

    .nav-link i {
        margin-right: 14px;
        font-size: 1.3rem;
    }

    .sidebar-footer {
        padding: 1.25rem 1.75rem;
    }

    .sidebar-footer .btn {
        padding: 0.95rem;
        font-size: 0.9rem;
    }

    .content-area {
        padding: 1rem;
        padding-top: 4.5rem;
    }

    .top-bar h4 {
        font-size: 1rem;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }

    .glass-card {
        padding: 1rem !important;
        border-radius: 16px;
    }

    .btn-primary,
    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }

    .file-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-action-small {
        width: 100%;
        justify-content: center;
        padding: 0.6rem;
    }

    .admin-files-table {
        min-width: 500px;
        font-size: 0.8rem;
    }

    .admin-files-table th,
    .admin-files-table td {
        padding: 0.6rem 0.4rem;
    }

    .file-name-cell {
        max-width: 150px;
    }

    .uploaded-files-section {
        padding: 0.75rem;
        margin-top: 1.5rem;
    }

    .uploaded-files-section h6 {
        font-size: 0.9rem;
    }

    .report-box {
        padding: 1rem !important;
    }

    .year-picker {
        font-size: 1rem;
    }

    h5, h6 {
        font-size: clamp(0.95rem, 3vw, 1.25rem);
    }

    .input-group {
        flex-wrap: wrap;
    }
}

/* --- Extra Small Mobile (max-width: 400px) --- */
@media (max-width: 400px) {
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }

    .sidebar {
        width: 280px;
    }

    .sidebar-header {
        padding: 1.75rem 1.5rem;
    }

    .sidebar-header h4,
    .sidebar-header h5 {
        font-size: 1.2rem;
    }

    .nav-link {
        padding: 1rem 1.5rem;
        margin: 0.25rem 0.85rem;
        font-size: 0.9rem;
    }

    .nav-link i {
        margin-right: 12px;
        font-size: 1.25rem;
    }

    .sidebar-footer {
        padding: 1rem 1.5rem;
    }

    .sidebar-footer .btn {
        padding: 0.85rem;
        font-size: 0.85rem;
    }

    .content-area {
        padding: 0.75rem;
        padding-top: 4.25rem;
    }

    .top-bar {
        padding: 0.75rem !important;
    }

    .glass-card {
        padding: 0.75rem !important;
    }

    .btn-action-small {
        font-size: 0.7rem;
        padding: 0.5rem;
    }

    .admin-files-table {
        min-width: 450px;
        font-size: 0.75rem;
    }

    .file-name-cell {
        max-width: 120px;
    }
}

/* --- Landscape Mode Fixes --- */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }

    .sidebar-header {
        padding: 1.5rem 2rem;
    }

    .nav-link {
        padding: 0.9rem 2rem;
    }
}

/* --- Print Styles --- */
@media print {
    .sidebar,
    .top-bar,
    .btn,
    .file-actions,
    .mobile-menu-toggle,
    .mobile-menu-overlay {
        display: none !important;
    }

    .content-area {
        margin-left: 0;
        width: 100%;
        padding: 0;
        padding-top: 0;
    }
}
