/* ===========================
   Trafcue Analytics - Styles
   =========================== */

:root {
    --bg: #0f1115;
    --surface: #161922;
    --surface-2: #1e2230;
    --border: #2a2f3f;
    --text: #e6e8ef;
    --text-muted: #8b90a3;
    --accent: #4f7cff;
    --accent-soft: rgba(79, 124, 255, 0.15);
    --green: #35d399;
    --red: #ff5c7a;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

/* Top bar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.topbar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}

.topbar nav a {
    margin-left: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.topbar nav a:hover { color: var(--text); }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.stat-box .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.stat-box .value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-box.online .value { color: var(--green); }
.stat-box.online .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.35; }
    100% { opacity: 1; }
}

/* Tables / lists */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
}

tr:last-child td { border-bottom: none; }

.bar-cell {
    position: relative;
}

.bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--accent-soft);
    z-index: 0;
    border-radius: 4px;
}

.bar-cell span {
    position: relative;
    z-index: 1;
}

/* Forms */
.form-box {
    max-width: 380px;
    margin: 60px auto;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    margin-top: 14px;
}

input[type=text], input[type=email], input[type=password], input[type=url] {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
}

input:focus { outline: none; border-color: var(--accent); }

button, .btn {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-danger { background: var(--red); }

.error {
    background: rgba(255, 92, 122, 0.12);
    border: 1px solid var(--red);
    color: var(--red);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 14px;
}

.success {
    background: rgba(53, 211, 153, 0.12);
    border: 1px solid var(--green);
    color: var(--green);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 14px;
}

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

.website-picker {
    margin-bottom: 20px;
}

.website-picker select {
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

/* Dashboard sidebar layout */
.dash-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 0;
}

.sidebar-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 14px 16px 6px;
}

.sidebar a {
    display: block;
    padding: 7px 16px 7px 26px;
    font-size: 0.88rem;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.sidebar a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.sidebar a.active {
    color: var(--text);
    border-left-color: var(--accent);
    background: var(--accent-soft);
}

.dash-main {
    flex: 1;
    min-width: 0;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 160px;
    padding-top: 10px;
}

.bar-chart .bar {
    flex: 1;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    position: relative;
}

.bar-chart-labels {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.bar-chart-labels span {
    flex: 1;
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-muted);
}

code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
