﻿/* ============================================
   LogSys - Main Stylesheet
   ============================================ */

:root {
    --bg-base: #0e1117;
    --bg-surface: #161b27;
    --bg-elevated: #1e2535;
    --bg-hover: #252d3d;
    --border: #2a3347;
    --text-primary: #e2e8f0;
    --text-secondary: #7a8ba0;
    --text-muted: #4a5568;
    --accent: #3b82f6;
    --accent-glow: rgba(59,130,246,0.15);
    --level-info: #22c55e;
    --level-warn: #f59e0b;
    --level-error: #ef4444;
    --level-debug: #8b5cf6;
    --level-critical: #dc2626;
}

/* ============================================
   BASE
   ============================================ */
html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: row;
}

.sidebar {
    width: 220px;
    min-height: 100vh;
    height: 100%;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 32px;
    min-height: 100vh;
    width: calc(100% - 220px);
}
/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

    .sidebar-brand .brand-name {
        font-size: 18px;
        font-weight: 600;
        color: var(--text-primary);
        letter-spacing: 0.5px;
    }

    .sidebar-brand .brand-tag {
        font-size: 10px;
        color: var(--accent);
        font-family: 'JetBrains Mono', monospace;
        letter-spacing: 1px;
        text-transform: uppercase;
    }

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 8px 10px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

    .sidebar-link:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

    .sidebar-link.active {
        background: var(--accent-glow);
        color: var(--accent);
    }

    .sidebar-link i {
        font-size: 15px;
    }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

/* ============================================
   CARDS
   ============================================ */
.card-surface {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    margin: 4px 0 0;
    line-height: 1;
}

/* ============================================
   LOG LEVEL BADGES
   ============================================ */
.level-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.level-INFO {
    background: rgba(34,197,94,0.1);
    color: var(--level-info);
}

.level-WARN {
    background: rgba(245,158,11,0.1);
    color: var(--level-warn);
}

.level-ERROR {
    background: rgba(239,68,68,0.1);
    color: var(--level-error);
}

.level-DEBUG {
    background: rgba(139,92,246,0.1);
    color: var(--level-debug);
}

.level-CRITICAL {
    background: rgba(220,38,38,0.15);
    color: var(--level-critical);
    border: 1px solid rgba(220,38,38,0.3);
}

/* ============================================
   TABLE
   ============================================ */
.log-table {
    width: 100%;
    border-collapse: collapse;
}

    .log-table thead th {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.8px;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        background: var(--bg-surface);
    }

    .log-table tbody tr {
        border-bottom: 1px solid var(--border);
        transition: background 0.1s ease;
        cursor: pointer;
    }

        .log-table tbody tr:hover {
            background: var(--bg-hover);
        }

    .log-table tbody td {
        padding: 12px 16px;
        font-size: 13px;
        color: var(--text-secondary);
        vertical-align: middle;
    }

.td-message {
    color: var(--text-primary);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    white-space: nowrap;
}

.td-correlation {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   FILTERS
   ============================================ */
.filter-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.form-control,
.form-select {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    height: 38px;
}

    .form-control::placeholder {
        color: var(--text-muted) !important;
    }

    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 3px var(--accent-glow) !important;
        border-color: var(--accent) !important;
        outline: none;
    }

.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    display: block;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary-custom {
    background: var(--accent);
    border: none;
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .btn-primary-custom:hover {
        opacity: 0.85;
    }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    display: inline-block;
}

    .btn-ghost:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
        text-decoration: none;
    }

/* ============================================
   PAYLOAD VIEWER
   ============================================ */
.payload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.payload-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.payload-pre {
    margin: 0;
    padding: 24px;
    background: var(--bg-base);
    color: #a8d8a8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    border-radius: 0 0 12px 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        background: var(--accent-glow);
    }

    to {
        opacity: 1;
        background: transparent;
    }
}
/* ============================================
   LIGHT MODE
   ============================================ */
body.light-mode {
    --bg-base: #f0f2f5;
    --bg-surface: #ffffff;
    --bg-elevated: #f8f9fa;
    --bg-hover: #f0f2f5;
    --border: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --accent: #3b82f6;
    --accent-glow: rgba(59,130,246,0.1);
}

    body.light-mode .log-table thead th {
        background: #f8f9fa;
    }

    body.light-mode .payload-pre {
        background: #1e1e1e;
        color: #a8d8a8;
    }

    body.light-mode .form-control,
    body.light-mode .form-select {
        background: #ffffff !important;
        color: #1a202c !important;
        border-color: #e2e8f0 !important;
    }

/* ============================================
   SIDEBAR FOOTER
   ============================================ */
.sidebar-footer {
    padding: 16px 10px;
    border-top: 1px solid var(--border);
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

    .theme-toggle:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

/* ============================================
   MOBILE TOPBAR
   ============================================ */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 200;
}

.hamburger {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

    .sidebar-overlay.active {
        display: block;
    }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {

    /* Show mobile topbar */
    .mobile-topbar {
        display: flex;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
    }

        /* Show sidebar when open */
        .sidebar.open {
            transform: translateX(0);
        }

    /* Main content fills full width */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 72px 16px 24px; /* top padding for topbar */
    }

    /* Stack filter row */
    .filter-card .row > div {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Stack stat cards */
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4 {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    /* Table horizontal scroll */
    .card-surface.overflow-hidden {
        overflow-x: auto !important;
    }

    .log-table {
        min-width: 700px;
    }

        /* Hide source column on mobile */
        .log-table th:nth-child(6),
        .log-table td:nth-child(6) {
            display: none;
        }
}

@media (max-width: 480px) {
    /* Single column stats on very small screens */
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}
