@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
    /* Exact Brand Palette */
    --brand-primary: #78563D;
    --brand-secondary: #D1CBB1;
    --brand-dark: #444638;
    --brand-light: #F9F8F5;

    /* Admin Dark Theme Surface Palette (Harmonized with #444638 & #78563D) */
    --bg-primary: #121410;
    --bg-surface: #191c17;
    --bg-surface-elevated: #22251e;
    --bg-surface-hover: #2a2e26;
    --bg-glass: rgba(25, 28, 23, 0.92);

    --border-color: rgba(209, 203, 177, 0.12);
    --border-subtle: rgba(209, 203, 177, 0.06);
    --border-strong: rgba(209, 203, 177, 0.22);
    --border-focus: #D1CBB1;

    --text-primary: #F9F8F5;
    --text-secondary: #D1CBB1;
    --text-muted: #8e9282;
    --text-dim: #5c6052;

    --primary: #78563D;
    --primary-hover: #8e674a;
    --primary-bg-subtle: rgba(120, 86, 61, 0.18);
    --primary-border-subtle: rgba(120, 86, 61, 0.38);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --success-border: rgba(16, 185, 129, 0.2);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --warning-border: rgba(245, 158, 11, 0.2);

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.08);
    --danger-border: rgba(239, 68, 68, 0.2);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.45);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.08);

    /* Compact, High-Density Pro Scaling (prevents zoomed-in look) */
    --sidebar-width: 230px;
    --topbar-height: 54px;
    --font-base: 13.5px;
    --transition-fast: 0.12s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-base);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-secondary);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 26px;
    height: 26px;
    background: #2563eb;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: var(--shadow-inset);
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.brand-badge {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 4px;
    background: var(--primary-bg-subtle);
    color: #93c5fd;
    border: 1px solid var(--primary-border-subtle);
    border-radius: 3px;
    margin-left: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-title {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 10px 4px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.83rem;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.nav-item.active {
    background: var(--bg-surface-elevated);
    color: #fff;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.nav-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    color: #60a5fa;
}

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

/* Main Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-primary);
}

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

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

.topbar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px 3px 4px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.1;
}

.user-role {
    font-size: 0.64rem;
    color: var(--text-muted);
}

/* Page Content */
.page-content {
    padding: 22px 24px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-title {
    font-size: 1.35rem;
    font-weight: 700;
}

.page-header-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 1px;
}

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}

.card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
}

.card-body {
    padding: 16px;
}

/* Stat Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-strong);
}

.stat-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    font-family: 'Outfit', sans-serif;
}

.stat-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 16px;
    height: 16px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.form-label .required-mark {
    color: var(--danger);
    margin-left: 2px;
}

.form-control,
.form-select {
    width: 100%;
    padding: 7px 10px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    background-color: var(--bg-surface-elevated);
}

.form-control::placeholder {
    color: var(--text-dim);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

.form-check-input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.field-validation-error {
    color: var(--danger);
    font-size: 0.74rem;
    margin-top: 3px;
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.2;
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background-color: #2563eb;
    color: #fff;
    border-color: #1d4ed8;
    box-shadow: var(--shadow-inset);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    color: #fff;
}

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

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-strong);
    color: #fff;
}

.btn-danger {
    background-color: #dc2626;
    color: #fff;
    border-color: #b91c1c;
}

.btn-danger:hover {
    background-color: #b91c1c;
    color: #fff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-sm svg {
    width: 12px;
    height: 12px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.badge-draft {
    background-color: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-published {
    background-color: var(--success-bg);
    color: #34d399;
    border: 1px solid var(--success-border);
}

.badge-archived {
    background-color: var(--warning-bg);
    color: #fbbf24;
    border: 1px solid var(--warning-border);
}

.badge::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 9px 12px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.82rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.table-title-cell {
    color: #fff !important;
    font-weight: 600;
}

/* Thumbnail in Tables */
.table-thumb {
    width: 52px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    display: block;
}

.table-thumb-placeholder {
    width: 52px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.table-thumb-placeholder svg {
    width: 16px;
    height: 16px;
}

/* Tag Pills & Interactive Tag Chips */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 3px;
    /* background: var(--primary-bg-subtle);
    color: #93c5fd;
    border: 1px solid var(--primary-border-subtle); */
    /* background: var(--primary-bg-subtle); */
    color: var(--brand-secondary);
    /* border-color: var(--primary-border-subtle); */
    font-size: 0.68rem;
    font-weight: 500;
    margin: 1px;
}

.tag-chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 38px;
    transition: all var(--transition-fast);
}

.tag-chips-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-bg-subtle);
    color: #bfdbfe;
    border: 1px solid var(--primary-border-subtle);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.74rem;
    font-weight: 500;
}

.tag-chip-remove {
    cursor: pointer;
    color: #93c5fd;
    font-size: 0.85rem;
    line-height: 1;
    font-weight: bold;
    transition: color var(--transition-fast);
}

.tag-chip-remove:hover {
    color: #f87171;
}

.tag-chip-input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    color: var(--text-primary);
    flex: 1;
    min-width: 90px;
    font-size: 0.8rem;
    padding: 1px 3px;
}

/* Character Counter */
.char-counter {
    display: flex;
    justify-content: flex-end;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.char-counter.warning {
    color: var(--warning);
}

.char-counter.danger {
    color: var(--danger);
}

/* Reading Time Badge */
.read-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* Collapsible SEO Box */
.collapsible-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    margin-top: 16px;
    overflow: hidden;
}

.collapsible-trigger {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-surface);
    border: none;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: left;
    transition: background-color var(--transition-fast);
}

.collapsible-trigger:hover {
    background-color: var(--bg-surface-hover);
}

.collapsible-content {
    padding: 14px;
    border-top: 1px solid var(--border-color);
    display: none;
}

.collapsible-box.open .collapsible-content {
    display: block;
}

/* Image Preview */
.image-preview-box {
    width: 100%;
    max-height: 180px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-surface-elevated);
    margin-top: 6px;
}

.image-preview-box img {
    max-width: 100%;
    max-height: 180px;
    object-fit: cover;
}

.image-preview-placeholder {
    color: var(--text-muted);
    font-size: 0.76rem;
    padding: 18px;
    text-align: center;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    box-shadow: var(--shadow-lg);
    color: #fff;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 280px;
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-danger {
    border-left-color: var(--danger);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 16px;
    justify-content: flex-end;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
}

.page-link:hover {
    color: #fff;
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

.page-link.active {
    background: #2563eb;
    color: #fff;
    border-color: #1d4ed8;
}

.page-link.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 16px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.45;
}

.modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 30px 26px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 22px;
}

.login-brand-icon {
    width: 38px;
    height: 38px;
    background: #2563eb;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0 auto 12px auto;
}

.login-title {
    font-size: 1.25rem;
    margin-bottom: 3px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* Quill Editor Scaling */
.ql-toolbar.ql-snow {
    background: var(--bg-surface-elevated) !important;
    border-color: var(--border-color) !important;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    padding: 6px 8px !important;
}

.ql-toolbar .ql-stroke {
    stroke: var(--text-secondary) !important;
}

.ql-toolbar .ql-fill {
    fill: var(--text-secondary) !important;
}

.ql-toolbar .ql-picker {
    color: var(--text-secondary) !important;
}

.ql-container.ql-snow {
    background: var(--bg-surface-elevated) !important;
    border-color: var(--border-color) !important;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    color: var(--text-primary) !important;
    font-family: inherit !important;
    min-height: 280px;
    font-size: 0.88rem;
}