/* =========================================
   1. VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
    /* Colors */
    --bg-body: #0a0a0a;       /* Deep Black */
    --bg-card: #161616;       /* Dark Grey for content boxes */
    --bg-card-hover: #1f1f1f;
    
    --text-main: #e0e0e0;     /* Off-white */
    --text-muted: #888888;    /* Grey for subtitles */
    
    --accent: #ff8c00;        /* The Side Quests Orange */
    --accent-glow: rgba(255, 140, 0, 0.4);
    
    /* Status Colors */
    --success: #28a745;       /* Completed/Green */
    --info: #17a2b8;          /* Registered/Blue */
    --primary: #007bff;       /* Planned/Blue */
    --danger: #dc3545;        /* Cancelled/Red */

    /* Typography */
    --font-tech: 'Courier New', Courier, monospace;  /* Headers, Data, Code */
    --font-ui: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Body text */

    /* Spacing & Borders */
    --border-radius: 4px;
    --container-width: 1100px;
    --nav-height: 70px;
}

/* =========================================
   2. RESET & BASE STYLES
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.6;
    margin: 0;
    padding-top: var(--nav-height); /* Prevent content hiding behind fixed nav */
    overflow-x: hidden;
}

/* The Scanline Effect (Optional - add class 'retro-mode' to body if desired) */
body.retro-mode::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 9999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-tech);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
}

h1 { font-size: 2.5rem; border-bottom: 2px solid var(--accent); display: inline-block; margin-bottom: 1rem; padding-bottom: 0.5rem; }
h2 { font-size: 2rem; color: var(--accent); }
h3 { font-size: 1.5rem; }

a { color: var(--accent); text-decoration: none; transition: 0.3s; }
a:hover { color: #fff; text-shadow: 0 0 8px var(--accent); }

/* =========================================
   3. LAYOUT & GRID (Bootstrap-ish)
   ========================================= */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Flexbox Row/Col system */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

/* Simple Grid System */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* Responsive Grid Breakpoints */
@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .row { flex-direction: column; }
}

/* =========================================
   4. COMPONENT: NAVBAR
   ========================================= */
.navbar {
    background-color: rgba(10, 10, 10, 0.95);
    border-bottom: 1px solid #333;
    height: var(--nav-height);
    position: fixed;
    top: 0; width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    backdrop-filter: blur(5px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-brand {
    font-family: var(--font-tech);
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand img { height: 40px; } /* Logo size */

.nav-links { list-style: none; display: flex; gap: 25px; margin: 0; padding: 0; }
.nav-links a { font-family: var(--font-tech); font-size: 0.9rem; color: #aaa; text-transform: uppercase; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

/* =========================================
   5. COMPONENT: CARDS & STATS
   ========================================= */
.card {
    background-color: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--border-radius);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border-color: var(--accent);
}

.stat-card {
    text-align: center;
    border-top: 3px solid var(--accent);
}
.stat-value { font-size: 2rem; font-family: var(--font-tech); color: #fff; font-weight: bold; }
.stat-label { font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* =========================================
   6. COMPONENT: BUTTONS & BADGES
   ========================================= */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: var(--font-tech);
    text-transform: uppercase;
    font-weight: bold;
    border-radius: 2px;
    transition: all 0.2s;
}

.btn-primary { background-color: var(--accent); color: #000; }
.btn-primary:hover { background-color: #e67e00; box-shadow: 0 0 10px var(--accent-glow); }

.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #000; }

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #fff;
}
.badge-success { background-color: var(--success); }
.badge-info { background-color: var(--info); }
.badge-planned { background-color: var(--primary); }
.badge-muted { background-color: #444; }

/* =========================================
   7. UTILITIES
   ========================================= */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent) !important; }
.text-muted { color: var(--text-muted) !important; }

.mt-2 { margin-top: 10px; }
.mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 10px; }
.mb-4 { margin-bottom: 20px; }
.py-5 { padding-top: 40px; padding-bottom: 40px; }

/* =========================================
   8. SPECIFIC: TIMELINE (Refined)
   ========================================= */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 40px auto;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: #333; /* Darker line */
    top: 0; bottom: 0; left: 50%;
    margin-left: -1px;
}
.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}
.timeline-item.left { left: 0; }
.timeline-item.right { left: 50%; }

/* Timeline Dot */
.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    right: -8px; top: 25px;
    background-color: var(--bg-body);
    border: 3px solid var(--accent);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 10px var(--bg-body);
}
.timeline-item.right::after { left: -8px; }

/* Responsive Timeline */
@media (max-width: 768px) {
    .timeline::after { left: 31px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
    .timeline-item.left, .timeline-item.right { left: 0; }
    .timeline-item::after { left: 23px; } /* Dot alignment */
    .timeline-item.right::after { left: 23px; }
}

/* =========================================
   9. ADMIN DASHBOARD SPECIFIC STYLES
   ========================================= */
.admin-wrapper {
    display: flex;
    min-height: calc(100vh - var(--nav-height));
    margin-top: 20px; /* Slight offset from navbar */
}

/* Sidebar Navigation */
.admin-sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-nav-btn {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 15px 25px;
    color: var(--text-muted);
    font-family: var(--font-tech);
    font-size: 1rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.admin-nav-btn:hover {
    background-color: var(--bg-card-hover);
    color: #fff;
}

.admin-nav-btn.active {
    background-color: rgba(255, 140, 0, 0.1); /* Low opacity accent */
    color: var(--accent);
    border-left-color: var(--accent);
}

/* Content Area */
.admin-content {
    flex-grow: 1;
    padding: 40px;
    background-color: var(--bg-body);
    overflow-y: auto; /* Scroll if content is long */
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-family: var(--font-ui);
    background: var(--bg-card);
    border: 1px solid #333;
}

.admin-table th, .admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.admin-table th {
    background-color: #000;
    color: var(--accent);
    font-family: var(--font-tech);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.admin-table tr:hover {
    background-color: var(--bg-card-hover);
}

/* Admin Forms (The "Add New User" Box) */
.admin-form-container {
    background: var(--bg-card);
    padding: 25px;
    border: 1px solid #333;
    border-left: 4px solid var(--accent);
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: none; /* Hidden by default until toggled */
}
.admin-form-container.open { display: block; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 0.9rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    background-color: #0a0a0a;
    border: 1px solid #333;
    color: #fff;
    font-family: var(--font-tech);
    border-radius: var(--border-radius);
}
.form-group input:focus, .form-group select:focus { 
    outline: none; 
    border-color: var(--accent); 
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Tab Visibility Logic (CRITICAL for fixing the layout) */
.tab-pane { display: none; animation: fadeIn 0.3s ease-in-out; }
.tab-pane.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   10. ALERTS & FLASH MESSAGES
   ========================================= */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-family: var(--font-ui);
    font-weight: bold;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* =========================================
   11. PROGRESS BARS (Admin Goals)
   ========================================= */
.progress-track {
    width: 100%;
    height: 10px;
    background-color: #333;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    /* Stripe effect */
    background-image: linear-gradient(
        45deg, 
        rgba(255, 255, 255, 0.15) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.15) 50%, 
        rgba(255, 255, 255, 0.15) 75%, 
        transparent 75%, 
        transparent
    );
    background-size: 1rem 1rem;
    transition: width 0.4s ease;
}

/* =========================================
   12. GAMIFIED INTERFACE (Quest Log)
   ========================================= */

/* A. Achievement Cards (Goals) */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.achievement-card {
    background: linear-gradient(145deg, #1a1a1a, #111);
    border: 1px solid #333;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.achievement-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.achievement-card::before {
    content: 'ACHIEVEMENT';
    position: absolute;
    top: 10px; right: 10px;
    font-size: 0.6rem;
    color: #444;
    font-family: var(--font-tech);
    letter-spacing: 1px;
}

/* B. The Timeline (Quest Line) */
.quest-timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

/* The Vertical Line */
.quest-timeline::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 20px; /* Line position */
    width: 2px;
    background: #333;
}

.quest-item {
    position: relative;
    padding-left: 60px; /* Space for the line/dot */
    margin-bottom: 40px;
}

/* The Dot on the Line */
.quest-marker {
    position: absolute;
    left: 11px; top: 20px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #000;
    border: 3px solid #555;
    z-index: 2;
    transition: background 0.3s, border-color 0.3s;
}

.quest-item:hover .quest-marker {
    background: var(--accent);
    border-color: #fff;
    box-shadow: 0 0 10px var(--accent);
}

/* Quest Card Styling */
.quest-card {
    background: var(--bg-card);
    border: 1px solid #333;
    padding: 20px;
    position: relative;
}

.quest-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.quest-date {
    font-family: var(--font-tech);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    display: block;
}

/* C. Loot / Rewards Section */
.quest-loot {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #333;
    font-size: 0.9rem;
}

.loot-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(40, 40, 40, 0.5);
    border: 1px solid #444;
    padding: 5px 10px;
    border-radius: 4px;
    margin-right: 10px;
    margin-bottom: 5px;
    color: #ccc;
}

.loot-val { color: var(--accent); font-weight: bold; margin-right: 5px; }
.loot-label { font-size: 0.8rem; }

/* Status Colors */
.status-completed .quest-marker { border-color: var(--success); background: #000; }
.status-planned .quest-marker { border-color: var(--info); }
.status-registered .quest-marker { border-color: var(--primary); }

/* Quest Notes (Flavor Text) */
.quest-notes {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 2px solid #444;
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
    font-family: var(--font-ui);
}