:root {
    --sidebar-width: 250px;
    --primary: #4a5568;
    --primary-hover: #2d3748;
    --accent: #3182ce;
    --accent-hover: #2b6cb0;
    --success: #38a169;
    --danger: #e53e3e;
    --warning: #dd6b20;
    --info: #3182ce;
    --bg: #edf2f7;
    --card-bg: #ffffff;
    --text: #2d3748;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { text-decoration: none; color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo h2 { color: var(--primary); font-weight: 700; }

/* Admin Layout */
.admin-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-hover);
    color: white;
    flex-shrink: 0;
    transition: all 0.3s;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-nav ul { list-style: none; padding: 20px 0; }
.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: 0.2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.1); color: white; }
.logout-link { color: #feb2b2 !important; }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--card-bg);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 15px; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.content-area { padding: 30px; flex: 1; overflow-y: auto; }

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
}
.stat-card.highlight-green { border-left-color: var(--success); }
.stat-card.highlight-blue { border-left-color: var(--accent); }
.stat-card h3 { font-size: 1rem; color: #718096; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 2rem; font-weight: 700; margin: 10px 0; color: var(--text); }
.stat-label { font-size: 0.85rem; color: #a0aec0; }

/* Cards & Tables */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}
.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
}
.card-body { padding: 25px; }

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th { background: #f7fafc; font-weight: 600; color: #4a5568; }
.table tbody tr:hover { background: #f7fafc; }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group { margin-bottom: 20px; }
.form-group.full-width { grid-column: 1 / -1; }
label { display: block; margin-bottom: 8px; font-weight: 500; color: #4a5568; }
.form-control {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px; font-family: inherit;
    transition: 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; }

/* Buttons */
.btn {
    display: inline-block; padding: 8px 16px;
    border: none; border-radius: 4px;
    font-weight: 500; cursor: pointer; text-align: center;
    transition: 0.2s; color: white;
}
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #a0aec0; }
.btn-secondary:hover { background: #718096; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #2f855a; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c53030; }
.btn-info { background: #0bc5ea; }
.btn-info:hover { background: #00b5d8; }
.btn-outline-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }
.btn-lg { padding: 12px 24px; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }
.w-100 { width: 100%; }

/* Utilities */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.d-inline { display: inline-block; }
.w-auto { width: auto; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: #718096; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }

/* Badges */
.badge {
    padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600;
}
.badge-active { background: #c6f6d5; color: #22543d; }
.badge-draft { background: #e2e8f0; color: #4a5568; }
.badge-closed { background: #fed7d7; color: #742a2a; }
.badge-draw_completed, .badge-assigned, .badge-paid { background: #c6f6d5; color: #22543d; }
.badge-available, .badge-pending { background: #feebc8; color: #9c4221; }
.badge-cancelled { background: #fed7d7; color: #742a2a; }

/* Alerts */
.alert { padding: 12px 20px; border-radius: var(--radius); margin-bottom: 20px; transition: opacity 0.3s; }
.alert-success { background: #c6f6d5; color: #22543d; border-left: 4px solid #38a169; }
.alert-error { background: #fed7d7; color: #742a2a; border-left: 4px solid #e53e3e; }
.alert-warning { background: #feebc8; color: #9c4221; border-left: 4px solid #dd6b20; }
.alert-info { background: #ebf8ff; color: #2b6cb0; border-left: 4px solid #3182ce; }

/* Modals */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe; margin: 10% auto; padding: 30px;
    border: 1px solid #888; width: 100%; max-width: 500px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover { color: black; }

/* Admin Bottom Navigation & Overlay (App Style) */
.admin-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    padding-bottom: env(safe-area-inset-bottom);
}
.admin-bottom-nav ul {
    display: flex;
    justify-content: space-around;
    list-style: none;
    padding: 0; margin: 0;
}
.admin-bottom-nav li { flex: 1; }
.admin-bottom-nav .nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 10px 0; color: var(--text-light, #a0aec0); text-decoration: none;
    font-size: 0.75rem; font-weight: 500; transition: all 0.2s; user-select: none;
}
.admin-bottom-nav .nav-icon { font-size: 1.4rem; margin-bottom: 3px; filter: grayscale(100%); opacity: 0.6; }
.admin-bottom-nav .nav-item.active { color: var(--accent); }
.admin-bottom-nav .nav-item.active .nav-icon { filter: grayscale(0%); opacity: 1; transform: scale(1.1); }

.sidebar-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 998;
    opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* Responsive */
@media (max-width: 768px) {
    /* Side drawer behavior */
    .sidebar { position: fixed; left: -280px; width: 280px; height: 100%; z-index: 999; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
    .sidebar.active { left: 0; }
    
    /* App-like Topbar */
    .topbar { 
        position: sticky; top: 0; z-index: 997; 
        padding: 10px 15px; 
        background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
    }
    .mobile-menu-btn { display: block; color: var(--text); }
    .topbar h2 { font-size: 1.2rem; }
    .admin-name { display: none; /* Hide name to save space */ }
    
    /* Bottom Nav & Body adjustments */
    .admin-bottom-nav { display: block; }
    .admin-wrapper { padding-bottom: 70px; }
    
    /* Edge-to-Edge Layout */
    .content-area { padding: 15px; }
    .card { margin-bottom: 15px; border-radius: 12px; }
    .card-header { padding: 15px; }
    .card-body { padding: 15px; }
    .dashboard-stats { grid-template-columns: 1fr; gap: 15px; margin-bottom: 15px; }
    
    /* Touch Targets */
    .btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
    .btn-sm { min-height: 36px; padding: 5px 15px; margin-bottom: 5px; }
    .form-control { min-height: 48px; }
    
    /* Mobile Tables */
    .table-responsive { 
        width: calc(100% + 30px); 
        margin: 0 -15px; 
        padding: 0 15px; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; 
    }
    .table { min-width: 650px; }
    
    /* Grids */
    .grid-2, .form-grid { grid-template-columns: 1fr; gap: 15px; }
}
