@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #f97316; /* Freshmarket Orange */
    --primary-light: #fff7ed;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 240px;
}

[data-bs-theme="dark"] {
    --primary: #fb923c;
    --primary-light: #431407;
    --secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem; /* Reduced base font size */
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    width: var(--sidebar-width);
    border-right: 1px solid var(--border);
    padding: 0.75rem;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.sidebar-brand {
    padding: 1rem 0.75rem 2rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary);
    flex-shrink: 0;
}

.nav-link {
    color: var(--secondary);
    padding: 0.6rem 0.875rem; /* Reduced padding */
    font-weight: 600;
    font-size: 0.8rem; /* Reduced font size */
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
    transition: all 0.2s;
}

.nav-link i { font-size: 1rem; }
.nav-link:hover, .nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
    transform: translateX(4px);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem; /* Reduced padding */
    min-height: 100vh;
    transition: all 0.3s ease;
}

@media (min-width: 1400px) {
    .main-content {
        padding: 2rem 5rem; /* Add more horizontal padding on very wide screens to prevent "zoom" look */
    }
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }

    #sidebarBackdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    #sidebarBackdrop.show {
        display: block;
    }
}

/* Page Titles */
.page-title {
    font-weight: 800;
    font-size: 1.25rem; /* Reduced font size */
    letter-spacing: -0.02em;
    color: var(--text-main);
}

/* Stats */
.stat-card {
    padding: 1.25rem; /* Reduced padding */
    background-color: var(--card-bg);
    border-radius: 16px; /* Reduced border radius */
    border: 1px solid var(--border);
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; display: block; }
.stat-value { font-size: 1.25rem; font-weight: 800; margin-bottom: 0; }

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.table thead th {
    padding: 0.75rem 1.25rem; /* Reduced padding */
    font-size: 0.65rem;
    font-weight: 700;
    background-color: var(--bg-main);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.table tbody td {
    padding: 0.75rem 1.25rem; /* Reduced padding */
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
}

/* Forms */
.form-control, .form-select {
    padding: 0.5rem 0.875rem; /* Reduced padding */
    font-size: 0.8rem;
    border-radius: 10px;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    background-color: var(--card-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.btn {
    padding: 0.5rem 1rem; /* Reduced padding */
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: #ea580c;
    border-color: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.btn-white {
    background-color: white;
    border-color: var(--border);
    color: var(--text-main);
}

/* Custom Utilities */
.fw-900 { font-weight: 900; }
.x-small { font-size: 0.7rem; }
.rounded-4 { border-radius: 1rem !important; }

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
.pulse { animation: pulse 2s infinite ease-in-out; }

/* Modal Customization */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
}

.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
