/* =============================================================================
   ContentGen — Shared Stylesheet
   Covers all views: auth, dashboard, admin (users/queue/analytics), content
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Design Tokens
   --------------------------------------------------------------------------- */
:root {
    --color-primary: #FF6B00;
    --color-primary-dark: #E55D00;
    --color-gradient: linear-gradient(135deg, #FF6B00 0%, #FF8C00 50%, #FF6B00 100%);
    --color-danger: #dc3545;
    --color-danger-alt: #ef4444;
    --color-success: #166534;
    --color-success-bg: #d1fae5;
    --color-warning-bg: #fff3cd;
    --color-border: #e1e4e8;
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-muted: #6c757d;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ---------------------------------------------------------------------------
   Reset
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---------------------------------------------------------------------------
   Base Body
   Default: app shell (main.php layout).
   Auth views override with gradient background via .auth-body.
   Content/compare/edit views override with gradient background via .content-body-bg.
   --------------------------------------------------------------------------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

/* Auth pages: full-screen gradient centering */
body.auth-body {
    background: linear-gradient(135deg, #FFE0C2 0%, #FFD1A3 30%, #FFBC80 70%, #FFA654 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Content/edit/compare/index pages: gradient background with padding */
body.content-body-bg {
    background: linear-gradient(135deg, #FFE0C2 0%, #FFD1A3 30%, #FFBC80 70%, #FFA654 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Analytics page uses a light gray body variant */
body.analytics-body {
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   Accessibility
   --------------------------------------------------------------------------- */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.skip-nav {
    position: absolute;
    left: -9999px;
}

.skip-nav:focus {
    position: static;
}

/* ---------------------------------------------------------------------------
   Site Header & Navigation
   --------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
}

/* --- Left group: brand + links --- */
.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-right: 16px;
    flex-shrink: 0;
}

.nav-brand:hover {
    text-decoration: none;
}

.nav-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--color-gradient);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    border-radius: 8px;
    letter-spacing: -0.5px;
}

.nav-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.3px;
}

/* --- Nav links --- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--color-primary);
    background: rgba(255, 107, 0, 0.08);
    text-decoration: none;
}

.nav-link.active {
    color: var(--color-primary);
    background: rgba(255, 107, 0, 0.1);
    font-weight: 600;
}

.nav-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link:hover svg,
.nav-link.active svg {
    opacity: 1;
}

/* --- Right group: user + logout --- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: 24px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-user:hover {
    background: rgba(255, 107, 0, 0.06);
    border-color: rgba(255, 107, 0, 0.15);
    text-decoration: none;
}

.nav-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    border-radius: 50%;
    flex-shrink: 0;
    letter-spacing: 0;
}

.nav-username {
    font-size: 13.5px;
    font-weight: 500;
    color: #374151;
}

.nav-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
    text-decoration: none;
}

/* --- Hamburger (hidden on desktop) --- */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px 6px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.nav-hamburger:hover {
    background: rgba(255, 107, 0, 0.08);
}

.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #64748b;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.nav-hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile responsive --- */
@media (max-width: 768px) {
    .site-nav {
        padding: 0 16px;
        height: 56px;
    }

    .nav-links {
        display: none !important;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        padding: 8px 16px 12px;
        gap: 2px;
        animation: navSlideDown 0.25s ease;
    }

    .nav-links.open {
        display: flex !important;
    }

    @keyframes navSlideDown {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .nav-link {
        width: 100%;
        padding: 10px 14px;
        border-radius: 8px;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-username {
        display: none;
    }

    .nav-brand {
        margin-right: 8px;
    }
}

/* Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------------------------
   Typography helpers
   --------------------------------------------------------------------------- */
h1 {
    font-size: 24px;
    color: #1a1a1a;
    margin-top: 0;
}

/* ---------------------------------------------------------------------------
   Links
   --------------------------------------------------------------------------- */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Layout helpers
   --------------------------------------------------------------------------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

/* When container-lg is inside the main shell, don't double-constrain it */
.main-shell .container-lg {
    max-width: none;
    padding: 0;
}

.container-sm {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

.container-lg {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.container-xl {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

/* Main layout shell (main.php) */
.main-shell {
    max-width: 1300px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.main-shell .container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
}

/* ---------------------------------------------------------------------------
   Auth card (login / register / change_password pages)
   --------------------------------------------------------------------------- */
.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    color: var(--color-primary);
    font-size: 32px;
    font-weight: 700;
}

.auth-logo p {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* Auth submit button (full-width) */
.auth-submit {
    width: 100%;
    padding: 14px;
    background: var(--color-gradient);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 0, 0.4);
}

.auth-submit:active {
    transform: translateY(0);
}

/* Info text paragraph below auth logo */
.auth-info-text {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Links section below auth form */
.auth-links {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.auth-links a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.auth-divider {
    text-align: center;
    margin: 15px 0;
    color: #999;
    font-size: 13px;
}

/* ---------------------------------------------------------------------------
   Password toggle (eye icon)
   --------------------------------------------------------------------------- */
.password-wrapper {
    position: relative;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    /* Reserve space on the right for the toggle button */
    padding-right: 44px;
}

/* Hide Edge's built-in password-reveal button to avoid a double eye icon */
.password-wrapper input::-ms-reveal {
    display: none;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    line-height: 1;
}

.password-toggle:hover {
    color: var(--color-primary);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Form Controls
   --------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

label,
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

/* Standard form control used across auth + profile */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    color: #2d3748;
    font-family: inherit;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.25);
}

/* Suppress default outline only for pointer (mouse/touch) interaction;
   keyboard focus retains the global :focus-visible outline. */
.form-control:focus:not(:focus-visible),
input[type="text"]:focus:not(:focus-visible),
input[type="email"]:focus:not(:focus-visible),
input[type="password"]:focus:not(:focus-visible),
input[type="date"]:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

/* Admin form cards use slightly different border style */
.form-card .form-group input[type="text"],
.form-card .form-group input[type="email"],
.form-card .form-group input[type="password"],
.form-card .form-group select {
    border: 1px solid #cbd5e0;
    padding: 12px 15px;
    font-size: 14px;
}

.form-card .form-group input:focus,
.form-card .form-group select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

/* Textarea used in content editor */
.form-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Courier New', Courier, monospace;
    transition: border-color 0.2s;
    resize: vertical;
    min-height: 400px;
    line-height: 1.6;
}

.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.25);
}

.form-textarea:focus:not(:focus-visible) {
    outline: none;
}

.form-label {
    display: block;
    color: #374151;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.25);
}

.form-input:focus:not(:focus-visible) {
    outline: none;
}

/* File/number inputs in main shell */
input[type="file"],
input[type="number"] {
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: var(--radius);
}

/* Error message under form field */
.form-group .error-message,
.error-message {
    color: #e53e3e;
    font-size: 13px;
    margin-top: 5px;
}

.help-text {
    font-size: 13px;
    color: #718096;
    margin-top: 5px;
}

.required {
    color: #e53e3e;
    margin-left: 2px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 13px;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 0;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Checkbox used in login "remember me" */
.checkbox-group input {
    margin-right: 8px;
}

/* Form action row */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* ---------------------------------------------------------------------------
   Alerts / Messages
   --------------------------------------------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

/* Auth-style alerts (border-only) */
.alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Queue/profile alert-success variant */
.alert-success-light {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.alert-error-admin {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #7c5900;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

/* Content list/view/edit message banners */
.message {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* Info box (edit user, profile) */
.info-box {
    background-color: #ebf4ff;
    border-left: 4px solid var(--color-primary);
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 13px;
    color: #2c5282;
    margin-bottom: 20px;
}

/* Analytics alert variant (larger padding) */
.alert-analytics {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--color-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
    color: white;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

.btn-danger {
    background: var(--color-danger-alt);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Specific button variants from admin/users */
.btn-edit {
    background-color: var(--color-primary);
    color: white;
}

.btn-edit:hover {
    background-color: #FF8533;
    color: white;
}

.btn-toggle {
    background-color: #48bb78;
    color: white;
}

.btn-toggle:hover {
    background-color: #38a169;
    color: white;
}

.btn-toggle.inactive {
    background-color: #f56565;
}

.btn-toggle.inactive:hover {
    background-color: #e53e3e;
}

.btn-delete {
    background-color: #f56565;
    color: white;
}

.btn-delete:hover {
    background-color: #e53e3e;
    color: white;
}

/* Dashboard-specific buttons */
.btn-group {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

button.btn-start {
    background: linear-gradient(135deg, #FF6B00 0%, #FF8C00 100%);
    color: white;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(255, 107, 0, 0.3), 0 2px 4px -1px rgba(255, 107, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

button.btn-start:hover {
    background: linear-gradient(135deg, #E55D00 0%, #FF6B00 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(255, 107, 0, 0.4), 0 4px 6px -2px rgba(255, 107, 0, 0.1);
}

button.btn-start:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(255, 107, 0, 0.3);
}

button.btn-start:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

button.btn-stop {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3), 0 2px 4px -1px rgba(239, 68, 68, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

button.btn-stop:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4), 0 4px 6px -2px rgba(239, 68, 68, 0.1);
}

button.btn-stop:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

button.btn-reset {
    background: linear-gradient(135deg, #2d3436 0%, #1a1a2e 100%);
    color: white;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(45, 52, 54, 0.3), 0 2px 4px -1px rgba(45, 52, 54, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

button.btn-reset:hover {
    background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(45, 52, 54, 0.4), 0 4px 6px -2px rgba(45, 52, 54, 0.1);
}

button.btn-reset:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(45, 52, 54, 0.3);
}

button.btn-reset:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

button.btn-download {
    background: #0d5c22;
    color: white;
}

button.btn-download:hover {
    background: #0a461b;
}

/* Profile submit */
.btn-submit {
    background: var(--color-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 0, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ---------------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 14px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
}

tr:hover td {
    background: #f9fafb;
}

/* Users table — gradient header */
.users-table {
    width: 100%;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.users-table table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: var(--color-gradient);
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
    font-size: 14px;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tr:hover td {
    background-color: #f7fafc;
}

/* Queue workers table */
.workers-table {
    width: 100%;
    border-collapse: collapse;
}

.workers-table th,
.workers-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.workers-table th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 14px;
    color: #666;
}

.workers-table tbody tr:hover td {
    background: #fafafa;
}

/* Content list table */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.content-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.content-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #334155;
    vertical-align: middle;
    transition: background 0.15s ease;
}

.content-table tbody tr {
    transition: all 0.15s ease;
}

.content-table tbody tr:hover td {
    background: rgba(255, 107, 0, 0.04);
}

.content-table tbody tr:last-child td {
    border-bottom: none;
}

.content-table .title-cell {
    font-weight: 600;
    color: var(--color-primary);
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-table .title-cell:hover {
    color: var(--color-primary-dark);
}

.content-table .id-cell {
    color: #94a3b8;
    font-weight: 600;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.content-table .date-cell {
    color: #94a3b8;
    font-size: 13px;
    white-space: nowrap;
}

.content-table .wordcount-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: #475569;
}

/* Version history table */
.version-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.version-table th {
    background: #f9fafb;
    padding: 12px;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 14px;
}

.version-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

.version-table tr:hover td {
    background: #f9fafb;
}

.current-version {
    background: #ede9fe !important;
}

/* ---------------------------------------------------------------------------
   Navigation
   --------------------------------------------------------------------------- */

/* Main layout nav (main.php) */
.top-right {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 14px;
}

.top-right a {
    color: var(--color-primary);
    text-decoration: none;
    margin: 0 5px;
}

.top-right a:hover {
    text-decoration: underline;
}

.logout-link {
    color: #d93025;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #d93025;
    padding: 6px 12px;
    border-radius: 4px;
}

.logout-link:hover {
    background: #fee;
    color: #d93025;
    text-decoration: none;
}

.dashboard-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--color-primary);
    padding: 6px 12px;
    border-radius: 4px;
    margin-right: 10px;
}

.dashboard-link:hover {
    background: #f0f4ff;
    color: var(--color-primary);
    text-decoration: none;
}

/* Content/edit/view nav bar (white card on gradient background) */
.nav {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.nav-left {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.nav a.active {
    color: var(--color-primary-dark);
    font-weight: 600;
}

/* Analytics nav (different style — white bg, no border-radius card) */
.nav-analytics {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--color-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-primary);
    text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

/* Content view/edit card (rounded-lg, larger shadow) */
.content-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Admin form card */
.form-card {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Profile section */
.profile-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.profile-section h3 {
    color: #333;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.profile-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--color-gradient);
    margin-right: 12px;
    border-radius: 2px;
}

/* ---------------------------------------------------------------------------
   Page Headers
   --------------------------------------------------------------------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.page-header h1 {
    margin: 0;
    color: #2d3748;
    font-size: 28px;
}

.page-header .subtitle,
.subtitle {
    color: #718096;
    font-size: 14px;
    margin-top: 5px;
}

.user-count {
    color: #718096;
    font-size: 14px;
    margin-top: 5px;
}

.profile-header {
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.profile-header h2 {
    color: var(--color-primary);
    font-size: 28px;
    margin-bottom: 5px;
}

.profile-header .user-email {
    color: #666;
    font-size: 16px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 15px;
}

.content-header h1 {
    color: #0f172a;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.content-stats {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
}

/* Analytics header */
.analytics-header {
    margin-bottom: 2rem;
}

.analytics-header h1 {
    font-size: 2rem;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.analytics-header p {
    color: #718096;
    font-size: 1rem;
}

/* ---------------------------------------------------------------------------
   Badges and Status Indicators
   --------------------------------------------------------------------------- */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background-color: #c6f6d5;
    color: #22543d;
}

.status-inactive {
    background-color: #fed7d7;
    color: #742a2a;
}

/* Analytics status badges (full pill) */
.status-badge.healthy {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.warning {
    background: #feebc8;
    color: #7c2d12;
}

.status-badge.critical {
    background: #fed7d7;
    color: #742a2a;
}

.status-badge.pending,
.status-badge.processing,
.status-badge.completed,
.status-badge.failed {
    text-transform: capitalize;
    border-radius: 9999px;
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background-color: #e9d8fd;
    color: #44337a;
}

.role-admin {
    background-color: #fbb6ce;
    color: #702459;
}

/* Version badge */
.version-badge {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.3px;
}

.version-badge.older {
    background: #9ca3af;
}

/* Queue/analytics .badge */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fed7aa;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Worker badge (monospace) */
.worker-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--color-primary);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

/* Type badge (dashboard) */
.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: #0066cc;
    color: white;
}

.type-badge.faq {
    background: #9c36b5;
}

.type-badge.geo {
    background: #0d5c22;
}

.type-badge.cluster {
    background: #e67700;
}

.type-badge.short {
    background: #495057;
}

.type-badge.pr {
    background: #c92a2a;
}

.type-badge.long {
    background: #0066cc;
}

/* ---------------------------------------------------------------------------
   Stats / Stat Cards
   --------------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Colored left-border variants (queue stats) */
.stat-card.pending {
    border-left: 4px solid #ffa500;
}

.stat-card.processing {
    border-left: 4px solid var(--color-primary);
}

.stat-card.completed {
    border-left: 4px solid #22c55e;
}

.stat-card.failed {
    border-left: 4px solid var(--color-danger-alt);
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

/* Analytics stat card extras */
.stat-value.gradient {
    background: var(--color-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-subtext {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Dashboard-specific: progress bar, log, upload area, status grid
   --------------------------------------------------------------------------- */
#upload-area {
    margin-bottom: 20px;
}

.btn-group {
    margin-top: 15px;
}

#progress-area {
    margin-top: 30px;
    display: none;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

#progress-bar-container {
    width: 100%;
    background: #e9ecef;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
}

#progress-bar {
    height: 100%;
    background: #28a745;
    width: 0%;
    transition: width 0.3s;
    text-align: center;
    color: white;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
}

/* Dashboard status grid (4-column) */
.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 15px 0;
}

.status-card {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.status-card.active {
    background: #e7f5ff;
    border-color: #74c0fc;
}

.status-card .label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.status-card .value {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    word-break: break-word;
}

/* Log output (dark terminal) */
#log {
    margin-top: 15px;
    height: 300px;
    overflow-y: auto;
    background: #1e1e1e;
    color: #ddd;
    border-radius: var(--radius);
    padding: 15px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.log-error {
    color: #ff6b6b;
}

.log-success {
    color: #51cf66;
}

.log-info {
    color: #74c0fc;
}

.log-warn {
    color: #ffd43b;
}

.log-debug {
    color: #a5d8ff;
    font-style: italic;
}

/* Download box */
.download-box {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: #e6f4ea;
    border-radius: var(--radius);
    border: 1px solid #ceead6;
}

/* Current processing indicator */
#current-processing {
    background: var(--color-gradient);
    color: white;
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: none;
}

#current-processing .processing-label {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
}

#current-processing .processing-topic {
    font-size: 18px;
    font-weight: 600;
    margin: 5px 0;
}

#current-processing .processing-meta {
    font-size: 13px;
    opacity: 0.9;
}

#current-processing .processing-type {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

/* ---------------------------------------------------------------------------
   Profile: User info grid
   --------------------------------------------------------------------------- */
.user-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: var(--radius);
}

.info-item {
    padding: 12px;
    border-left: 3px solid var(--color-primary);
    background: #f8f9fa;
}

.info-item .label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-item .value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* ---------------------------------------------------------------------------
   Pagination
   --------------------------------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--radius);
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 14px;
}

.pagination a {
    background-color: #fff;
    border: 1px solid #e2e8f0;
}

.pagination a:hover {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    text-decoration: none;
}

.pagination .current,
.pagination .active {
    background: var(--color-gradient);
    color: white;
    font-weight: 600;
    border: 1px solid var(--color-primary);
}

.pagination .disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
   Actions column
   --------------------------------------------------------------------------- */
.actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

.actions span {
    display: none;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    color: var(--color-primary);
    background: rgba(102, 126, 234, 0.08);
}

.action-link:hover {
    color: white;
    background: var(--color-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.action-link.delete {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.action-link.delete:hover {
    color: white;
    background: #dc2626;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

/* ---------------------------------------------------------------------------
   Empty State
   --------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #4a5568;
}

.empty-state h2 {
    color: #6b7280;
    font-size: 24px;
    margin-bottom: 10px;
}

.empty-state p {
    color: #9ca3af;
    font-size: 16px;
}

.empty-state svg {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #a0aec0;
}

/* ---------------------------------------------------------------------------
   Analytics-specific: charts, health grid, export form
   --------------------------------------------------------------------------- */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    color: #1a202c;
    margin-bottom: 1rem;
    font-weight: 600;
}

.card-title {
    font-size: 1.125rem;
    color: #1a202c;
    margin-bottom: 1rem;
    font-weight: 600;
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.health-item {
    padding: 1rem;
    background: #f7fafc;
    border-radius: var(--radius);
    border-left: 4px solid var(--color-primary);
}

.health-label {
    font-size: 0.875rem;
    color: #718096;
    margin-bottom: 0.25rem;
}

.health-value {
    font-size: 1.25rem;
    color: #1a202c;
    font-weight: 600;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #718096;
}

.chart-error {
    color: #e53e3e;
    text-align: center;
    padding: 2rem;
}

canvas {
    max-height: 300px;
}

.export-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

/* ---------------------------------------------------------------------------
   Content view: info-box, content-display (monospace), content-body section
   --------------------------------------------------------------------------- */
/* (Note: .info-box is also used in admin/users/edit; the blue accent version
   is defined above. The content/view.php info-box below is a different layout) */
.content-info-box {
    background: #f9fafb;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-label {
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    color: #1f2937;
    font-size: 16px;
    font-weight: 500;
}

.content-display {
    background: #f9fafb;
    border-radius: var(--radius);
    padding: 25px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #1f2937;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
}

/* Rich HTML prose display (overrides monospace for WYSIWYG content) */
.content-display.content-prose {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.75;
    white-space: normal;
    max-height: none;
}

.content-prose h1,
.content-prose h2,
.content-prose h3,
.content-prose h4 {
    color: #111827;
    margin: 1.2em 0 0.5em;
    line-height: 1.3;
}

.content-prose h1 {
    font-size: 1.75em;
}

.content-prose h2 {
    font-size: 1.45em;
}

.content-prose h3 {
    font-size: 1.2em;
}

.content-prose h4 {
    font-size: 1.05em;
}

.content-prose p {
    margin: 0 0 1em;
}

.content-prose ul,
.content-prose ol {
    padding-left: 1.5em;
    margin: 0 0 1em;
}

.content-prose li {
    margin-bottom: 0.3em;
}

.content-prose blockquote {
    border-left: 4px solid #667eea;
    margin: 1em 0;
    padding: 0.5em 1em;
    background: #f3f4ff;
    color: #374151;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.content-prose a {
    color: #667eea;
    text-decoration: underline;
}

.content-prose a:hover {
    color: #5a67d8;
}

.content-prose code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', Courier, monospace;
}

.content-prose pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1em 0;
}

.content-prose pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.content-prose table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.content-prose table td,
.content-prose table th {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
}

.content-prose table th {
    background: #f9fafb;
    font-weight: 600;
}

.content-prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.content-body-section {
    margin-bottom: 30px;
}

.content-body-section h2 {
    color: #374151;
    font-size: 20px;
    margin-bottom: 15px;
}

.version-history {
    margin-bottom: 30px;
}

.version-history h2 {
    color: #374151;
    font-size: 20px;
    margin-bottom: 15px;
}

/* ---------------------------------------------------------------------------
   Content edit: counter info, preview, unsaved indicator
   --------------------------------------------------------------------------- */
.counter-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: var(--radius);
    margin-top: 10px;
    font-size: 14px;
    color: #6b7280;
}

.counter-info strong {
    color: var(--color-primary);
}

.preview-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.preview-header h2 {
    color: #374151;
    font-size: 20px;
}

.preview-toggle {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.preview-toggle:hover {
    background: #e5e7eb;
}

.preview-content {
    background: #f9fafb;
    border-radius: var(--radius);
    padding: 25px;
    border: 1px solid #e5e7eb;
    min-height: 200px;
    line-height: 1.8;
    color: #1f2937;
    display: none;
}

.preview-content.show {
    display: block;
}

.preview-content h1 {
    font-size: 28px;
    margin-bottom: 15px;
}

.preview-content h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.preview-content h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.preview-content p {
    margin-bottom: 15px;
}

.unsaved-indicator {
    display: none;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    margin-left: 10px;
}

.unsaved-indicator.show {
    display: inline;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   Content compare: side-by-side layout
   --------------------------------------------------------------------------- */
.compare-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.version-column {
    background: #f9fafb;
    border-radius: var(--radius-lg);
    padding: 25px;
    border: 2px solid #e5e7eb;
}

.version-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.version-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.version-title h2 {
    color: #1f2937;
    font-size: 20px;
}

.version-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.version-meta-item {
    display: flex;
    justify-content: space-between;
}

.version-meta-label {
    font-weight: 600;
}

.version-content {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #1f2937;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
}

.version-content p {
    margin-bottom: 15px;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.version-content p.different {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
}

.version-content p.added {
    background: #d1fae5;
    border-left: 3px solid #10b981;
}

.version-content p.removed {
    background: #fee2e2;
    border-left: 3px solid #ef4444;
}

.legend {
    display: flex;
    gap: 20px;
    padding: 15px 20px;
    background: #f9fafb;
    border-radius: var(--radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.legend-color.different {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
}

.legend-color.added {
    background: #d1fae5;
    border-left: 3px solid #10b981;
}

.legend-color.removed {
    background: #fee2e2;
    border-left: 3px solid #ef4444;
}

/* ---------------------------------------------------------------------------
   Search form (content/index.php)
   --------------------------------------------------------------------------- */
.search-form {
    margin-bottom: 28px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 11px 18px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.2s ease;
    background: #f8fafc;
    color: #334155;
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-input:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: #fff;
}

.search-input:focus:not(:focus-visible) {
    outline: none;
}

/* ---------------------------------------------------------------------------
   Queue: actions bar, spinner, refresh-notice
   --------------------------------------------------------------------------- */
.queue-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.refresh-notice {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

/* ---------------------------------------------------------------------------
   Spinners / Loading
   --------------------------------------------------------------------------- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

/* Analytics spinner (larger) */
.spinner-lg {
    border: 3px solid #e2e8f0;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 0.5rem;
}

/* Content view/regenerate button spinner */
.spinner-btn {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 10px;
}

.btn-loading .spinner-btn {
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .compare-container {
        grid-template-columns: 1fr;
    }

    .version-column {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .container-sm {
        padding: 10px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .users-table {
        overflow-x: auto;
    }

    .users-table table {
        min-width: 800px;
    }

    .form-card {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-table {
        font-size: 14px;
    }

    .content-table th,
    .content-table td {
        padding: 10px 8px;
    }

    .actions {
        flex-direction: column;
        gap: 5px;
    }

    .content-info-box {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .counter-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .legend {
        flex-direction: column;
        gap: 10px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Upload Zone */
.upload-zone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--color-primary);
    background: rgba(102, 126, 234, 0.04);
}

.upload-zone-content p {
    margin: 4px 0;
}

/* ---------------------------------------------------------------------------
   SweetAlert2 — custom theme (cgAlert / cgConfirm)
   --------------------------------------------------------------------------- */
.cg-swal-popup {
    border-radius: 18px !important;
    font-family: inherit !important;
    padding: 2rem !important;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.18) !important;
    border: 1px solid rgba(102, 126, 234, 0.12) !important;
}

.cg-swal-popup .swal2-title {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    padding: 0 !important;
    margin-bottom: 0.5rem !important;
}

.cg-swal-popup .swal2-html-container {
    font-size: 0.95rem !important;
    color: #4a5568 !important;
    margin: 0.5rem 0 1.25rem !important;
    line-height: 1.6 !important;
}

.cg-swal-popup .swal2-icon {
    margin: 0 auto 1rem !important;
    width: 56px !important;
    height: 56px !important;
}

.cg-swal-popup .swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}

.cg-swal-popup .swal2-icon.swal2-question {
    border-color: #667eea !important;
    color: #667eea !important;
}

.cg-swal-popup .swal2-icon.swal2-success {
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.cg-swal-popup .swal2-icon.swal2-success [class^='swal2-success-line'] {
    background: #10b981 !important;
}

.cg-swal-popup .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.cg-swal-popup .swal2-icon.swal2-error {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.cg-swal-popup .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
    background: #ef4444 !important;
}

.cg-swal-popup .swal2-actions {
    gap: 10px !important;
    margin-top: 0 !important;
    padding: 0 !important;
}

/* Shared button base */
.cg-swal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
    min-width: 90px;
}

.cg-swal-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.35);
}

/* OK / primary confirm */
.cg-swal-btn-ok {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.cg-swal-btn-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Danger confirm */
.cg-swal-btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: #fff;
}

.cg-swal-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

/* Cancel */
.cg-swal-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.cg-swal-btn-cancel:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Animations */
@keyframes cg-swal-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes cg-swal-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }
}

.cg-swal-in {
    animation: cg-swal-in 0.25s cubic-bezier(.34, 1.56, .64, 1) both;
}

.cg-swal-out {
    animation: cg-swal-out 0.18s ease both;
}