/* File: assets/css/style.css */
/* 
 * SPARTANS JTAC PORTAL - CORE STYLESHEET
 * Modern Tactical MilSim Theme (2026 Standard)
 * Features: Native CSS Nesting, Grid/Flex Layouts, Custom Variables
 */

:root {
    /* Color Palette - Tactical Dark */
    --bg-main: #0a0b0d;           /* Deep black/grey */
    --bg-panel: #14161a;          /* Panel background */
    --bg-input: #1d2026;          /* Input/Control background */
    --border-color: #2d323b;      /* Tactical borders */
    
    /* Semantic Colors */
    --accent-color: #4ade80;      /* Tactical Green (Primary) */
    --accent-hover: #22c55e;
    --text-main: #e2e8f0;         /* High contrast white/grey */
    --text-muted: #94a3b8;        /* Muted descriptions */
    
    --info-color: #3b82f6;        /* Blue */
    --warning-color: #f59e0b;     /* Amber/Orange */
    --danger-color: #ef4444;      /* Red */
    --success-color: #10b981;     /* Emerald */

    /* Typography & Spacing */
    --font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --sidebar-width: 280px;
    --header-height: 64px;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* 1. Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.2s;
    
    &:hover {
        color: var(--accent-hover);
    }
}

/* 2. Application Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex-overflow */
}

.content-area {
    padding: 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;

    h1 {
        font-size: 1.875rem;
        font-weight: 700;
        margin-bottom: 2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.75rem;
        letter-spacing: -0.025em;
    }
}

/* 3. Topbar Navigation */
.topbar {
    height: var(--header-height);
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;

    .breadcrumb {
        font-size: 0.875rem;
        color: var(--text-muted);
        font-weight: 500;
    }

    .topbar-actions {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }
}

/* 4. Sidebar Navigation (Vertical) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;

    .sidebar-header {
        padding: 1.5rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);

        svg { width: 32px; height: 32px; color: var(--accent-color); }
        
        .logo-text {
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            line-height: 1.1;
            
            span { display: block; }
            .subtext { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
        }
    }

    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        padding: 1.25rem 0.75rem;

        .nav-section {
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            color: var(--text-muted);
            margin: 1.5rem 0 0.5rem 1rem;
            letter-spacing: 0.1em;
        }

        ul {
            list-style: none;
            
            li {
                margin-bottom: 0.25rem;
                
                a {
                    display: flex;
                    align-items: center;
                    gap: 0.75rem;
                    padding: 0.75rem 1rem;
                    border-radius: var(--radius);
                    color: var(--text-main);
                    font-size: 0.935rem;
                    font-weight: 500;
                    
                    svg { width: 18px; height: 18px; color: var(--text-muted); }
                    
                    &:hover {
                        background-color: rgba(255, 255, 255, 0.05);
                        color: var(--accent-color);
                        svg { color: var(--accent-color); }
                    }
                    
                    &.active {
                        background-color: rgba(74, 222, 128, 0.1);
                        color: var(--accent-color);
                        font-weight: 600;
                        svg { color: var(--accent-color); }
                    }
                }
            }
        }
    }

    .sidebar-footer {
        padding: 1.25rem;
        background-color: rgba(0, 0, 0, 0.2);
        border-top: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        justify-content: space-between;

        .user-info {
            display: flex;
            align-items: center;
            gap: 0.75rem;

            .user-avatar {
                width: 38px;
                height: 38px;
                background-color: var(--accent-color);
                color: #000;
                border-radius: 8px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-weight: 800;
            }

            .user-meta {
                line-height: 1.2;
                .username { font-size: 0.85rem; font-weight: 600; color: #fff; display: block; }
                .role { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
            }
        }
        
        .logout-btn {
            color: var(--text-muted);
            &:hover { color: var(--danger-color); }
            svg { width: 20px; height: 20px; }
        }
    }
}

/* 5. Grid Layouts & Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    
    h3 { margin-bottom: 1.25rem; font-size: 1.1rem; color: #fff; }
    
    &.card-stat {
        .stat-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
        .stat-value { font-size: 2.25rem; font-weight: 800; color: var(--accent-color); margin-top: 0.25rem; }
    }
}

/* 6. Tactical Tables */
.table-container {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.tactical-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.935rem;

    th {
        background-color: rgba(0, 0, 0, 0.3);
        padding: 1rem 1.5rem;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.05em;
        border-bottom: 1px solid var(--border-color);
    }

    td {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color);
        color: var(--text-main);
    }

    tbody tr:hover {
        background-color: rgba(255, 255, 255, 0.02);
    }

    tbody tr:last-child td {
        border-bottom: none;
    }
}

/* 7. Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;

    label {
        display: block;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: 0.5rem;
        letter-spacing: 0.05em;
    }

    input[type="text"], 
    input[type="password"], 
    input[type="number"], 
    input[type="datetime-local"], 
    select, 
    textarea {
        width: 100%;
        background-color: var(--bg-input);
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        padding: 0.75rem 1rem;
        color: #fff;
        font-family: inherit;
        font-size: 0.95rem;
        transition: border-color 0.2s, box-shadow 0.2s;

        &:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.1);
        }
        
        &::placeholder { color: #4b5563; }
    }
    
    textarea { resize: vertical; min-height: 100px; }
}

/* 8. Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-family: inherit;

    &.btn-primary {
        background-color: var(--accent-color);
        color: #000;
        &:hover { background-color: var(--accent-hover); transform: translateY(-1px); }
    }

    &.btn-outline {
        background-color: transparent;
        border-color: var(--border-color);
        color: var(--text-main);
        &:hover { border-color: var(--accent-color); color: var(--accent-color); }
    }

    &.btn-danger {
        background-color: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.2);
        color: var(--danger-color);
        &:hover { background-color: var(--danger-color); color: #fff; }
    }

    &.w-full { width: 100%; }
}

/* 9. Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;

    &.badge-admin { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); border-color: rgba(239, 68, 68, 0.2); }
    &.badge-instructor { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); border-color: rgba(245, 158, 11, 0.2); }
    &.badge-operator { background: rgba(74, 222, 128, 0.1); color: var(--accent-color); border-color: rgba(74, 222, 128, 0.2); }
    &.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); border-color: rgba(16, 185, 129, 0.2); }
}

/* 10. Split Layout (Operations/Practical) */
.split-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.secondary-sidebar {
    width: 320px;
    flex-shrink: 0;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: calc(var(--header-height) + 2rem);

    .sec-sidebar-header {
        padding: 1rem 1.5rem;
        background: rgba(0, 0, 0, 0.2);
        font-weight: 700;
        font-size: 0.8rem;
        text-transform: uppercase;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border-color);
    }

    .op-nav {
        padding: 0.5rem;
        
        .op-item {
            display: block;
            padding: 1rem;
            border-radius: 0.375rem;
            margin-bottom: 0.25rem;
            color: var(--text-muted);
            
            &:hover { background: rgba(255, 255, 255, 0.02); color: #fff; }
            
            &.active {
                background: rgba(74, 222, 128, 0.05);
                border: 1px solid var(--border-color);
                color: var(--accent-color);
                .op-title { color: #fff; }
            }

            .op-date { font-family: monospace; font-size: 0.75rem; display: block; margin-bottom: 0.25rem; }
            .op-title { font-weight: 700; display: block; font-size: 0.9rem; }
        }
    }
}

/* 11. Evaluation Cards (Team Grids) */
.eval-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.5rem;
    flex: 1;
}

.eval-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);

    .eval-header {
        padding: 1.5rem;
        background-color: rgba(0, 0, 0, 0.3);
        border-bottom: 1px solid var(--border-color);
        
        .team-name {
            width: 100%;
            background: #000;
            border: 1px solid var(--border-color);
            color: var(--accent-color);
            font-weight: 800;
            text-align: center;
            font-size: 1.1rem;
            padding: 0.5rem;
            border-radius: 4px;
            margin-bottom: 1rem;
        }

        .role-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            margin-bottom: 0.5rem;
            color: var(--text-muted);
            
            select { width: 60%; padding: 0.25rem; font-size: 0.85rem; }
        }
    }
}

/* 12. CAS Generator Styles */
.generator-preview {
    background: #000;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.05rem;
    line-height: 1.7;
    white-space: pre-wrap;
    color: #fff;
    margin: 1.5rem 0;
}

/* 13. Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* 14. Responsive Adjustments */
@media (max-width: 1024px) {
    .sidebar { width: 80px; .logo-text, .nav-section, .username, .role { display: none; } }
    .sidebar-nav ul li a { justify-content: center; padding: 1rem; span { display: none; } }
}

@media (max-width: 768px) {
    .split-layout { flex-direction: column; }
    .secondary-sidebar { width: 100%; position: static; }
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
}