/* Dark theme admin panel */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #e2e8f0;
    --text-muted: #b8c4d4;
    --text-subtle: #8896a8;
    --border-color: #334155;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --primary: #3b82f6;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --radius: 6px;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo span {
    color: var(--accent-primary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Cards / Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
}

.metric-card.warning .metric-value {
    color: var(--warning);
}

.metric-card.danger .metric-value {
    color: var(--danger);
}

.metric-card.success .metric-value {
    color: var(--success);
}

/* Table */
.data-table-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.875rem 1rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: var(--bg-tertiary);
}

.data-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-active {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--success);
}
.status-active::before { background-color: var(--success); }

.status-expiring {
    background-color: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}
.status-expiring::before { background-color: var(--warning); }

.status-pending, .status-provisioning {
    background-color: rgba(6, 182, 212, 0.15);
    color: var(--info);
}
.status-pending::before, .status-provisioning::before { background-color: var(--info); }

.status-error {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
.status-error::before { background-color: var(--danger); }

.status-stopped, .status-deleted {
    background-color: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}
.status-stopped::before, .status-deleted::before { background-color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

.btn-icon {
    padding: 0.375rem;
    border-radius: 4px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Action buttons in table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100%;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.drawer-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
}

.drawer-close:hover {
    color: var(--text-primary);
}

.drawer-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* Detail view */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 500;
}

.detail-value.url {
    color: var(--accent-primary);
}

.copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.125rem 0.375rem;
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

.copy-btn:hover {
    color: var(--accent-primary);
}

/* Log viewer */
.log-viewer {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

/* Error message */
.error-message {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: var(--danger);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .drawer {
        width: 100%;
    }
}

/* Utility classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Blazor error boundary */
.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: white;
}

/* Upgrade section */
.upgrade-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upgrade-current {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.upgrade-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.upgrade-value {
    color: var(--text-primary);
    font-weight: 500;
}

.upgrade-select {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.upgrade-info {
    padding: 0.5rem;
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--info);
}

/* Warning box */
.warning-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: rgba(251, 191, 36, 0.15);
    border: 1px solid var(--warning);
    border-radius: 6px;
    color: var(--warning);
    font-size: 0.875rem;
}

/* Drawer tabs */
.drawer-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.drawer-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.drawer-tab:hover {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
}

.drawer-tab.active {
    background-color: var(--primary);
    color: white;
}

.drawer-tab svg {
    opacity: 0.8;
}

.drawer-tab.active svg {
    opacity: 1;
}

/* Filter bar styles */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.25rem;
    background-color: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 8px;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
}

.filter-btn.active {
    background-color: var(--primary);
    color: white;
}
