/* Felhom Hub — Dark theme */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --accent: #60a5fa;
    --green: #4ade80;
    --yellow: #facc15;
    --red: #f87171;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Dashboard table */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.dashboard-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.dashboard-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.dashboard-table tbody tr:hover {
    background: var(--bg-hover);
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

.customer-name {
    font-weight: 600;
}

.status-dot {
    font-size: 0.85rem;
    margin-right: 0.25rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge-ok { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.status-badge-warn { background: rgba(250, 204, 21, 0.15); color: var(--yellow); }
.status-badge-down, .status-badge-fail { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.status-badge-disabled { background: #475569; color: #e2e8f0; }
.status-badge-pending { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.status-badge-blocked { background: rgba(248, 113, 113, 0.15); color: #f87171; }

/* Config badges */
.config-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.config-badge-managed { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.config-badge-manual { background: #475569; color: #e2e8f0; }
.config-badge-blocked { background: rgba(248, 113, 113, 0.2); color: #f87171; }

/* Blocked banner */
.flash-blocked {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Blocked row in tables */
.row-blocked { opacity: 0.5; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Info grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.info-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item .value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.metric-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Container table */
.container-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.container-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.container-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.container-state {
    font-size: 0.8rem;
    font-weight: 600;
}

.container-state-running { color: var(--green); }
.container-state-stopped, .container-state-exited { color: var(--red); }
.container-state-unhealthy { color: var(--yellow); }

/* Health */
.health-status {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.health-status-ok { color: var(--green); }
.health-status-warn { color: var(--yellow); }
.health-status-fail { color: var(--red); }

.issue-list, .warning-list {
    list-style: none;
    padding-left: 0;
}

.issue-list li::before { content: "● "; color: var(--red); }
.warning-list li::before { content: "● "; color: var(--yellow); }

.issue, .warning {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

/* History */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.history-table th {
    text-align: left;
    padding: 0.4rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.history-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state .hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.empty-state code {
    background: var(--bg-hover);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Footer */
footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent);
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #0f172a;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }

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

.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

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

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Forms */
.config-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}

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

.form-group input[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Credentials */
.credential-row {
    margin-bottom: 0.5rem;
}

.credential-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.25rem;
    overflow-x: auto;
}

.credential-box code {
    flex: 1;
    font-size: 0.8rem;
    word-break: break-all;
    color: var(--text-primary);
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-success {
    background: rgba(74, 222, 128, 0.1);
    color: var(--green);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.flash-error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* YAML Preview */
.yaml-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    max-height: 500px;
    overflow: auto;
}

.yaml-preview pre {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* Muted text */
.text-muted {
    color: var(--text-muted);
}

/* Severity badges */
.severity-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1.4;
}

.severity-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.severity-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.severity-info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Event filter buttons */
.event-filter {
    font-size: 0.8em;
    padding: 0.2em 0.6em;
    cursor: pointer;
}

.event-filter.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Notification channel badges */
.status-badge-operator {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.status-badge-customer {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Config diff table */
.diff-changed td { color: #f59e0b; }
.diff-hub_only td { color: #3b82f6; }
.diff-controller_only td { color: #fb923c; }

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
}
.badge-error {
    background: rgba(248, 113, 113, 0.2);
    color: var(--red);
}
.badge-warn {
    background: rgba(250, 204, 21, 0.2);
    color: var(--yellow);
}

/* Summary cards row */
.summary-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.summary-card {
    flex: 1;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}
.summary-card .card-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.1;
}
.summary-card .card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Chart container */
.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
    margin: 1rem 0;
}

/* Period selector button group */
.period-selector {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}
.period-btn {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.period-btn:hover, .period-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

/* Accuracy dot */
.accuracy-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 0.25rem;
}
.accuracy-ok   { background: var(--green); }
.accuracy-warn { background: var(--yellow); }
.accuracy-danger { background: var(--red); }

/* Memory color classes */
.mem-ok     { color: var(--green); }
.mem-warn   { color: var(--yellow); }
.mem-danger { color: var(--red); }

/* Data table (apps page) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(100,116,139,0.15);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}
.data-table td a {
    color: var(--accent);
    text-decoration: none;
    font-family: var(--font-sans, sans-serif);
}
.data-table td a:hover { text-decoration: underline; }
.data-table th a {
    color: var(--text-secondary);
    text-decoration: none;
}
.data-table th a:hover { color: var(--text-primary); }
.data-table tr:hover td { background: rgba(96,165,250,0.04); }
.data-table input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .dashboard-table { font-size: 0.8rem; }
    .dashboard-table th, .dashboard-table td { padding: 0.5rem; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .metrics-grid { grid-template-columns: 1fr; }
}
