/* Utility Classes */
.hidden {
    display: none !important;
}

:root {
    --bg: #F8F9FA;
    /* Clean, off-white background */
    --surface: #FFFFFF;
    --text: #1A1F23;
    /* Professional charcoal */
    --text-secondary: #64748B;
    /* Muted slate for secondary text */
    --primary: #334155;
    /* Neutral charcoal for primary actions */
    --accent: #2563EB;
    /* Muted blue used sparingly */
    --success: #334155;
    /* No green - use neutral charcoal */
    --warning: #64748B;
    /* No yellow - use muted slate */
    --error: #EF4444;
    /* Muted red for errors */
    --border: #E2E8F0;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --modal-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ease-squish: cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Libre Baskerville', serif;
    --font-ui: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    line-height: 1.5;
}

/* Modal Close Button Style */
.close-modal-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
}

.close-modal-btn:hover {
    background: var(--bg);
    color: var(--text);
}

/* Sidebar Stability - Smooth Transitions */
#queue-list {
    transition: opacity 0.2s ease;
}

.queue-item {
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

/* Loader for status */
.mini-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#app {
    width: 100%;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar Styles */
#sidebar {
    width: 260px;
    height: 100%;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 32px;
    padding: 0 8px;
}

.sidebar-header .logo {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.sidebar-header .app-version {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow-y: auto;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-section label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 0 16px;
    /* Align with button text */
    margin-bottom: 4px;
}

.sidebar-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    /* Standardized with select */
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sidebar-btn:hover {
    background: var(--bg);
}

.sidebar-btn.active {
    background: #DEEBFF;
    color: var(--accent);
}

.sidebar-btn .icon {
    font-size: 1.1rem;
    width: 20px;
    display: flex;
    justify-content: center;
}

.sidebar-select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 12px 16px;
    /* Standardized with button */
    border-radius: 10px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
}

/* Updated Header for Main Area */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 16px 40px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    position: sticky;
    top: 0;
    z-index: 100;
}

.layout-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    flex: 1;
    overflow: hidden;
    padding: 20px 40px;
}

@media (max-width: 1024px) {
    #sidebar {
        width: 80px;
        padding: 24px 12px;
    }

    #sidebar .logo,
    #sidebar .app-version,
    #sidebar label,
    #sidebar .sidebar-btn span:not(.icon) {
        display: none;
    }

    .sidebar-btn {
        justify-content: center;
        padding: 12px;
    }
}

@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-header,
    .sidebar-footer,
    .sidebar-section label {
        display: none;
    }

    .sidebar-content {
        flex-direction: row;
        gap: 12px;
    }

    .sidebar-section {
        flex-direction: row;
    }
}

.header-left,
.header-right,
.header-center {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-bar-container {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 16px;
    width: 280px;
    transition: all 0.3s ease;
}

.search-bar-container:focus-within {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    width: 320px;
}

#news-search-input {
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text);
    width: 100%;
    outline: none;
    font-family: inherit;
}

.user-id-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 6px;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.divider-vertical {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.app-context {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-name {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.app-version {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Status Pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 20px;
    border: 1px solid var(--border);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: background 0.3s ease;
}

.status-pill.idle .status-dot {
    background: var(--text-secondary);
}

.status-pill.working {
    border-color: var(--primary);
    background: #DEEBFF;
    color: var(--primary);
}

.status-pill.working .status-dot {
    background: var(--primary);
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0% {
        opacity: 0.5;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

/* Buttons */
.btn-compact {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    /* Squarer tech look */
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-logout {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
}

.btn-logout:hover {
    background: var(--bg) !important;
    border-color: var(--text-secondary) !important;
    color: var(--text) !important;
}

/* Card Stack */
#swipe-container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    /* Ensure it doesn't overflow parent */
    min-height: 0;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23172B4D' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding: 8px 36px 8px 16px !important;
    height: 38px;
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-ui);
    font-weight: 600;
}

.filter-select:hover {
    background-color: var(--bg) !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.filter-select option {
    background: var(--surface);
    color: var(--text);
    padding: 10px;
}

.card-stack-filter-flash {
    animation: filterFlash 0.5s var(--ease-squish);
}

@keyframes filterFlash {
    0% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.form-divider {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

#card-stack {
    position: relative;
    width: 100%;
    max-width: 480px;
    /* Constrain width on desktop */
    height: 520px;
    /* Taller for modern phones */
    perspective: 1000px;
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--surface);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    cursor: grab;
    transition: transform 0.4s var(--ease-squish), opacity 0.3s ease;
    user-select: none;
    touch-action: none;
    will-change: transform;
    overflow: hidden;
    animation: cardEntrance 0.6s var(--ease-squish);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9) rotateX(-5deg);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

.card:active {
    cursor: grabbing;
}

/* Category Tag */
.card .category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: inline-block;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    align-self: flex-start;
}

/* Headline */
.card h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.6rem;
    line-height: 1.35;
    margin-bottom: 24px;
    color: var(--text);
    font-weight: 700;
}

/* Content Body */
.card .content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(0, 0, 0, 0.7);
    flex: 1;
    overflow-y: auto;
    font-weight: 400;
}

/* Footer */
.card .footer {
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Controls */
#controls {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 20px 0 30px;
}

.control-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 1.6rem;
    cursor: pointer;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.control-btn:active {
    transform: scale(0.92);
}

.control-btn.skip {
    color: #FF3B30;
}

.control-btn.approve {
    color: #34C759;
}

/* Modal System */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    position: relative;
    background: var(--surface);
    width: 90%;
    max-width: 420px;
    padding: 32px;
    border-radius: 28px;
    /* Softer, updated corners */
    box-shadow: var(--modal-shadow);
    max-height: 85vh;
    overflow-y: auto;
    animation: modalPop 0.3s var(--ease-squish);
}

@keyframes modalPop {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content.wide {
    max-width: 800px;
}

.custom-tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-btn,
.custom-tab-btn {
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    padding-bottom: 8px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active,
.custom-tab-btn.active {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
    font-weight: 600;
}

h2 {
    margin-bottom: 24px;
    font-family: 'Libre Baskerville', serif;
    font-size: 1.4rem;
    color: var(--text);
    text-align: center;
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

select,
input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.file-drop-area {
    width: 100%;
    padding: 32px;
    border: 2px dashed var(--border);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    background: var(--bg);
    transition: all 0.2s;
}

.file-drop-area:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.ingest-status {
    margin-top: 24px;
    text-align: center;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Upload Tabs */
.tab-header {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 0;
    justify-content: center;
}

.tab-btn {
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    padding-bottom: 8px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
    font-weight: 600;
}

/* Image Overlay System */
.preview-image {
    position: relative;
}

.image-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.image-loading-overlay .mini-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 12px;
}

.image-loading-overlay span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.image-loading-overlay.hidden {
    display: none;
    opacity: 0;
}

/* Buttons */
/* Blog Category Grid */
.blog-cat-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-cat-box:hover {
    border-color: var(--primary);
    background: #DEEBFF;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.blog-cat-box.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: stretch;
    gap: 12px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.modal-actions button {
    flex: 1 1 auto;
    min-width: 120px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.1s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg);
    border: none;
    padding: 16px;
    border-radius: 14px;
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #E5E5EA;
}

/* --- RICH POST PREVIEW --- */
.post-preview-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Image Container */
.preview-image {
    width: 100%;
    aspect-ratio: 4 / 5;
    /* Social standard */
    border-radius: 16px;
    overflow: hidden;
    background: #FAFAFA;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensures the whole image is seen */
    display: block;
}

img.generated-post-image {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.image-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Caption regeneration button styling (now in footer) */
.caption-regen-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.caption-regen-icon:hover {
    background: #0056b3 !important;
    border-color: #0056b3 !important;
    color: white !important;
}

.caption-regen-icon svg {
    color: inherit;
}

.preview-image-fallback {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* Text Content */
.preview-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-caption {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

.preview-hashtags {
    font-size: 0.85rem;
    color: var(--accent);
    /* Subtle blue for tags */
    font-weight: 500;
    margin-top: 8px;
}

/* Queue Section (Embedded) */
#queue-section {
    background: var(--surface);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    height: 100%;
    min-height: 0;
    /* Enable scrolling within flex item */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

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

.section-header h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0;
}

#queue-count {
    background: var(--text);
    color: var(--surface);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

#queue-list {
    flex: 1;
    overflow-y: auto;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Queue Items - Technical Look */
.queue-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    max-height: 80px;
    /* Constrain height to prevent bulging */
}

.queue-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.queue-item.active {
    border-left-color: var(--primary);
    background: rgba(0, 102, 255, 0.03);
}

.queue-item.active.generating {
    border-left-color: var(--warning);
}

.queue-item.ready {
    border-left-color: var(--success);
}

.queue-item.failed {
    border-left-color: var(--error);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.job-title {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.job-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.status-badge {
    font-size: 0.6rem;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
}

.queue-item.generating .status-badge {
    color: var(--warning);
    background: #FFF7D6;
}

.queue-item.ready .status-badge {
    color: var(--success);
    background: #E3FCEF;
}

/* Redesigned Progress Bar */
.progress-rail {
    height: 3px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 0;
    margin: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.5s ease;
}

/* Redesigned Queue Item Layout */
.job-row-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.job-col-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.job-title-primary {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-sub-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.job-type-tag {
    font-size: 0.65rem;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.job-time-muted {
    font-size: 0.65rem;
    color: #94a3b8;
}

.job-col-status {
    display: flex;
    align-items: center;
}

.status-badge-container {
    display: flex;
    align-items: center;
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.status-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.progress-container-mini {
    height: 4px;
    background: #f1f5f9;
    border-radius: 2px;
    width: 100%;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar-mini {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* Icons */
.job-icon {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Activity Animation */
.generating .job-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Saved Posts Section */
.saved-posts-section {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.saved-posts-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Spinners & Loading States */
.loading-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    animation: fadeIn 0.5s ease;
}

.empty-state-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    text-align: center;
    gap: 20px;
    padding: 40px;
    background: var(--surface);
    border-radius: 24px;
    border: 1px dashed var(--border);
    animation: fadeIn 0.5s ease;
}

.empty-state-message p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
}

.empty-state-message .btn-secondary {
    width: 100%;
    background: var(--primary);
    color: white;
}

.empty-state-message .btn-secondary:hover {
    background: #0047B3;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.mini-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.source-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.source-link {
    font-size: 0.75rem;
    text-decoration: underline;
    opacity: 0.8;
}

.source-link:hover {
    opacity: 1;
}

/* Search Bar Improvements */
.search-bar-container {
    display: flex;
    align-items: center;
    background: white;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    gap: 12px;
    width: 320px;
}

.search-bar-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

#news-search-input {
    border: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--text);
    width: 100%;
    outline: none;
    padding: 0;
    margin: 0;
}

#news-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui);
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--text);
    /* Dark Slate */
    border-left: 4px solid var(--success);
}

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

/* Queue Animations */
.queue-item {
    animation: slideIn 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* LinkedIn Accounts Management */
.account-list {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    transition: background 0.2s;
}

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

.account-item:hover {
    background: var(--bg);
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-info strong {
    font-size: 0.9rem;
    color: var(--text);
}

.account-info span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
    width: fit-content;
}

.status-badge.active {
    background: #E3FCEF;
    color: #006644;
}

.status-badge.expired {
    background: #FFEBE6;
    color: #BF2600;
}

.status-badge.completed {
    background: #E3FCEF;
    color: #006644;
}

.status-badge.pending {
    background: #DEEBFF;
    color: #0052CC;
}

.status-badge.failed {
    background: #FFEBE6;
    color: #BF2600;
}

input[type="datetime-local"] {
    appearance: none;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text);
    width: 100%;
    outline: none;
}

input[type="datetime-local"]:focus {
    border-color: var(--text);
    background: var(--surface);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-icon.delete:hover {
    color: var(--error);
    background: #FFEBE6;
}

.linkedin-account-selector {
    background-color: var(--surface) !important;
    border: 1px solid var(--border) !important;
    padding: 10px 14px !important;
    font-size: 0.9rem !important;
    color: var(--text) !important;
    border-radius: 10px !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Refined Queue Items Layout */
.job-row-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 12px;
}

.job-col-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.job-title-primary {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.job-sub-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.job-type-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    background: #e0e7ff;
    padding: 2px 6px;
    border-radius: 4px;
}

.job-time-muted {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.job-col-status {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.status-badge-container {
    display: flex;
    align-items: center;
}

/* Progress overrides */
.progress-container-mini {
    height: 3px;
    background: #f1f5f9;
    border-radius: 2px;
    margin-top: 10px;
    width: 100%;
    overflow: hidden;
}

.progress-bar-mini {
    height: 100%;
    background: var(--primary);
    transition: width 0.4s ease;
}

/* Updated Header Select */
.header-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding: 10px 48px 10px 20px;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.header-select:hover {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.header-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =========================================
   DEEP MOBILE OPTIMIZATION
   ========================================= */

@media (max-width: 600px) {

    /* Global Container */
    .layout-container {
        display: flex;
        flex-direction: column;
        padding: 10px;
        /* Minimal side padding */
        gap: 15px;
        overflow-y: auto;
        height: 100%;
    }

    /* Sidebar - Horizontal Scroll Strip */
    #sidebar {
        padding: 12px 16px;
        overflow-x: scroll;
        /* Force scrolling */
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        /* Keep buttons in one line */
        gap: 12px;
        border-bottom: 1px solid var(--border);
        background: var(--surface);
        flex-shrink: 0;
        /* Don't shrink height */
        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar-section {
        display: inline-flex;
        /* Inline for horizontal */
        flex-direction: row;
        gap: 8px;
        margin-right: 16px;
        border-right: 1px solid var(--border);
        padding-right: 16px;
    }

    .sidebar-section:last-child {
        border-right: none;
        margin-right: 0;
    }

    .sidebar-btn {
        padding: 8px 12px;
        min-width: auto;
        white-space: nowrap;
        background: var(--bg);
        border: 1px solid var(--border);
    }

    .sidebar-btn .icon {
        margin-right: 6px;
    }

    /* Header adjustments */
    #main-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
        flex-shrink: 0;
    }

    .header-left {
        width: 100%;
        order: 1;
        margin-bottom: 5px;
        /* Push below search if wrapping */
    }

    .search-bar-container {
        width: 100%;
        max-width: none;
    }

    .header-center {
        order: 2;
        width: 65%;
    }

    .header-right {
        order: 3;
        width: 30%;
        /* Fit next to selector */
        justify-content: flex-end;
    }

    .header-select {
        width: 100%;
        padding: 8px 30px 8px 14px;
        font-size: 0.85rem;
        background-position: right 10px center;
    }

    .user-id-label {
        font-size: 0.75rem;
        padding: 6px 10px;
        max-width: 100%;
        text-align: center;
    }

    /* Queue Section - Keep hidden to prioritize swipe */
    #queue-section {
        display: none;
    }

    /* Main Swipe Container */
    #swipe-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        /* Center vertically */
        min-height: 0;
        /* Allow shrinking */
        padding-bottom: 100px;
        /* Clearance for fixed controls */
    }

    /* Card Stack Mobile Alignment */
    #card-stack {
        height: 55vh;
        /* Slightly reduced to fit header/sidebar */
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        /* Remove top margin for centering */
    }

    .card {
        padding: 24px;
        border-radius: 20px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    }

    .card h2 {
        font-size: 1.35rem;
        /* Readable heading */
        line-height: 1.35;
        margin-bottom: 14px;
    }

    .card .content {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .card .footer {
        font-size: 0.7rem;
        margin-top: 15px;
        padding-top: 15px;
    }

    /* Controls - Perfectly Centered Bottom */
    #controls {
        gap: 30px;
        padding: 20px 0 30px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to top, var(--bg) 90%, transparent);
        pointer-events: none;
        z-index: 50;
        display: flex;
        justify-content: center;
    }

    .control-btn {
        pointer-events: auto;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
        background: white;
    }

    /* Ensure Footer Actions (Reload) are accessible */
    #swipe-view-actions {
        z-index: 60;
        position: relative;
        padding-bottom: 20px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        padding: 24px;
        max-height: 85vh;
        border-radius: 20px;
    }

    .modal-content.wide {
        width: 95%;
    }
}

/* Controls - Perfectly Centered Bottom */
/* Controls - Perfectly Centered Bottom */
#controls {
    gap: 30px;
    padding: 20px 0 30px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--bg) 95%, transparent);
    pointer-events: none;
    z-index: 50;
    display: flex;
    justify-content: center;
}

.control-btn {
    pointer-events: auto;
    /* Re-enable clicks */
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    /* Lift buttons */
    background: white;
}


/* List View Container */
#list-view-container {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

#swipe-container.list-mode {
    justify-content: flex-start;
    padding-top: 20px;
}


/* News Cards - Clean Two-Column Grid */
.news-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

.news-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 160px;
}

.news-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.news-card.active {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.03);
    box-shadow: 0 0 0 2px var(--primary);
}

/* Card Content Structure */
.news-card-top {
    flex: 1;
    margin-bottom: 20px;
}

.news-card-headline {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Bottom Section */
.news-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.news-card-keyword {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    padding: 6px 12px;
    border-radius: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-card-read-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.news-card-read-link:hover {
    color: var(--primary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .news-grid-container {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }

    .news-card {
        padding: 20px;
        min-height: 140px;
    }

    .news-card-headline {
        font-size: 1rem;
    }

    .news-card-description {
        font-size: 0.85rem;
    }
}

@media (max-width: 640px) {
    .news-card-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .news-card-read-link {
        font-size: 0.75rem;
    }
}

/* List Mode Scrollbar */
#list-view-container::-webkit-scrollbar {
    width: 8px;
}

#list-view-container::-webkit-scrollbar-track {
    background: transparent;
}

#list-view-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

#list-view-container::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* =========================================
   SOCIAL LISTENING / MONITORING MODULE
   ========================================= */

/* Switch View Button */
.btn-switch-view {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border: none;
    border-radius: 24px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-switch-view:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-switch-view.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-switch-view svg {
    transition: transform 0.3s ease;
}

.btn-switch-view:hover svg {
    transform: rotate(15deg);
}

/* Monitoring Container */
.monitoring-container {
    display: flex;
    width: 100%;
    height: 100%;
    background: var(--bg);
}

/* Monitoring Sidebar */
.monitoring-sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.monitoring-sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.monitoring-sidebar-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text);
    margin: 0;
}

.monitoring-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.monitoring-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
}

.monitoring-nav-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.monitoring-nav-btn.active {
    background: #e0e7ff;
    color: #4338ca;
    font-weight: 600;
}

.monitoring-nav-btn svg {
    flex-shrink: 0;
}

.alert-badge {
    position: absolute;
    right: 12px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Monitoring Main Content */
.monitoring-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 32px;
}

.monitoring-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

/* Section Toolbar */
.section-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.section-toolbar h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text);
    margin: 0;
    text-align: left;
}

.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar-select {
    padding: 8px 32px 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    background: var(--surface);
    border-color: var(--primary);
}

/* Feed Grid */
.feed-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    padding-right: 8px;
}

.feed-empty-state,
.rules-empty-state,
.alerts-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
}

.feed-empty-state svg,
.rules-empty-state svg,
.alerts-empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.feed-empty-state h3,
.rules-empty-state h3,
.alerts-empty-state h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 8px;
}

.feed-empty-state p,
.rules-empty-state p,
.alerts-empty-state p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Feed Card */
.feed-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
}

.feed-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.feed-card.important {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.feed-card.important:hover {
    border-color: #dc2626;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

.feed-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.platform-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
}

.platform-badge.twitter {
    background: #1da1f2;
}

.platform-badge.linkedin {
    background: #0077b5;
}

.platform-badge.reddit {
    background: #ff4500;
}

.platform-badge.news {
    background: #64748b;
}

.feed-card-author {
    flex: 1;
}

.feed-card-author strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
}

.feed-card-author span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.quality-indicator {
    margin-left: 8px;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.quality-indicator.high {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.quality-indicator.medium {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: white;
}

.quality-indicator.low {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    color: white;
}

.feed-card-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    position: relative;
}

.feed-card-content.truncated:not(.expanded) {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-card-content.expanded {
    display: block;
    overflow: visible;
}

.feed-card-content .content-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.expand-content-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border: none;
    border-radius: 12px;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    color: #4338ca;
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-content-btn:hover {
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
    transform: translateY(-1px);
}

.feed-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.feed-card-rule {
    background: #e0e7ff;
    color: #4338ca;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.feed-card-email-badge {
    background: #d1fae5;
    color: #047857;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.feed-card-email-badge.clickable {
    cursor: pointer;
    user-select: none;
}

.feed-card-email-badge.clickable:hover {
    background: var(--accent, #3b82f6);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.feed-card-email-badge.clickable.selected {
    background: var(--accent, #3b82f6);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.5);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.feed-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.feed-action-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.feed-action-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
}

.feed-action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.feed-action-btn.primary:hover {
    background: #1e293b;
}

/* Rules Container */
.rules-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.rule-card:hover {
    border-color: var(--primary);
}

.rule-card-info {
    flex: 1;
}

.rule-card-info h4 {
    font-size: 1rem;
    color: var(--text);
    margin: 0 0 8px;
}

.rule-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.rule-tag {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.rule-tag.keyword {
    background: #dbeafe;
    color: #1e40af;
}

.rule-tag.handle {
    background: #fce7f3;
    color: #9d174d;
}

.rule-tag.platform {
    background: #e0e7ff;
    color: #4338ca;
}

.rule-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rule-card-actions {
    display: flex;
    gap: 8px;
}

.rule-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rule-status.active {
    color: #059669;
}

.rule-status.paused {
    color: #d97706;
}

/* Alerts Container */
.alerts-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-item:hover {
    background: var(--bg);
}

.alert-item.unread {
    background: #f0f9ff;
    border-left-color: #2563eb;
}

.alert-item.unread::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-content strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 4px;
}

.alert-content span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Analytics Cards */
.analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
}

.analytics-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--accent);
}

.analytics-card.wide {
    grid-column: span 4;
}

.analytics-card-header {
    margin-bottom: 20px;
}

.analytics-card-header h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Stat Cards */
.stat-card {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--primary) 0%, #475569 100%);
    border: none;
    color: white;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(51, 65, 85, 0.3);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.stat-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    stroke: white;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Chart Container */
.chart-container {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sentiment Bars */
.sentiment-bars {
    display: flex;
    gap: 32px;
    align-items: flex-end;
    height: 160px;
    width: 100%;
    justify-content: center;
    padding: 20px 0;
}

.sentiment-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sentiment-bar {
    width: 70px;
    background: var(--bg);
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 8px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 50px;
    position: relative;
}

.sentiment-bar.positive {
    background: linear-gradient(to top, var(--accent), #60a5fa);
}

.sentiment-bar.neutral {
    background: linear-gradient(to top, var(--primary), #64748b);
}

.sentiment-bar.negative {
    background: linear-gradient(to top, #dc2626, #ef4444);
}

.sentiment-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
}

.sentiment-label {
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 600;
    text-align: center;
}

/* Platform Stats */
.platform-stats {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.platform-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.platform-stat:hover {
    background: white;
    border-color: var(--accent);
    transform: translateX(4px);
}

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

.platform-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.platform-icon.twitter {
    background: #1da1f2;
}

.platform-icon.linkedin {
    background: #0077b5;
}

.platform-icon.reddit {
    background: #ff4500;
}

.platform-icon.news {
    background: var(--primary);
}

.platform-name {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.platform-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Keywords Container */
.keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
    min-height: 100px;
}

.keyword-tag {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary), #475569);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3);
}

.keyword-tag.large {
    font-size: 1.1rem;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), #3b82f6);
}

.keyword-tag.medium {
    font-size: 0.95rem;
    padding: 9px 18px;
}

.empty-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
    padding: 40px 20px;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-card.wide {
        grid-column: span 2;
    }

    .stat-card {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .analytics-card.wide,
    .stat-card {
        grid-column: span 1;
    }

    .sentiment-bars {
        gap: 20px;
    }

    .sentiment-bar {
        width: 60px;
    }

    .stat-value {
        font-size: 2rem;
    }
}

.volume-chart {
    height: 120px;
    background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
    border-radius: 8px;
}

.empty-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

/* Reports Section */
.reports-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    flex: 1;
    overflow: hidden;
}

/* Report Configuration Card */
.report-config-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100vh - 200px);
}

.config-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #475569 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.config-card-header svg {
    flex-shrink: 0;
}

.config-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.report-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-select,
.form-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s ease;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select[multiple] {
    min-height: 100px;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-separator {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.date-range-inputs input {
    flex: 1;
}

.btn-generate-report {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent) 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-generate-report:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-generate-report:active {
    transform: translateY(0);
}

.btn-generate-report svg {
    flex-shrink: 0;
}

/* Report Preview Card */
.report-preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.preview-card-header svg {
    flex-shrink: 0;
    color: var(--primary);
}

.preview-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.report-preview-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    min-height: 400px;
}

.preview-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 60px 40px;
}

.preview-empty-state svg {
    color: var(--text-secondary);
    opacity: 0.3;
    margin-bottom: 20px;
}

.preview-empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 300px;
}

/* Report Content Styling */
.report-preview-content pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .reports-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .report-config-card {
        order: 1;
    }

    .report-preview-card {
        order: 2;
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .date-range-inputs {
        flex-direction: column;
        gap: 8px;
    }

    .date-separator {
        display: none;
    }

    .report-form {
        padding: 20px;
    }

    .report-preview-content {
        padding: 20px;
    }
}

/* Form Enhancements for Rule Builder */
.form-row {
    display: flex;
    gap: 20px;
}

.flex-1 {
    flex: 1;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    resize: vertical;
    background: var(--bg);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

/* Original Content Preview in AI Response Modal */
.original-content-preview {
    margin-bottom: 20px;
}

.content-preview-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    max-height: 120px;
    overflow-y: auto;
}

/* Responsive adjustments for monitoring */
@media (max-width: 1024px) {
    .monitoring-sidebar {
        width: 200px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .reports-config {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .monitoring-container {
        flex-direction: column;
    }

    .monitoring-sidebar {
        width: 100%;
        flex-direction: row;
        padding: 12px;
        overflow-x: auto;
    }

    .monitoring-sidebar-header {
        display: none;
    }

    .monitoring-nav {
        flex-direction: row;
        gap: 8px;
    }

    .monitoring-nav-btn {
        white-space: nowrap;
        padding: 10px 14px;
    }

    .monitoring-nav-btn svg {
        display: none;
    }

    .feed-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 16px;
    }
}

/* Reports Section Styles */
.reports-config {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    align-items: start;
}

.report-form {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    position: sticky;
    top: 20px;
}

.report-form .form-group {
    margin-bottom: 18px;
}

.report-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.report-form .form-select,
.report-form .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.report-form .form-select:focus,
.report-form .form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-range-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-range-inputs span {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Report Preview Styles */
.report-preview {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    min-height: 600px;
    max-height: 80vh;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.report-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    height: 100%;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.report-preview .empty-text {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 80px 40px;
    margin: 0;
    line-height: 1.6;
}

/* Report Content Container */
.report-content-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Allow flex item to shrink below content size */
}

/* Report Header */
.report-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.report-actions {
    display: flex;
    gap: 12px;
}

.report-actions .btn-primary,
.report-actions .btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 10px 16px;
    font-weight: 500;
}

.report-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.report-type-badge {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.report-date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Report Content */
.report-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
    border-radius: 8px;
    background: var(--bg);
    margin: 16px;
    margin-top: 8px;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Report Footer */
.report-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    text-align: center;
}

/* Enhanced Download Button */
.btn-download {
    position: relative;
    animation: gentlePulse 3s infinite;
    font-weight: 600;
    border: 2px solid var(--accent);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    border-color: var(--accent);
}

.btn-download:active {
    transform: translateY(0);
}

@keyframes gentlePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.1);
    }
}

/* Success state for download button */
.btn-download.success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    animation: none !important;
}

/* Advanced Feed Filter Toolbar */
.feed-filter-toolbar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 140px;
    flex: 1;
}

/* Date filter group - full width and properly aligned */
.date-filter-group {
    width: 100%;
    flex: 1 1 100%;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    margin-bottom: 0;
}

.date-filter-group .filter-label {
    margin-bottom: 0;
    margin-right: 0;
    white-space: nowrap;
}

.date-filter-group input[type="date"] {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
}

.date-filter-group button {
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filter-date-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-date-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.custom-date-group {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    min-width: auto;
}

.custom-date-group .filter-label {
    margin-bottom: 0;
    margin-right: 4px;
}

/* Ensure proper alignment on mobile */
@media (max-width: 768px) {
    .date-filter-group {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .date-filter-group input[type="date"] {
        max-width: 100%;
    }
    
    .date-filter-group button {
        width: 100%;
    }
}

.reset-filters-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reset-filters-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.reset-filters-btn svg {
    width: 14px;
    height: 14px;
}

/* Responsive design for filter toolbar */
@media (max-width: 1024px) {
    .feed-filter-toolbar {
        gap: 12px;
    }

    .filter-group {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .feed-filter-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
        min-width: unset;
    }

    .custom-date-group {
        flex-direction: column !important;
        gap: 8px;
    }

    .custom-date-group .filter-label {
        align-self: flex-start;
    }
}

/* Post Navigation in Modal */
.modal-header-with-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.modal-header-with-nav h2 {
    margin: 0;
    flex: 1;
    text-align: center;
}

.nav-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.nav-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:disabled:hover {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-secondary);
}

/* Image Comparison UI */
.image-comparison-container {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
}

.image-comparison-slider {
    position: relative;
    margin-bottom: 12px;
}

.comparison-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.previous-label {
    color: #ef4444;
}

.current-label {
    color: #10b981;
}

.comparison-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    appearance: none;
    cursor: pointer;
    position: relative;
}

.comparison-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.comparison-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.comparison-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    height: 6px;
    background: var(--accent);
    border-radius: 3px;
    transform: translateY(-50%);
    pointer-events: none;
    transition: width 0.1s ease;
}

.comparison-instruction {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

.comparison-images {
    display: none;
    /* Hidden - we use the main image element */
}

/* Responsive adjustments for report preview */
@media (max-width: 768px) {
    .report-preview {
        min-height: 500px;
        max-height: 70vh;
    }

    .report-content {
        padding: 16px;
        margin: 8px;
        font-size: 14px;
    }

    .report-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .report-actions {
        justify-content: center;
    }

    .report-footer {
        padding: 12px 16px;
    }

    .report-content::-webkit-scrollbar {
        width: 8px;
    }

    .report-content::-webkit-scrollbar-thumb {
        min-height: 30px;
    }
}

/* Responsive adjustments for image comparison */
@media (max-width: 768px) {
    .image-comparison-container {
        padding: 12px;
        margin-top: 12px;
    }

    .comparison-slider {
        height: 8px;
    }

    .comparison-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
}

.report-content h3 {
    color: var(--text-primary) !important;
    margin: 25px 0 12px 0 !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    border-bottom: 2px solid var(--accent) !important;
    padding-bottom: 8px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-content div[style*="border-left"] {
    margin: 8px 0;
    padding: 10px 0 10px 20px;
    border-left: 3px solid var(--border) !important;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 4px 4px 0;
    transition: background-color 0.2s ease;
}

.report-content div[style*="border-left"]:hover {
    background: rgba(59, 130, 246, 0.05);
}

.report-content div[style*="margin-left"] {
    margin: 5px 0;
    margin-left: 30px;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

/* Scrollbar styling for report content */
.report-content::-webkit-scrollbar {
    width: 12px;
}

.report-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
    margin: 2px;
}

.report-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
    min-height: 40px;
}

.report-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    border-color: var(--bg-secondary);
}

.report-content::-webkit-scrollbar-thumb:active {
    background: var(--accent-hover);
}

.report-content::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}

/* Report content styling */
.report-preview h3 {
    color: var(--text-primary) !important;
    margin: 20px 0 10px 0 !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
}

.report-preview div[style*="border-left"] {
    margin: 5px 0;
    padding-left: 15px;
    border-left: 3px solid var(--border) !important;
    color: var(--text-primary);
}

.report-preview div[style*="margin-left"] {
    margin: 3px 0;
    margin-left: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive adjustments for reports */
@media (max-width: 1024px) {
    .reports-config {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .report-form {
        order: 2;
        position: static;
    }

    .report-preview {
        order: 1;
        min-height: 400px;
    }

    .report-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .report-actions {
        width: 100%;
        justify-content: center;
    }

    .report-meta {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .reports-config {
        gap: 15px;
    }

    .report-form {
        padding: 20px;
    }

    .report-content {
        padding: 20px;
    }

    .report-actions .btn-primary,
    .report-actions .btn-secondary {
        flex: 1;
        justify-content: center;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .report-form {
        padding: 16px;
    }

    .report-content {
        padding: 16px;
    }

    .report-header {
        padding: 16px;
    }

    .report-actions {
        flex-direction: column;
        gap: 8px;
    }

    .report-actions .btn-primary,
    .report-actions .btn-secondary {
        width: 100%;
    }
}