/* 
  Influencer News - Admin Panel Styles
  Dark Theme & Responsive
*/

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Colors - Friendly Dark Admin */
    --primary-red: #e50914;
    --primary-hover: #ff0000;
    --bg-dark: #121212; /* Material Dark */
    --bg-card: #1e1e1e; /* Elevated Surface */
    --bg-header: #1e1e1e;
    --bg-sidebar: #121212;
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --border-color: #333333;

    /* Functional Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* UI Elements - SOFT */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
    --sidebar-width: 260px;
}

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

body {
    font-family: "Poppins", sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Arabic Font Support */
[lang="ar"] {
    font-family: "Cairo", sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
}

/* =========================================
   2. UTILITIES & BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 14px;
    gap: 8px;
    transition: 0.2s;
}

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

.btn-secondary {
    background-color: #333;
    color: white;
}
.btn-secondary:hover {
    background-color: #444;
}

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

.badge {
    background-color: var(--primary-red);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
}

/* =========================================
   3. LOGIN PAGE
   ========================================= */
.admin-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
        url("https://picsum.photos/seed/adminbg/1920/1080");
    background-size: cover;
    background-position: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-md);
}

.login-card {
    background-color: white; /* Contrast for Login like spec? Spec said dark bg white card */
    /* Wait, spec said: Dark background (#1a1a1a), White card in center */
    /* Let's stick to spec */
    background-color: #ffffff;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: #333; /* Dark text on white card */
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: var(--spacing-xs);
    color: #1a1a1a;
}

.login-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-md);
    text-align: left;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: 0.2s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.1);
}

#login-btn {
    width: 100%;
    background-color: var(--primary-red);
    color: white;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

#login-btn:hover {
    background-color: var(--primary-hover);
}

.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: var(--spacing-md);
    min-height: 20px;
}

/* =========================================
   4. ADMIN DASHBOARD LAYOUT
   ========================================= */
.admin-dashboard {
    overflow: hidden; /* Prevent body scroll, layout handles it */
}

.admin-header {
    height: 60px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    flex-shrink: 0;
}

.admin-header .logo {
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 14px;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.btn-logout:hover {
    color: white;
    border-color: white;
}

.admin-layout {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding-top: var(--spacing-md);
    flex-shrink: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    position: relative; /* Ensure stacking context */
    z-index: 10; /* Lower than header but higher than content */
}

.nav-item {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.nav-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--primary-red);
    background-color: rgba(229, 9, 20, 0.1);
    font-weight: 600;
    border-right: 3px solid var(--primary-red);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.admin-content {
    flex-grow: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
    background-color: var(--bg-dark);
}

.content-section {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.section-title {
    font-size: 24px;
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

/* =========================================
   5. DASHBOARD WIDGETS
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background-color: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border: 1px solid var(--border-color);
}

.stat-card.warning {
    border-color: rgba(241, 196, 15, 0.3);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-red);
}

.stat-info .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================
   6. FORMS
   ========================================= */
.admin-form {
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.form-col {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 13px;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: white;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-red);
}

.form-actions {
    margin-top: var(--spacing-lg);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    background-color: rgba(0, 0, 0, 0.2);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-area:hover {
    border-color: var(--primary-red);
    background-color: rgba(229, 9, 20, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    gap: 8px;
}

.upload-placeholder i {
    font-size: 32px;
    margin-bottom: 8px;
}

.upload-preview {
    width: 100%;
    height: 100%;
    position: relative;
}

.upload-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    margin: 0 auto;
}

.remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--primary-red);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

/* =========================================
   7. MANAGE POSTS TABLE (DATA GRID)
   ========================================= */
/* =========================================
   7. MANAGE POSTS TABLE (CLEAN LIST)
   ========================================= */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    background: transparent;
    padding: 0;
    border: none;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
    min-width: 600px; /* Prevent crushing on small screens */
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.data-table td {
    font-size: 14px;
    color: var(--text-main);
    vertical-align: middle;
}

/* Image Column */
.table-img-wrapper {
    width: 64px;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: #333;
}

.table-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-img-wrapper {
    width: 60px;
    height: 40px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-delete:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* =========================================
   8. MODERATION & REPORTS
   ========================================= */
.reports-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.report-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.report-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    font-size: 12px;
    color: var(--text-muted);
}

.report-reason {
    color: var(--danger);
    font-weight: bold;
    text-transform: uppercase;
}

.reported-comment {
    background-color: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-sm);
    border-left: 3px solid var(--border-color);
    margin: var(--spacing-sm) 0;
    font-style: italic;
}

.report-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

/* =========================================
   9. MODALS & TOASTS
   ========================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border-color);
}

.modal-actions {
    margin-top: var(--spacing-lg);
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    transform: translateY(100px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    border-left: 4px solid var(--success);
}
.toast.error {
    border-left: 4px solid var(--danger);
}

/* =========================================
   10. RESPONSIVE
   ========================================= */
/* =========================================
   10. RESPONSIVE (Off-Canvas Sidebar)
   ========================================= */
@media (max-width: 768px) {
    .admin-layout {
        position: relative;
    }

    .admin-header {
        padding: 0 var(--spacing-md);
    }

    .sidebar {
        position: fixed;
        left: -100%; /* Hidden by default */
        top: 60px; /* Below header */
        width: 100%; /* Full width on mobile or 80% */
        height: calc(100vh - 60px);
        background-color: var(--bg-dark); /* Match background */
        border-right: none;
        z-index: 100;
        display: flex; /* Always flex */
        flex-direction: column;
        padding-top: 0;
        transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0; /* Slide in */
    }

    .nav-item {
        padding: 20px var(--spacing-lg); /* Larger touch targets */
        font-size: 16px;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
        justify-content: flex-start;
    }

    .nav-item.active {
        border-right: none;
        border-left: 4px solid var(--primary-red);
        background-color: rgba(255, 255, 255, 0.03);
    }

    /* Form Grid -> Stack */
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Table Responsive - Card View for Mobile (Clean) */
    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        display: flex;
        flex-direction: column;
        background-color: var(--bg-card);
        border: 1px solid var(--border-color);
        margin-bottom: var(--spacing-md);
        padding: var(--spacing-md);
        border-radius: var(--radius-md); /* Soft corners */
        box-shadow: var(--shadow-card); /* Soft shadow */
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-size: 14px;
    }

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

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.5px;
        margin-right: 12px;
    }

    /* Image in Mobile Card */
    .data-table td:first-child {
        justify-content: center;
        margin-bottom: 12px;
        border-bottom: none;
    }

    .table-img-wrapper {
        width: 100%;
        height: 180px; /* Large hero preview on mobile card */
        border-radius: var(--radius-md);
    }
}

/* =========================================
   11. ANALYTICS
   ========================================= */
.analytics-wrapper {
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
}

.analytics-list {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-top: var(--spacing-sm);
}

.analytics-item {
    display: flex;
    align-items: center;
    padding: 12px var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.analytics-item:last-child {
    border-bottom: none;
}

.analytics-item .rank {
    width: 30px;
    font-weight: bold;
    color: var(--text-muted);
}

.analytics-item .post-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: var(--spacing-md);
    font-weight: 500;
}

.analytics-item .post-views,
.analytics-item .post-comments {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

/* =========================================
   12. LIGHT MODE THEME
   ========================================= */
[data-theme="light"] {
    --bg-dark: #f5f5f5;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-sidebar: #fafafa;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .form-group input[type="text"],
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .settings-input {
    background-color: #f9f9f9;
    color: #1a1a1a;
    border-color: #d0d0d0;
}

[data-theme="light"] .nav-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: #1a1a1a;
}

[data-theme="light"] .data-table th {
    background-color: #f0f0f0;
    color: #555;
}

[data-theme="light"] .data-table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .btn-secondary {
    background-color: #e0e0e0;
    color: #1a1a1a;
}

[data-theme="light"] .btn-icon {
    background: rgba(0, 0, 0, 0.05);
    color: #555;
}

/* =========================================
   13. HEADER RIGHT (THEME TOGGLE)
   ========================================= */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 14px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 15px;
}

.btn-icon:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* =========================================
   14. BILINGUAL EDITOR
   ========================================= */
.bilingual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.lang-col {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

[data-theme="light"] .lang-col {
    background: #f9f9f9;
}

.lang-col-header {
    margin-bottom: 4px;
}

.lang-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.lang-badge.en {
    background: rgba(33, 150, 243, 0.15);
    color: #64b5f6;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.lang-badge.ar {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.form-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: var(--spacing-md);
    align-items: end;
    margin-bottom: var(--spacing-md);
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

[data-theme="light"] .form-settings-row {
    background: #f5f5f5;
}

/* Featured Toggle */
.featured-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Featured Segmented Button Specifics ── */
#feat-featured.active {
    background-color: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
    color: #ffd700;
}

/* Toggle Switch Styles Removed (Replaced by Segmented Button) */
.toggle-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Outline button */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    gap: 8px;
    display: inline-flex;
    align-items: center;
    transition: 0.2s;
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* =========================================
   15. CATEGORIES SECTION
   ========================================= */
.form-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.form-panel h3 {
    margin-bottom: var(--spacing-md);
    font-size: 16px;
}

.compact-form {
    background: transparent;
    border: none;
    padding: 0;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.color-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-picker-row input[type="color"] {
    width: 44px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    padding: 2px;
}

.color-picker-row input[type="text"] {
    flex: 1;
}

.color-swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.actions-cell {
    display: flex;
    gap: 6px;
}

.text-center {
    text-align: center;
}
.text-muted {
    color: var(--text-muted);
}

code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

[data-theme="light"] code {
    background: rgba(0, 0, 0, 0.06);
}

/* =========================================
   16. POST STATS SECTION
   ========================================= */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.sort-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    color: var(--text-main);
}

.sortable.sort-active {
    color: var(--primary-red);
}

.stat-bar-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
}

.stat-number {
    font-weight: 600;
    font-size: 14px;
}

.mini-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

[data-theme="light"] .mini-bar {
    background: rgba(0, 0, 0, 0.1);
}

.mini-bar-fill {
    height: 100%;
    background: var(--primary-red);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.engagement-score {
    font-size: 13px;
    color: var(--text-muted);
}

.post-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
}

.post-link:hover {
    color: var(--primary-red);
}

.post-title-cell {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================
   17. FEED SETTINGS PANEL
   ========================================= */
.settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.settings-panel h3 {
    font-size: 16px;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.settings-row {
    max-width: 500px;
}

.settings-input-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    margin-top: var(--spacing-sm);
}

.settings-input {
    width: 80px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary-red);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

/* =========================================
   18. RESPONSIVE — NEW COMPONENTS
   ========================================= */
@media (max-width: 900px) {
    .bilingual-grid {
        grid-template-columns: 1fr;
    }

    .form-settings-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .form-settings-row {
        grid-template-columns: 1fr;
    }

    .form-row-3,
    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .sort-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================
   SEGMENTED BUTTON (Status Selector)
   ========================================= */
.segmented-btn {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: 100%;
}

.seg-btn {
    flex: 1;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--border-color);
    font-family: inherit;
}

.seg-btn:last-child {
    border-right: none;
}

.seg-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.seg-btn.active {
    background: var(--primary-red);
    color: #fff;
}

/* Published = green active */
#status-published.active {
    background: #1a7a1a;
}
/* Draft = amber active */
#status-draft.active {
    background: #7a5a00;
}
/* Archived = gray active */
#status-archived.active {
    background: #444;
}

/* =========================================
   19. NEW POST EDITOR (two-panel layout)
   ========================================= */

/* ── Layout ── */
.editor-layout {
    display: flex;
    gap: 32px; /* Increased from 24px */
    align-items: flex-start;
    width: 100%;
}

.editor-left {
    flex: 0 0 60%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px; /* Increased from 20px */
    padding-bottom: 80px;
}

.editor-right {
    flex: 0 0 38%;
    position: sticky;
    top: 80px;
    min-width: 0;
}

/* ── Language Tabs ── */
.lang-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
}

.lang-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    border-radius: 6px 6px 0 0;
}

.lang-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}
.lang-tab.active {
    color: var(--primary-red);
    border-bottom-color: var(--primary-red);
}

/* ── Editor Title Input ── */
.editor-title-input {
    width: 100%;
    font-size: 22px;
    font-weight: 700;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border-color);
    border-radius: 0;
    color: var(--text-main);
    padding: 8px 0;
    outline: none;
    transition: border-color 0.2s;
}
.editor-title-input:focus {
    border-bottom-color: var(--primary-red);
}

.editor-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

/* ── Excerpt with Char Counter ── */
.excerpt-wrap {
    position: relative;
}
.excerpt-wrap textarea {
    width: 100%;
    padding-bottom: 24px;
}
.char-counter {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Toolbar ── */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-color);
}
.toolbar-btn.active {
    background: rgba(229, 9, 20, 0.15);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

/* ── Body Editor ── */
.body-editor {
    width: 100%;
    min-height: 300px;
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    resize: vertical;
    line-height: 1.6;
}

.body-preview {
    min-height: 300px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.7;
}

/* ── Image Upload Zone ── */
.image-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}
.image-upload-zone:hover,
.image-upload-zone.dragover {
    border-color: var(--primary-red);
    background: rgba(229, 9, 20, 0.04);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    padding: 24px;
    text-align: center;
    cursor: pointer;
}
.upload-placeholder i {
    font-size: 32px;
    opacity: 0.5;
}
.upload-placeholder p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}
.upload-placeholder span {
    font-size: 12px;
    opacity: 0.6;
}

.upload-preview {
    width: 100%;
    height: 100%;
    position: relative;
}
.upload-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Image URL Row ── */
.image-url-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.image-url-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.image-url-row input {
    flex: 1;
    font-size: 13px;
    padding: 6px 10px;
}

/* ── Crop Zone ── */
.crop-zone {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

#crop-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

.crop-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.crop-preset-btn {
    flex: 1;
    min-width: 100px;
    padding: 7px 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.crop-preset-btn:hover,
.crop-preset-btn.active {
    border-color: var(--primary-red);
    color: var(--primary-red);
    background: rgba(229, 9, 20, 0.08);
}

.crop-final-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}
.crop-final-preview img {
    max-width: 120px;
    max-height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* ── Post Settings Grid ── */
.post-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px; /* Increased from 20px for breathing room */
}

/* ── Category Select with Swatch ── */
.category-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cat-swatch-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #888;
    flex-shrink: 0;
    display: inline-block;
}
.category-select-wrap select {
    flex: 1;
}

/* ── Featured Toggle Row ── */
.featured-toggle-group .editor-label {
    margin-bottom: 12px; /* Extra breathing room for the toggle */
}

.featured-toggle-row {
    display: flex;
    align-items: center;
    gap: 16px; /* Increased from 10px */
    padding-top: 4px; /* Slight offset to align with inputs */
}

.toggle-hint {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Hero Style Grid ── */
.hero-style-group {
    grid-column: 1 / -1;
}

.hero-style-option {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.hero-style-option:hover {
    border-color: rgba(229, 9, 20, 0.4);
    background: rgba(229, 9, 20, 0.04);
}
.hero-style-option.selected {
    border-color: var(--primary-red);
    background: rgba(229, 9, 20, 0.08);
    color: var(--primary-red);
}

.hero-style-preview {
    width: 100%;
    height: 44px;
    border-radius: 6px;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
}

.hs-standard {
    background: linear-gradient(to bottom, #2a2a2a 60%, #1a1a1a 100%);
}
.hs-standard::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}
.hs-compact {
    background: linear-gradient(to bottom, #2a2a2a 40%, #1a1a1a 100%);
}
.hs-compact::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%;
    background: rgba(0, 0, 0, 0.6);
}
.hs-blur {
    background: #2a2a2a;
    filter: blur(1px);
}
.hs-square {
    background: #2a2a2a;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    margin: 0 auto;
}

/* ── Sticky Action Bar ── */
.editor-sticky-bar {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 50;
    border-radius: 0 0 12px 12px;
}
.editor-sticky-bar .btn {
    flex: 1;
    justify-content: center;
}

/* ── Preview Panel ── */
.preview-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.preview-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.preview-tab {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.preview-tab.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.preview-view {
    min-height: 200px;
    max-height: calc(100vh - 200px); /* Keep it within view */
    overflow-y: auto; /* Scroll internally */
    padding-right: 4px; /* Space for scrollbar */
}
/* Custom Scrollbar for Preview */
.preview-view::-webkit-scrollbar {
    width: 6px;
}
.preview-view::-webkit-scrollbar-track {
    background: transparent;
}
.preview-view::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* ── Image Mini Modal ── */
#img-mini-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ── Mobile: stack panels ── */
@media (max-width: 900px) {
    .editor-layout {
        flex-direction: column;
    }
    .editor-left, .editor-right {
        flex: none;
        width: 100%;
    }
    .editor-right {
        position: static;
    }
    .post-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Light Mode Overrides ── */
[data-theme="light"] .toolbar {
    background: #f5f5f5;
    border-color: #ddd;
}
[data-theme="light"] .toolbar-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .image-upload-zone {
    border-color: #ccc;
}
[data-theme="light"] .image-upload-zone:hover,
[data-theme="light"] .image-upload-zone.dragover {
    border-color: var(--primary-red);
    background: rgba(229, 9, 20, 0.03);
}
[data-theme="light"] .crop-zone {
    background: #f9f9f9;
    border-color: #ddd;
}
[data-theme="light"] .crop-preset-btn {
    background: #fff;
    border-color: #ccc;
    color: #555;
}
[data-theme="light"] .hero-style-option {
    border-color: #ddd;
    color: #555;
}
[data-theme="light"] .hero-style-option.selected {
    border-color: var(--primary-red);
    background: rgba(229, 9, 20, 0.06);
    color: var(--primary-red);
}
[data-theme="light"] .preview-panel {
    background: #fff;
    border-color: #e0e0e0;
}
[data-theme="light"] .preview-toggle {
    background: #f0f0f0;
}
[data-theme="light"] .preview-tab.active {
    background: #fff;
    color: #111;
}
[data-theme="light"] .editor-sticky-bar {
    background: #fff;
    border-color: #e0e0e0;
}
[data-theme="light"] .lang-tab {
    color: #777;
}
[data-theme="light"] .lang-tab:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #333;
}
[data-theme="light"] .hs-standard,
[data-theme="light"] .hs-compact {
    background: linear-gradient(to bottom, #ddd 60%, #bbb 100%);
}
[data-theme="light"] .hs-blur,
[data-theme="light"] .hs-square {
    background: #ccc;
}
