/* --- MODERN DASHBOARD THEME --- */
:root {
    /* Palette: Slate & Indigo */
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #020617;
    --border: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    /* Accents */
    --primary: #6366f1;      /* Indigo */
    --primary-hover: #4f46e5;
    --success: #10b981;      /* Emerald */
    --danger: #ef4444;       /* Red */
    --warning: #f59e0b;      /* Amber */
    --info: #3b82f6;         /* Blue */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* --- RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    background-color: var(--bg-body);
    /* Subtle background pattern */
    background-image: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: all 0.2s; font-weight: 500; }
a:hover { color: var(--text-main); text-shadow: 0 0 8px var(--primary); }

h1, h2, h3 { color: var(--text-main); font-weight: 700; letter-spacing: -0.025em; }
h1 { font-size: 2.25rem; margin-bottom: 1.5rem; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
h2 { font-size: 1.5rem; margin: 2rem 0 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; color: var(--text-main); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 2rem; }

/* --- COMPONENTS: NAVBAR --- */
.navbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(30, 41, 59, 0.7); /* Semi-transparent */
    backdrop-filter: blur(12px);       /* Blur effect */
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    position: sticky;
    top: 1rem;
    z-index: 50;
    box-shadow: var(--shadow-md);
}

.navbar a {
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.navbar a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    text-shadow: none;
}

/* --- COMPONENTS: CARD --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

/* --- LAYOUTS --- */
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.grid { display: grid; gap: 1rem; }

/* --- FORMS --- */
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; margin-top: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }

input[type=text], input[type=password], input[type=number], textarea, select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

textarea { min-height: 100px; resize: vertical; line-height: 1.6; }

/* --- TABLES --- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; width: 100%; margin: 1rem 0; font-size: 0.9rem; }

.table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-main);
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--text-muted);
    background: rgba(255,255,255,0.05);
}

.btn:active { transform: translateY(0); }

/* Primary Action (Gradient) */
.btn[type="submit"]:not(.danger):not(.secondary) {
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.btn[type="submit"]:not(.danger):not(.secondary):hover {
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.5);
}

/* Danger Button */
.btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}
.btn.danger:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* Small Button (Table Actions) */
.btn.sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    height: 30px; /* Fixed height for alignment */
}

/* Edit Button (Orange) */
.btn.edit {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}
.btn.edit:hover { box-shadow: 0 6px 15px rgba(249, 115, 22, 0.5); }

/* Success Button (Green) */
.btn.success {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* Dark / Utility Button */
.btn.dark, .btn.secondary {
    background: #334155;
    color: #e2e8f0;
    border: none;
}
.btn.dark:hover, .btn.secondary:hover { background: #475569; }

/* Action Buttons Container */
.action-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; align-items: center; }
.action-buttons form { margin: 0; }

/* --- STATUS PILLS --- */
.pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pill.ok { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }
.pill.err { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.pill.muted { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* --- UTILS --- */
.muted { color: var(--text-muted); font-size: 0.9em; }
.ok { color: var(--success); }
.err { color: var(--danger); }

pre {
    background: #020617;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 0.5rem;
}

/* Pagination */
.pager { display: flex; gap: 0.5rem; margin-top: 2rem; justify-content: center; }
.page-link {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    transition: all 0.2s;
}
.page-link:hover, .page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Mobile */
@media (max-width: 768px) {
    .wrap { padding: 1rem; }
    .table th, .table td { padding: 0.75rem 0.5rem; }
    .btn { width: 100%; margin-bottom: 0.5rem; }
    .btn.sm { width: auto; margin-bottom: 0; }
    .navbar { flex-direction: column; align-items: stretch; text-align: center; }
    .row { grid-template-columns: 1fr; }
}
