:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --bg-surface: #222222;
    --text-primary: #fafafa;
    --text-secondary: #888888;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #2a2a2a;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

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

/* Grid background pattern */
.landing-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.sidebar-header p {
    font-size: .75rem;
    color: var(--text-secondary);
    margin-top: .25rem;
}

.sidebar-nav {
    flex: 1;
    padding: .75rem 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: all .15s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, .04);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(99, 102, 241, .08);
    color: var(--accent);
    border-left-color: var(--accent);
}

.sidebar-nav a .icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: .5rem 1.5rem;
}

.nav-external {
    color: var(--accent) !important;
}

.external-icon {
    margin-left: auto;
    font-size: .75rem;
    opacity: .6;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-logout {
    display: block;
    text-align: center;
    padding: .55rem;
    background: rgba(239, 68, 68, .08);
    color: var(--danger);
    border-radius: .75rem;
    text-decoration: none;
    font-size: .8rem;
    font-weight: 600;
    transition: all .15s ease;
    border: 1px solid rgba(239, 68, 68, .15);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, .15);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem 1rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-indicator.online {
    background: rgba(34, 197, 94, .08);
    color: var(--success);
    border-color: rgba(34, 197, 94, .2);
}

.status-indicator.offline {
    background: rgba(239, 68, 68, .08);
    color: var(--danger);
    border-color: rgba(239, 68, 68, .2);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

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

/* Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.cards-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-icon {
    font-size: 1.1rem;
}

.card-header h3 {
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.25rem;
}

.card-desc {
    color: var(--text-secondary);
    font-size: .8rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.card-hint {
    color: var(--text-secondary);
    font-size: .75rem;
    margin-top: .75rem;
    text-align: center;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .6rem .75rem;
    background: var(--bg-secondary);
    border-radius: .6rem;
    border: 1px solid var(--border);
}

.info-label {
    font-size: .65rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.info-value {
    font-size: .85rem;
    font-weight: 600;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-secondary); font-size: .8rem; }

/* Lists */
.list-compact {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .7rem;
    background: var(--bg-secondary);
    border-radius: .6rem;
    font-size: .8rem;
    border: 1px solid var(--border);
}

.list-item-sm {
    display: block;
}

.list-item code {
    font-size: .75rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

.item-name {
    font-weight: 500;
}

.item-meta {
    font-size: .7rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.25rem;
    border-radius: .75rem;
    font-weight: 600;
    font-size: .8rem;
    cursor: pointer;
    transition: all .15s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(99, 102, 241, .25);
}

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

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-warning {
    background: rgba(245, 158, 11, .1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, .25);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, .18);
}

.btn-danger {
    background: rgba(239, 68, 68, .1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, .25);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: .35rem .85rem;
    font-size: .75rem;
    border-radius: .5rem;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
    border: 1px solid var(--border);
    font-size: .8rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.btn-danger-icon {
    background: rgba(239, 68, 68, .08);
    color: var(--danger);
    border-color: rgba(239, 68, 68, .2);
}

.btn-danger-icon:hover {
    background: rgba(239, 68, 68, .18);
}

/* Forms */
.form-group {
    margin-bottom: .85rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: .8rem;
    color: var(--text-secondary);
    margin-bottom: .4rem;
}

.form-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: .6rem;
    padding: .7rem .85rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: .85rem;
    cursor: pointer;
    transition: border-color .15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.25rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

/* Alerts */
.alert {
    padding: .85rem 1.15rem;
    border-radius: .75rem;
    margin-bottom: 1.25rem;
    font-size: .85rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(34, 197, 94, .08);
    border-color: rgba(34, 197, 94, .2);
    color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, .08);
    border-color: rgba(239, 68, 68, .2);
    color: var(--danger);
}

/* Backup List */
.backup-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--bg-secondary);
    border-radius: .75rem;
    border: 1px solid var(--border);
    transition: border-color .15s;
}

.backup-item:hover {
    border-color: var(--accent);
}

.backup-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.backup-name {
    font-weight: 600;
    font-size: .8rem;
}

.backup-meta {
    font-size: .7rem;
    color: var(--text-secondary);
}

.backup-actions {
    display: flex;
    gap: .4rem;
}

/* Logs */
.logs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.logs-container {
    background: var(--bg-secondary);
    border-radius: .75rem;
    padding: .85rem;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border);
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

.log-line {
    padding: .35rem .5rem;
    font-size: .75rem;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
    color: var(--text-secondary);
}

.log-line:last-child {
    border-bottom: none;
}

/* Login Page */
.login-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-secondary);
    font-size: .85rem;
    margin-top: .3rem;
}

.login-card .form-group {
    margin-bottom: 1rem;
}

.login-card .form-group label {
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 500;
}

.login-card input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: .6rem;
    padding: .7rem .85rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: .85rem;
    transition: all .15s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: .7rem;
    font-size: .9rem;
}

.alert-danger.login-alert {
    background: rgba(239, 68, 68, .08);
    border-color: rgba(239, 68, 68, .2);
    color: var(--danger);
    padding: .7rem 1rem;
    border-radius: .6rem;
    margin-bottom: 1rem;
    font-size: .8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 200px;
        padding: 1.25rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .admin-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        position: relative;
        flex-direction: row;
        padding: .75rem;
        overflow-x: auto;
        gap: .5rem;
    }
    .sidebar-header {
        display: none;
    }
    .sidebar-nav {
        display: flex;
        gap: .25rem;
        padding: 0;
    }
    .sidebar-nav a {
        padding: .45rem .75rem;
        white-space: nowrap;
        font-size: .8rem;
        border-left: none;
        border-bottom: 2px solid transparent;
    }
    .sidebar-nav a.active {
        border-left: none;
        border-bottom-color: var(--accent);
    }
    .nav-divider {
        display: none;
    }
    .sidebar-footer {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}
