:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --glass-bg: rgba(17, 24, 39, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-amber: #f59e0b;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand h2 {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), transparent);
    color: #60a5fa;
    border-left: 3px solid var(--accent-blue);
}

.sidebar-footer {
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.status-indicator {
    color: var(--accent-green);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

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

.top-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Cards & Glassmorphism */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-title {
    font-size: 13px;
    color: var(--text-muted);
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-blue { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

/* Site Panel Grouping Cards */
.site-panel-card {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.site-panel-card .card-title {
    font-size: 15px;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-text {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
}

.help-text code {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    width: 500px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-lg { width: 850px; }

.glass-card {
    background: #111827;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 12px; }
.divider { border: 0; border-top: 1px solid var(--glass-border); margin: 20px 0; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* Tabs switching */
.tab-content { display: none; }
.tab-content.active { display: block; }

.code-block {
    background: #030712;
    padding: 16px;
    border-radius: var(--radius-md);
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: #a7f3d0;
    max-height: 400px;
    overflow-y: auto;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 450px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
}

.toast-info {
    background: rgba(30, 58, 138, 0.88);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.toast-success {
    background: rgba(6, 78, 59, 0.88);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.toast-warning {
    background: rgba(120, 53, 15, 0.88);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.toast-error {
    background: rgba(127, 29, 29, 0.88);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Button Loading & Disabled state */
.btn:disabled, .btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Advanced Node Options Checklist */
.advanced-options {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px dashed var(--glass-border);
}

.advanced-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.advanced-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue);
}

.advanced-options input[type="checkbox"]:disabled + span,
.advanced-options label.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Node ID verify flex box & feedback */
.node-id-flex {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-verify {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-verify:hover {
    background: rgba(56, 189, 248, 0.3);
    border-color: #38bdf8;
}

.node-verify-feedback {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.4;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
}

/* Form input disabled state aesthetics */
input:disabled, select:disabled, textarea:disabled {
    opacity: 0.55;
    background: rgba(15, 23, 42, 0.45) !important;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Certificate Management Badges & Elements */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.sans-tag {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px;
    font-size: 11px;
    font-family: 'Fira Code', monospace;
    background: rgba(56, 189, 248, 0.1);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 4px;
}

.cert-preview-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.6;
}

.cert-file-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px dashed rgba(56, 189, 248, 0.4);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.cert-file-label:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
}

.cert-header-upload {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}



