:root {
    --bg-primary: #0f1117;
    --bg-card: #1a1d27;
    --bg-hover: #252836;
    --bg-input: #1e2130;
    --text-primary: #e4e6eb;
    --text-secondary: #8b8fa3;
    --text-muted: #5a5e72;
    --accent: var(--brand-color, #4f8ff7);
    --accent-hover: color-mix(in srgb, var(--accent) 80%, black);
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #2ecc71;
    --warning: #f39c12;
    --border: #2a2d3a;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

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

/* Header */
.header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 32px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-center .page-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.header-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.header-nav a.active {
    color: var(--accent);
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow);
}

.login-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

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

.btn-outline:hover {
    background: var(--bg-hover);
}

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

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

/* Resource cards */
.content {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    font-size: 24px;
    margin-bottom: 24px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.resource-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
}

.resource-card:hover {
    border-color: var(--accent);
}

.resource-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.resource-name {
    font-size: 16px;
    font-weight: 600;
}

.resource-type-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resource-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.resource-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.running { background: var(--success); }
.status-dot.deallocated, .status-dot.stopped { background: var(--danger); }
.status-dot.starting, .status-dot.deallocating, .status-dot.stopping { background: var(--warning); animation: pulse 1.5s infinite; }
.status-dot.unknown { background: var(--text-muted); }

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

.status-text {
    font-size: 14px;
    text-transform: capitalize;
}

.resource-actions {
    display: flex;
    gap: 8px;
}

/* Admin page */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td {
    background: var(--bg-hover);
}

/* Forms */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, .form-group select {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
}

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

/* Utilities */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    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: 48px;
    gap: 12px;
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    color: white;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Toggle switch for scan table */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 22px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Inline edit input */
.inline-edit {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 4px 8px;
    width: 100%;
    min-width: 0;
    transition: border-color 0.2s;
}

.inline-edit:hover {
    border-color: var(--border);
}

.inline-edit:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-input);
}

/* Dashboard notice bar */
.dashboard-notice {
    margin-top: 32px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

.dashboard-notice a {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
}

.dashboard-notice a:hover {
    text-decoration: underline;
}
