/* SlimCMS Admin - Premium UI */
:root {
    --primary: #0F172A;
    --accent: #6366F1;
    --accent-hover: #4F46E5;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --text: #0F172A;
    --muted: #64748B;
    --success: #16A34A;
    --danger: #DC2626;
    --warning: #F59E0B;
    --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(15,23,42,0.08), 0 4px 10px rgba(15,23,42,0.04);
    --radius: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--primary); margin: 0 0 16px; }

/* === Login === */
.login-body { background: linear-gradient(135deg, #0F172A 0%, #6366F1 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--surface); padding: 48px; border-radius: 20px; box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; }
.login-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; font-size: 20px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.muted { color: var(--muted); }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 20px 0 6px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.login-card button { width: 100%; margin-top: 24px; padding: 14px; background: var(--primary); color: white; border: none; border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.login-card button:hover { background: #1E293B; }

/* === Admin layout === */
.admin-body { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--primary); color: white; padding: 24px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px; background: var(--accent); border-radius: 4px; letter-spacing: 0.5px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 20px; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #CBD5E1; border-radius: 8px; font-size: 14px; font-weight: 500; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: white; text-decoration: none; }
.sidebar-nav a.active { background: var(--accent); color: white; }
.sidebar-footer { padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 8px; }
.sidebar-footer a { color: #CBD5E1; font-size: 13px; padding: 6px 8px; }
.sidebar-footer a:hover { color: white; }

.main { display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 32px; display: flex; justify-content: space-between; align-items: center; }
.topbar-title { font-size: 20px; font-weight: 600; }
.topbar-user { font-size: 14px; color: var(--muted); }
.content { padding: 32px; max-width: 1400px; width: 100%; }

/* === Cards & stats === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 24px; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 16px; margin: 0; }
.card-body { padding: 20px; }

/* === Tables === */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 20px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; background: #F8FAFC; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: #F8FAFC; }

/* === Buttons === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
.btn:hover { background: #F1F5F9; 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); color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #B91C1C; color: white; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-link { border: none; background: none; color: var(--accent); }
.btn-link:hover { background: none; text-decoration: underline; }

/* === Badges === */
.badge-published { background: #DCFCE7; color: #16A34A; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-draft { background: #FEF3C7; color: #B45309; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-archived { background: #F1F5F9; color: var(--muted); padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }

/* === Forms === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--surface); }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
textarea.form-control { min-height: 100px; resize: vertical; }

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* === Page editor === */
.editor-shell { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.editor-main { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); padding: 32px; min-height: 500px; }
.editor-sidebar { display: flex; flex-direction: column; gap: 16px; }
.editor-title { font-size: 32px; font-weight: 700; border: none; outline: none; width: 100%; padding: 0; margin-bottom: 24px; color: var(--primary); background: transparent; font-family: inherit; }
.editor-title::placeholder { color: #CBD5E1; }

/* === Block editor === */
.blocks-canvas { display: flex; flex-direction: column; gap: 4px; }
.block-wrap { position: relative; padding: 8px 0; border-radius: 6px; }
.block-wrap:hover { background: #F8FAFC; }
.block-actions { position: absolute; top: 8px; left: -44px; display: none; gap: 4px; flex-direction: column; }
.block-wrap:hover .block-actions { display: flex; }
.block-actions button { width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.block-actions button:hover { background: #F1F5F9; color: var(--primary); }

.add-block-btn { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: transparent; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); cursor: pointer; width: 100%; justify-content: center; font-size: 14px; margin-top: 16px; }
.add-block-btn:hover { border-color: var(--accent); color: var(--accent); }

.block-picker { position: fixed; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; min-width: 240px; max-height: 360px; overflow-y: auto; z-index: 999; border: 1px solid var(--border); }
.block-picker button { width: 100%; padding: 10px 12px; text-align: left; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.block-picker button:hover { background: #F1F5F9; }
.block-picker .picker-icon { width: 32px; height: 32px; background: #F1F5F9; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.block-picker .picker-meta { display: flex; flex-direction: column; }
.block-picker .picker-meta small { color: var(--muted); font-size: 12px; }
