/**
 * Islamic Cooperative Society - Main Stylesheet
 */

:root {
    --primary-color: #1e7e34;
    --secondary-color: #155724;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

body.has-sidebar {
    display: block;
}

/* Main Content Wrapper */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - 70px);
    margin-top: 70px;
    width: 100%;
}

.container {
    flex: 1;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

@media (min-width: 769px) {
    .container {
        margin-left: 250px;
        max-width: calc(100% - 250px);
        width: calc(100% - 250px);
    }
    
    body.sidebar-closed .container {
        margin-left: 0;
        max-width: 100%;
        width: 100%;
    }
    
    body.sidebar-closed .sidebar {
        left: -250px;
    }
}

/* Header */
.main-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.header-container {
    max-width: 100%;
    margin: 0;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.sidebar-toggle span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s;
}

.sidebar-toggle:hover span {
    background: rgba(255, 255, 255, 0.8);
}

.logo h2,
.logo img {
    font-size: 1.5rem;
    margin: 0;
    max-height: 60px;
    max-width: 100%;
    object-fit: contain;
}

.logo img {
    height: auto;
    width: auto;
}

.sidebar-header h3,
.sidebar-header img {
    font-size: 1.2rem;
    margin: 0;
    max-height: 50px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-header img {
    height: auto;
    width: auto;
}

.login-header h1,
.login-header img {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    max-height: 80px;
    max-width: 100%;
    object-fit: contain;
}

.login-header img {
    height: auto;
    width: auto;
}

.statement-header h1,
.statement-header img {
    font-size: 1.8rem;
    margin: 0 0 0.5rem 0;
    max-height: 70px;
    max-width: 100%;
    object-fit: contain;
}

.statement-header img {
    height: auto;
    width: auto;
}

.main-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Only show hamburger toggle when sidebar is present */
body:not(.has-sidebar) .sidebar-toggle {
    display: none !important;
}

/* Ensure logo and user menu stay visible */
body.has-sidebar .main-nav {
    gap: 0.75rem;
}

body.has-sidebar .notification-link {
    padding: 0.5rem 0.75rem;
}

.notification-icon {
    font-size: 1.25rem;
}

.header-notification {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
}

.notification-link {
    position: relative;
}

.badge {
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    display: inline-block;
    min-width: 1.2rem;
    text-align: center;
    white-space: nowrap;
}

/* Table badges should be rectangular, not circular */
.table .badge {
    border-radius: 12px !important;
    padding: 0.25rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 500;
    min-width: auto;
    margin-left: 0;
}

/* Footer */
.main-footer {
    background-color: var(--dark-text);
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

.text-muted {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Forms */
.form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 20px auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: var(--warning-color);
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info h3 {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin: 0;
}

.stat-info p {
    color: #6c757d;
    margin: 0.25rem 0 0 0;
}

/* Tables - Full width with sticky horizontal scrollbar */
.table-responsive {
    overflow-x: scroll !important;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    position: relative;
    max-height: calc(100vh - 350px);
    width: 100%;
}

/* Custom scrollbar styling - always visible horizontal scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Table wrapper for enhanced sticky scrollbar (optional, for pages that need it) */
.table-wrapper {
    position: relative;
    max-height: calc(100vh - 400px);
    overflow-y: auto;
    overflow-x: scroll !important;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
}

.table-wrapper::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: var(--primary-color);
    color: white;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table .badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #212529;
}

.badge-error {
    background-color: var(--danger-color);
    color: white;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    color: var(--primary-color);
}

.quick-actions {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.quick-actions h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.dashboard-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Details Card */
.details-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.details-card h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.detail-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    font-weight: 600;
    color: #6c757d;
    display: block;
    margin-bottom: 0.5rem;
}

.detail-item span {
    display: block;
    color: var(--dark-text);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.filter-tabs a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    color: var(--dark-text);
    background-color: white;
    border: 1px solid var(--border-color);
}

.filter-tabs a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Notifications */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.notification-item.unread {
    border-left: 4px solid var(--primary-color);
}

.notification-item.read {
    opacity: 0.8;
}

.notification-icon {
    font-size: 2rem;
}

.notification-content {
    flex: 1;
}

.notification-content h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.notification-content p {
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

/* Settings */
.settings-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.settings-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* Reports */
.reports-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.reports-tabs a {
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--dark-text);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.reports-tabs a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.report-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.report-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--dark-text);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-error {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Print Styles - Hide sidebar, header, filters when printing */
@media print {
    .sidebar,
    .main-header,
    .page-header,
    .report-filters,
    .report-tabs,
    .export-buttons,
    .filter-grid,
    .btn,
    button,
    .alert,
    .quick-actions,
    .action-buttons {
        display: none !important;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .report-content,
    .dashboard-section:last-of-type,
    .ledger-summary {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 1rem !important;
        margin: 0 !important;
    }
    
    .report-table,
    .trial-balance-table,
    .summary-table {
        page-break-inside: auto;
    }
    
    .report-table tr,
    .trial-balance-table tr,
    .summary-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .report-table thead,
    .trial-balance-table thead,
    .summary-table thead {
        display: table-header-group;
    }
    
    .report-table tfoot,
    .trial-balance-table tfoot,
    .summary-table tfoot {
        display: table-footer-group;
    }
}

/* Responsive - Mobile First Approach */
@media (max-width: 768px) {
    /* Container and Layout */
    .container {
        padding: 10px;
    }
    
    .main-wrapper {
        margin-top: 60px;
    }
    
    /* Header - Compact */
    .main-header {
        padding: 0.75rem 0;
    }
    
    .header-container {
        padding: 0 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .header-left {
        gap: 0.5rem;
    }
    
    .logo h2,
    .logo img {
        font-size: 1.2rem;
        max-height: 40px;
    }
    
    .main-nav {
        width: auto;
        gap: 0.5rem;
        font-size: 0.875rem;
    }
    
    .main-nav a {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Dashboard Header */
    .dashboard-header {
        margin-bottom: 1rem;
    }
    
    .dashboard-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .dashboard-header p {
        font-size: 0.9rem;
    }
    
    /* Stats Grid - Stack on Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
    
    .stat-info p {
        font-size: 0.875rem;
    }
    
    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
        gap: 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    /* Quick Actions */
    .quick-actions {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .quick-actions h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .action-buttons .btn {
        width: 100%;
        padding: 0.75rem 1rem;
    }
    
    /* Dashboard Sections */
    .dashboard-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .dashboard-section h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    /* Tables - Compact and Scrollable */
    .table-responsive {
        max-height: calc(100vh - 300px);
        padding: 0;
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
        min-width: 600px; /* Ensure horizontal scroll for wide tables */
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
    }
    
    .table th {
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    /* Details Card */
    .details-card {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .details-card h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .detail-item {
        padding: 0.75rem 0;
    }
    
    /* Forms - Stack on Mobile */
    .form-container {
        padding: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .form-group small {
        font-size: 0.75rem;
    }
    
    /* Form Grid - Stack */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Buttons - Full Width on Mobile */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        width: 100%;
        text-align: center;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Button Groups - Stack */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin: 0;
        border-radius: 4px;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Filter Tabs - Scrollable */
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-tabs a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Reports Tabs - Scrollable */
    .reports-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .reports-tabs a {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Report Filters - Stack */
    .report-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .report-filters .form-group {
        width: 100%;
    }
    
    /* Modals - Mobile Friendly */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    /* Notifications */
    .notification-item {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .notification-icon {
        font-size: 1.5rem;
    }
    
    .notification-content h3 {
        font-size: 1rem;
    }
    
    .notification-content p {
        font-size: 0.875rem;
    }
    
    /* Settings Sections */
    .settings-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .settings-section h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    /* Tabs Container - Scrollable */
    .tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tabs {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        min-width: max-content;
    }
    
    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Footer - Compact */
    .main-footer {
        padding: 1rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .footer-container {
        padding: 0 10px;
    }
    
    .footer-container p {
        margin-bottom: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Badges - Smaller */
    .badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Text Utilities */
    .text-muted {
        font-size: 0.8rem;
    }
    
    /* Sidebar - Already handled but ensure it's compact */
    .sidebar {
        width: 100%;
        max-width: 280px;
    }
    
    .sidebar-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .sidebar-icon {
        font-size: 1.1rem;
        width: 20px;
    }
    
    /* Search Forms - Stack */
    form[style*="display: flex"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    form[style*="display: flex"] .form-group {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
    
    form[style*="display: flex"] .btn {
        width: 100% !important;
    }
}

/* Tablet Responsive (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table th,
    .table td {
        padding: 0.75rem;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
    
    .action-buttons .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 150px;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .dashboard-header h1 {
        font-size: 1.25rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-icon {
        font-size: 1.75rem;
    }
    
    .stat-info h3 {
        font-size: 1.25rem;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.5rem;
    }
    
    .btn {
        padding: 0.65rem 0.85rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 98%;
        padding: 1rem;
    }
    
    .main-footer {
        font-size: 0.75rem;
        padding: 0.75rem 0.5rem;
    }
    
    /* Compact header on very small screens */
    .main-header {
        padding: 0.5rem 0;
    }
    
    .logo h2,
    .logo img {
        font-size: 1rem;
        max-height: 35px;
    }
    
    .main-nav a {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Even more compact forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.65rem;
        font-size: 0.8rem;
    }
    
    /* Compact cards */
    .details-card,
    .dashboard-section,
    .quick-actions,
    .settings-section {
        padding: 0.75rem;
    }
}

/* Ensure all inline flex forms stack on mobile */
@media (max-width: 768px) {
    form[style*="flex"] .form-group[style*="flex"] {
        flex: 1 1 100% !important;
        width: 100% !important;
    }
    
    /* Make sure search forms stack */
    form[style*="display: flex"][style*="align-items"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    /* Ensure table action buttons wrap */
    .table td .btn-group,
    .table td .btn {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .table td .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-page h1 {
    font-size: 6rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-page h2 {
    color: var(--dark-text);
    margin-bottom: 1rem;
}

.error-page p {
    color: #6c757d;
    margin-bottom: 2rem;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 70px;
    left: -250px;
    width: 250px;
    height: calc(100vh - 70px);
    background: white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    margin: 0;
}

.sidebar-toggle-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.sidebar-toggle-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
    padding: 0;
}

.user-profile {
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: var(--dark-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: capitalize;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--dark-text);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    gap: 0.75rem;
}

.sidebar-item:hover {
    background-color: #f8f9fa;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-item.active {
    background-color: rgba(30, 126, 52, 0.1);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-text {
    flex: 1;
}

.sidebar-badge {
    background: var(--danger-color);
    color: white;
    border-radius: 12px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-item-logout {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    color: var(--danger-color);
}

.sidebar-item-logout:hover {
    background-color: rgba(220, 53, 69, 0.1);
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* On desktop, overlay should never show or block */
@media (min-width: 769px) {
    .sidebar-overlay {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .sidebar-overlay.show {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

@media (min-width: 769px) {
    .sidebar {
        left: 0;
    }
    
    .container {
        margin-left: 250px;
        max-width: calc(1400px - 250px);
    }
    
    body.sidebar-closed .sidebar {
        left: -250px;
    }
    
    body.sidebar-closed .container {
        margin-left: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .sidebar-toggle-close {
        display: none;
    }
}

