/* ServerViewer — Light theme */

:root {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #c7d2fe;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.12);
    --secondary: #0891b2;
    --secondary-glow: rgba(8, 145, 178, 0.12);

    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;

    --sidebar-width: 250px;
    --sidebar-bg: #ffffff;
    --panel-muted: #f8fafc;
    --surface-subtle: #f1f5f9;
    --log-text: #166534;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.glass-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

/* Layout */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-primary);
    transition: all 0.3s;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

#sidebar .sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

#sidebar .sidebar-header span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#sidebar ul.components {
    padding: 15px 0;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar ul li {
    padding: 2px 15px;
}

#sidebar ul li a {
    padding: 10px 15px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

#sidebar ul li a i {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

#sidebar ul li a:hover {
    color: var(--text-primary);
    background: var(--surface-subtle);
}

#sidebar ul li.active > a {
    color: var(--primary);
    background: var(--primary-glow);
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    font-weight: 600;
}

#sidebar .sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--panel-muted);
}

/* Content */
#content {
    width: calc(100% - var(--sidebar-width));
    padding: 30px;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
}

/* Metric icons */
.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.metric-icon.primary { background: var(--primary-glow); color: var(--primary); }
.metric-icon.secondary { background: var(--secondary-glow); color: var(--secondary); }
.metric-icon.success { background: rgba(5, 150, 105, 0.12); color: var(--success); }
.metric-icon.warning { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.metric-icon.danger { background: rgba(220, 38, 38, 0.12); color: var(--danger); }

/* Tables */
.table-custom {
    background: transparent !important;
    color: var(--text-primary) !important;
    margin-bottom: 0;
}
.table-custom th {
    background: var(--panel-muted) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 16px;
}
.table-custom td {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 14px 16px;
    font-size: 0.9rem;
    vertical-align: middle;
    background: transparent !important;
    color: var(--text-primary) !important;
}
.table-custom tbody tr {
    transition: background 0.2s;
}
.table-custom tbody tr:hover {
    background: var(--panel-muted) !important;
}

/* Forms */
.form-control-custom,
.form-select.form-control-custom {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.2s;
}
.form-control-custom:focus,
.form-select.form-control-custom:focus {
    background: #ffffff;
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    outline: none;
}
.form-control-custom::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn-custom {
    background: var(--primary);
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-custom:hover {
    background: #4338ca;
    box-shadow: 0 2px 8px var(--primary-glow);
    color: #ffffff;
}
.btn-outline-custom {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-outline-custom:hover {
    background: var(--panel-muted);
    border-color: #cbd5e1;
    color: var(--text-primary);
}

/* Status dots */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}
.status-indicator.green { background-color: var(--success); }
.status-indicator.yellow { background-color: var(--warning); }
.status-indicator.red { background-color: var(--danger); }

/* Badges */
.badge-custom {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-custom.success { background: rgba(5, 150, 105, 0.12); color: var(--success); }
.badge-custom.warning { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.badge-custom.danger { background: rgba(220, 38, 38, 0.12); color: var(--danger); }
.badge-custom.info { background: rgba(37, 99, 235, 0.12); color: var(--info); }
.badge-custom.primary { background: var(--primary-glow); color: var(--primary); }

/* Mapping cards */
.mapping-card {
    border-left: 4px solid var(--primary);
    padding: 15px;
    margin-bottom: 15px;
}
.mapping-flow {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: 20px;
    position: relative;
    padding-left: 15px;
}
.mapping-flow::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}
.mapping-step {
    position: relative;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}
.mapping-step::before {
    content: '→';
    position: absolute;
    left: -15px;
    color: var(--primary);
}

/* Panels (logs, security, settings) */
.panel-muted,
.bg-black,
.bg-black.bg-opacity-40,
.bg-black.bg-opacity-50,
.bg-black.bg-opacity-80 {
    background-color: var(--panel-muted) !important;
    border: 1px solid var(--border-color) !important;
}

.bg-dark.bg-opacity-30 {
    background-color: var(--surface-subtle) !important;
    border: 1px solid var(--border-color);
}

#log-viewer-output,
pre.text-success {
    color: var(--log-text) !important;
}

/* SSL row highlights */
.table-danger-row {
    background-color: rgba(220, 38, 38, 0.06) !important;
}
.table-warning-row {
    background-color: rgba(217, 119, 6, 0.06) !important;
}

/* Template utility remaps (legacy dark-class names) */
#content .text-white,
.glass-card .text-white,
#sidebar .sidebar-footer .text-white {
    color: var(--text-primary) !important;
}

#content .text-secondary,
.glass-card .text-secondary {
    color: var(--text-secondary) !important;
}

#content code {
    color: var(--primary);
}

.border-secondary.border-opacity-10,
.border-secondary.border-opacity-25 {
    border-color: var(--border-color) !important;
}

#uptime-val.badge.bg-secondary {
    background-color: var(--surface-subtle) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

/* HTMX */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator {
    display: inline-block;
    opacity: 1;
}
.htmx-request.htmx-indicator {
    display: inline-block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 992px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    #sidebar.active {
        margin-left: 0;
    }
    #content {
        width: 100%;
        margin-left: 0;
    }
    #content.active {
        margin-left: var(--sidebar-width);
    }
}
