/* NOVA Dashboard - Styles */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #21242f;
    --bg-hover: #2a2d3a;
    --border: #2e3140;
    --text-primary: #e4e6ed;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6070;
    --accent: #6c5ce7;
    --accent-hover: #7e70f0;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- Login ---- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1030 100%);
}

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

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #d35400;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(225, 112, 85, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-success {
    background: rgba(0, 184, 148, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

/* ---- Layout ---- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-brand h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 3px;
}

.sidebar-brand small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0 8px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.sidebar-nav li a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav li a.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent);
}

.sidebar-nav li a .nav-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

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

.main-content {
    margin-left: 240px;
    padding: 24px 32px;
    flex: 1;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

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

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---- Services Grid ---- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.service-card.online::before {
    background: var(--success);
}
.service-card.degraded::before {
    background: var(--warning);
}
.service-card.offline::before {
    background: var(--danger);
}
.service-card.unknown::before {
    background: var(--text-muted);
}

.service-card .service-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.service-card .service-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}
.status-dot.degraded {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}
.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}
.status-dot.unknown {
    background: var(--text-muted);
}

.service-card .service-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Conversation Log ---- */
.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-row {
    display: grid;
    grid-template-columns: 140px 100px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.conv-row.row-query {
    background: rgba(116, 185, 255, 0.15);
    border-left-color: var(--info);
}

.conv-row.row-response {
    background: rgba(0, 184, 148, 0.15);
    border-left-color: var(--success);
}

.conv-row:hover {
    background: var(--bg-hover);
}

.conv-row .conv-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.conv-row .conv-client {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.conv-row .conv-message {
    font-size: 0.9rem;
    word-break: break-word;
}

.conv-row .conv-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.conv-type.query {
    background: rgba(116, 185, 255, 0.15);
    color: var(--info);
}

.conv-type.response {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.conv-row .conv-audio {
    display: flex;
    align-items: center;
}

.conv-row audio {
    height: 32px;
    max-width: 200px;
}

/* ---- Table ---- */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

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

table tr:hover td {
    background: var(--bg-hover);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---- Filters ---- */
.filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filters input,
.filters select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .conv-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: 1fr;
    }
}
