/* ==========================================
   1. GLOBAL REBOOT & DESIGN SYSTEM VARIABLES
   ========================================== */
:root {
    --primary-green: #2d5a27;
    --hover-green: #1e3f19;
    --accent-sage: #8fbc8f;
    --background-cream: #fdfbf7;
    --card-white: #ffffff;
    --text-dark: #2f3e2f;
    --text-muted: #617d5c;
    --border-color: #d2ebd2;
    --sidebar-width: 260px;
    --navbar-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background-cream);
    color: var(--text-dark);
    line-height: 1.6;
    padding-top: var(--navbar-height);
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   2. TOP BAR COMPONENT (ALWAYS ON TOP)
   ========================================== */
.top-navbar {
    background: linear-gradient(135deg, var(--primary-green), #1b3d17);
    color: white;
    height: var(--navbar-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.top-brand {
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.top-brand span { font-weight: 300; opacity: 0.8; }

.menu-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.menu-toggle-btn:hover, .menu-toggle-btn:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

/* ==========================================
   3. RESPONSIVE SIDEBAR / DRAWER SYSTEM
   ========================================== */
.sidebar {
    background-color: #1b3d17;
    color: white;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    position: fixed;
    top: var(--navbar-height);
    left: calc(-1 * var(--sidebar-width));
    z-index: 999;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0,0,0,0.15);
}

.sidebar.active { left: 0; }

.sidebar-brand-wrapper h2 {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    color: var(--accent-sage);
}

.sidebar-menu { display: flex; flex-direction: column; gap: 8px; list-style: none; }

.sidebar-menu a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.01);
    transition: all 0.2s ease;
    display: block;
}

.sidebar-menu a:hover, .sidebar-menu a:active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding-left: 22px;
}

.sidebar-menu a[href="manage_users.php"] {
    background: #ffeb3b !important;
    color: #2d5a27 !important;
    margin-top: 15px;
}
.sidebar-menu a[href="logout.php"] {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    opacity: 0.7;
}

.sidebar-overlay {
    position: fixed;
    top: var(--navbar-height);
    left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ==========================================
   4. PREMIUM INPUT FORMS & BUTTON DESIGN
   ========================================== */
.card {
    background: var(--card-white);
    border-radius: 16px; /* Elegant presentation curves */
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 16px rgba(45, 90, 39, 0.04);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* Unified Web Application Input System */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 14px 16px; /* Enhanced vertical hitboxes for clean typography */
    border: 1px solid #c2dec2;
    border-radius: 10px; /* Modern UI rounding bounds */
    font-size: 1rem; /* Stabilizes scaling on iOS Safari frames */
    background-color: #fafdfa;
    color: var(--text-dark);
    font-family: inherit;
    transition: all 0.2s ease;
    -webkit-appearance: none; /* Disables raw browser default styles */
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(45, 90, 39, 0.1); /* Soft glow indication rings */
}

/* Premium Button Architecture */
button, input[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-green), #20441b);
    color: white;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.15);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background: linear-gradient(135deg, #22471d, #163013);
    box-shadow: 0 6px 16px rgba(45, 90, 39, 0.2);
}

button:active {
    transform: scale(0.98); /* Tactile physical press tracking mechanics */
    box-shadow: 0 2px 6px rgba(45, 90, 39, 0.1);
}

/* Clean Form Filter Button Context */
.archive-filter-bar button {
    background: var(--primary-green);
    box-shadow: none;
}

/* ==========================================
   5. TABLES SYSTEM
   ========================================== */
.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th { text-align: left; color: var(--text-muted); font-size: 0.85em; text-transform: uppercase; border-bottom: 2px solid #d2ebd2; padding: 14px 10px; font-weight: 700; }
td { padding: 16px 10px; border-bottom: 1px solid #f2f7f2; color: var(--text-dark); }
tr:hover td { background-color: #fafdfa; }

.status-pill {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}
.status-good { background: #e2f3e1; color: #2d5a27; }
.status-low { background: #ffebee; color: #b71c1c; }

/* ==========================================
   6. MAIN STRUCTURAL CONTAINERS & RESPONSIVENESS
   ========================================== */
.app-layout { display: flex; width: 100%; }
.main-content { flex: 1; padding: 25px 15px; width: 100%; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; }

.success-msg, .error-msg {
    padding: 14px 18px; border-radius: 10px; margin-bottom: 25px; font-size: 0.95rem; font-weight: 600;
}
.success-msg { background: #e8f5e9; color: #2d5a27; border: 1px solid #c8e6c9; }
.error-msg { background: #ffebee; color: #b71c1c; border: 1px solid #ffcdd2; }

@media (min-width: 992px) {
    .grid-container { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; }
    .main-content { padding: 40px; }
}