/* SynapseD Design System — ported from shared-styles.css */
/* Custom components, no third-party CSS framework */

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    height: 100%;
}

h1:focus { outline: none; }

/* Navbar */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 600;
    color: white;
    text-decoration: none;
}

.navbar-links {
    display: flex;
    gap: 2px;
    align-items: center;
    height: 100%;
}

.navbar-links a,
.navbar-links button {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 4px;
    transition: all 0.15s;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.navbar-links a:hover,
.navbar-links button:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

.navbar-links a.active {
    background: rgba(255,255,255,0.2);
    color: white;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
}

.navbar-user-name {
    font-weight: 500;
}

.navbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    margin: 0 4px;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
}

.container-fluid {
    padding: 20px 30px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #2c3e50;
}

.page-subtitle {
    color: #666;
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8e8e8;
    color: #2c3e50;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

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

table th {
    background: #f8f9fa;
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: #555;
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table td {
    padding: 7px 10px;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
}

table tr:hover { background: #f8f9fa; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: #007bff; color: white; }
.btn-primary:hover:not(:disabled) { background: #0056b3; }

.btn-success { background: #28a745; color: white; }
.btn-success:hover:not(:disabled) { background: #218838; }

.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover:not(:disabled) { background: #c82333; }

.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover:not(:disabled) { background: #e0a800; }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover:not(:disabled) { background: #5a6268; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: #555;
}
.btn-outline:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary { background: #007bff; color: white; }
.badge-success { background: #28a745; color: white; }
.badge-danger { background: #dc3545; color: white; }
.badge-warning { background: #ffc107; color: #333; }
.badge-info { background: #17a2b8; color: white; }
.badge-secondary { background: #6c757d; color: white; }

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    background: white;
    color: #333;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8e8e8;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e8e8e8;
    margin-top: 16px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-size: 14px;
}

.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffeaa7; }
.alert-info { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    border: 3px solid #e8e8e8;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Health Indicators */
.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.health-dot.healthy { background: #28a745; }
.health-dot.degraded { background: #ffc107; }
.health-dot.critical { background: #dc3545; animation: pulse 2s infinite; }
.health-dot.unknown { background: #6c757d; }

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #666;
}

/* Search Input */
.search-box {
    position: relative;
    max-width: 400px;
}

.search-box input {
    padding-left: 36px;
}

.search-box::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid #999;
    border-radius: 50%;
}

/* Pre/Code */
.pre-wrap {
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #6c757d; }
.text-danger { color: #dc3545; }
.text-success { color: #28a745; }
.text-warning { color: #ffc107; }
.text-sm { font-size: 12px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 4px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ── Hamburger button (hidden on desktop) ── */
.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.navbar-hamburger:hover { background: rgba(255,255,255,0.12); }

/* ── Mobile drawer ── */
.navbar-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}
.navbar-mobile-drawer {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2c3e50;
    z-index: 200;
    overflow-y: auto;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}
.navbar-mobile-user {
    padding: 16px 20px 8px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.navbar-mobile-links {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}
.navbar-mobile-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s;
}
.navbar-mobile-links a:hover,
.navbar-mobile-links a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.navbar-mobile-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 4px 20px;
}
.navbar-mobile-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}
.navbar-mobile-footer a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px;
}
.navbar-mobile-footer a:hover { color: #fff; }

/* ── Admin Layout (sidebar + content) ── */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    width: 200px;
    min-width: 200px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    padding: 0;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 16px 16px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #999;
}

.admin-sidebar-section {
    padding: 4px 16px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #aaa;
}

.admin-sidebar-divider {
    height: 1px;
    background: #eee;
    margin: 8px 16px;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
}

.admin-sidebar-nav a {
    display: block;
    padding: 8px 16px 8px 20px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.12s;
    border-left: 3px solid transparent;
}

.admin-sidebar-nav a:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.admin-sidebar-nav a.active {
    background: #edf2f7;
    color: #007bff;
    border-left-color: #007bff;
    font-weight: 600;
}

.admin-content {
    flex: 1;
    min-width: 0;
}

/* ── Mobile submenu in drawer ── */
.navbar-mobile-submenu-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}
.navbar-mobile-submenu-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.navbar-mobile-submenu {
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.15);
}
.navbar-mobile-submenu a {
    padding-left: 36px !important;
    font-size: 14px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 15px;
    }

    .navbar-links {
        display: none;
    }

    .navbar-user {
        display: none;
    }

    .navbar-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-mobile-backdrop {
        display: block;
    }

    .navbar-mobile-drawer {
        display: flex;
    }

    .container,
    .container-fluid {
        padding: 15px;
    }

    .admin-sidebar {
        display: none;
    }

    .admin-layout {
        display: block;
    }
}

/* Analytics Bar Charts */
.bar-track { height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.stat-sub { font-size: 11px; color: #888; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }
