:root {
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --sidebar-bg: #1a1f2e;
    --sidebar-text: #a8b2c8;
    --sidebar-hover: #252d40;
    --sidebar-active: #3b82f6;
    --topbar-bg: #ffffff;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
}

/* ── Extranet Shell ─────────────────────────────────── */
.extranet-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    text-decoration: none;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.6rem 1.25rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* ── Main Content ───────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ── Page Content ───────────────────────────────────── */
.page-content {
    padding: 1.75rem 1.75rem;
    flex: 1;
}

/* ── Page Header ────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-header p {
    color: var(--text-muted);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* ── Stats Cards ────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-card .stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-card .stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-card .stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-card .stat-icon.rose   { background: #ffe4e6; color: #e11d48; }

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Admin Cards ────────────────────────────────────── */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.admin-card .admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.admin-card .admin-card-header h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

/* ── Data Table ─────────────────────────────────────── */
.data-table {
    width: 100%;
    font-size: 0.875rem;
}

.data-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges ─────────────────────────────────────────── */
.badge-active   { background: #dcfce7; color: #166534; font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 20px; }
.badge-inactive { background: #fee2e2; color: #991b1b; font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 20px; }
.badge-free     { background: #dbeafe; color: #1e40af; font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 20px; }
.badge-paid     { background: #fef3c7; color: #92400e; font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 20px; }
.badge-oauth    { background: #ede9fe; color: #5b21b6; font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 20px; }

/* ── Search Bar ─────────────────────────────────────── */
.search-bar {
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    padding-left: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff;
}

.search-bar input:focus {
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
    outline: none;
}

/* ── Pagination ─────────────────────────────────────── */
.pagination .page-link {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
    border-color: var(--border);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
}

/* ── Login Page ─────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

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

.login-card .login-brand img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.login-card .login-brand h4 {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
    margin: 0;
}

.login-card .login-brand p {
    color: #64748b;
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

/* ── Form controls ──────────────────────────────────── */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.btn-primary {
    background: var(--sidebar-active);
    border-color: var(--sidebar-active);
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* ── Avatar ─────────────────────────────────────────── */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-active);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Blog Editor ────────────────────────────────────── */
.blog-editor textarea {
    min-height: 320px;
    resize: vertical;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .page-content {
        padding: 1rem;
    }
}
