/* Jacobite Database - Main Stylesheet */

/* =====================================================
   CSS Variables
   ===================================================== */
: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;
}

.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;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* =====================================================
   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);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 0.25rem;
}

/* =====================================================
   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; }
.status-completed { background: #D4EDDA; color: #155724; }
.status-partial { background: #FFF3CD; color: #856404; }
.status-failed { background: #F8D7DA; color: #721C24; }

/* =====================================================
   Dashboard
   ===================================================== */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header p {
    color: var(--text-light);
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.stat-warning .stat-number {
    color: var(--warning);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.dashboard-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.dashboard-section.full-width {
    grid-column: 1 / -1;
}

.dashboard-section h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

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

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

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

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

.results-info {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-light);
}

/* =====================================================
   Content Sections
   ===================================================== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.content-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.content-section.full-width {
    grid-column: 1 / -1;
}

.content-section h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

/* =====================================================
   Login Page
   ===================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-light);
    margin: 0;
}

.login-form {
    margin-bottom: 1.5rem;
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =====================================================
   Import Page
   ===================================================== */
.upload-form {
    margin-bottom: 2rem;
}

.upload-form input[type="file"] {
    padding: 1rem;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.import-instructions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.import-instructions ol,
.import-instructions ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.5rem;
}

.download-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-box {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.info-box h3 {
    margin-top: 0;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.values-box {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: var(--radius);
}

.values-box h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.values-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.values-box li {
    margin-bottom: 0.25rem;
}

/* =====================================================
   Footer
   ===================================================== */
.main-footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.7);
    padding: 1.5rem 2rem;
    text-align: center;
}

.main-footer p {
    margin: 0;
}

.footer-meta {
    font-size: 0.85rem;
    margin-top: 0.25rem;
    color: rgba(255,255,255,0.5);
}

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

/* =====================================================
   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;
    }
    
    .nav-user {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .dashboard-grid,
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}
