/* =====================================================
   CSS Variables - ORIGINAL COLOR SCHEME
   ===================================================== */
:root {
    --primary: #8B4513;
    --primary-dark: #5D2E0C;
    --primary-light: #A0522D;
    --secondary: #2C3E50;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;
    
    --bg: #F5F3EF;
    --bg-card: #FFFFFF;
    --bg-dark: #2C3E50;
    
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --text-inverse: #FFFFFF;
    
    --border: #DDD8D0;
    --border-light: #EAE6E0;
    
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    
    --radius: 4px;
    --radius-lg: 8px;
    
    --transition: 0.2s ease;
}

/* =====================================================
   Reset & Base
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem;
    font-weight: 600;
    color: var(--secondary);
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }

code {
    background: var(--bg);
    padding: 0.15em 0.4em;
    border-radius: var(--radius);
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
}

/* =====================================================
   Navigation
   ===================================================== */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    background: var(--bg-dark);
    color: var(--text-inverse);
    box-shadow: var(--shadow);
}

.nav-brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.nav-brand a {
    color: var(--text-inverse);
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.nav-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: rgba(255,255,255,0.8);
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-inverse);
    text-decoration: none;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Dropdown groups in the main nav */
.nav-dropdown { position: relative; }

.nav-dropdown > .nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    background: #1a232e;              /* solid near-black — never transparent */
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    list-style: none;
    margin: 0;
    padding: 0.35rem;
    z-index: 1000;
}

.nav-dropdown:hover > .nav-submenu,
.nav-dropdown:focus-within > .nav-submenu { display: block; }

.nav-submenu li { display: block; }

.nav-submenu a {
    display: block;
    white-space: nowrap;
    padding: 0.5rem 0.9rem;
    color: #ffffff;
}

.nav-submenu a:hover,
.nav-submenu a.active {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.user-name { font-weight: 500; }
.user-role { color: rgba(255,255,255,0.6); font-size: 0.85rem; }

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.page-header h1 { margin: 0; }

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover { text-decoration: none; }

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--text-inverse);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-inverse);
}

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

.btn-success:hover {
    background: #219A52;
    color: var(--text-inverse);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-light);
    color: var(--text);
}

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.btn-large { padding: 0.75rem 1.5rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }

/* =====================================================
   Forms
   ===================================================== */
.form-group { margin-bottom: 1.25rem; }

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    margin-top: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

/* =====================================================
   Tables
   ===================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.data-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tbody tr:hover {
    background: rgba(139, 69, 19, 0.03);
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    border-left: 4px solid;
}

.alert-error { background: #FDEDEB; border-color: var(--danger); color: #922B21; }
.alert-success { background: #E8F8F0; border-color: var(--success); color: #1E7E4A; }
.alert-warning { background: #FEF5E7; border-color: var(--warning); color: #9A6700; }
.alert-info { background: #EBF5FB; border-color: var(--info); color: #1A5276; }

/* =====================================================
   Badges & Status
   ===================================================== */
.badge, .status-badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius);
}

.badge-jacobite { background: #8B4513; color: white; }
.badge-neutral { background: var(--bg); color: var(--text-muted); }

.status-draft { background: #E8E8E8; color: #666; }
.status-complete { background: #D4EDDA; color: #155724; }
.status-verified { background: #CCE5FF; color: #004085; }
.status-published { background: #D1ECF1; color: #0C5460; }
.status-deprecated { background: #F8D7DA; color: #721C24; }

/* =====================================================
   Utilities
   ===================================================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.full-width { width: 100%; }

/* =====================================================
   Filters Bar
   ===================================================== */
.filters-bar {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.filters-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-light);
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .main-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 1rem;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }
    
    .nav-user {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .nav-dropdown > .nav-submenu {
        display: flex;
        flex-wrap: wrap;
        position: static;
        min-width: 0;
        box-shadow: none;
        padding: 0;
    }
    
    .main-content { padding: 1rem; }
    .page-header { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .filters-form { flex-direction: column; }
    .filter-group { width: 100%; }
}
