/* ==========================================================================
   CrossFeed DASHBOARD — PROFESSIONAL DESIGN SYSTEM (CSS/STYLE.CSS)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS & PALETTES
   -------------------------------------------------------------------------- */
:root {
    /* DARK MODE PALETTE */
    --app-bg: #120b0d;
    --sidebar-bg: #181112;
    --card-bg: #1c1215;
    --card-bg-hover: #24171a;
    --inset-bg: #140d0f;
    --border-color: #2d1d21;
    --border-color-hover: #40262c;

    --text-heading: #ffffff;
    --text-body: #f3f4f6;
    --text-muted: #9e8b90;
    --text-placeholder: #6e5d62;

    --brand-coral: #f2555a;
    --brand-coral-hover: #e0454a;
    --brand-rose-bg: #2d171a;
    --brand-rose-border: #3d1f25;
    --brand-rose-text: #f2555a;

    --btn-neutral-bg: #221518;
    --btn-neutral-border: #301d22;
    --btn-neutral-text: #f3f4f6;
    --btn-neutral-hover: #2b1b1f;

    --badge-bg: #221518;
    --badge-border: #2d1d21;
    --badge-text: #9e8b90;

    --popover-bg: #181112;
    --popover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);

    --status-published-bg: rgba(6, 78, 59, 0.8);
    --status-published-border: rgba(6, 95, 70, 0.5);
    --status-published-text: #34d399;
}

html.light {
    /* LIGHT (DAY) MODE PALETTE — ALL TEXT COLOR MANDATED TO #64748b */
    --app-bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --card-bg-hover: #f8fafc;
    --inset-bg: #f1f5f9;
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;

    --text-heading: #64748b;
    --text-body: #64748b;
    --text-muted: #64748b;
    --text-placeholder: #94a3b8;

    --brand-coral: #f2555a;
    --brand-coral-hover: #e0454a;
    --brand-rose-bg: #fff1f2;
    --brand-rose-border: #fecdd3;
    --brand-rose-text: #e11d48;

    --btn-neutral-bg: #ffffff;
    --btn-neutral-border: #cbd5e1;
    --btn-neutral-text: #64748b;
    --btn-neutral-hover: #f1f5f9;

    --badge-bg: #f1f5f9;
    --badge-border: #e2e8f0;
    --badge-text: #64748b;

    --popover-bg: #ffffff;
    --popover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    --status-published-bg: #ecfdf5;
    --status-published-border: #a7f3d0;
    --status-published-text: #059669;
}

/* --------------------------------------------------------------------------
   2. BASE & TYPOGRAPHY STYLES
   -------------------------------------------------------------------------- */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--app-bg);
    color: var(--text-body);
    overflow-x: hidden;
    transition: background-color 0.25s ease-in-out, color 0.25s ease-in-out;
}

.code-font {
    font-family: 'JetBrains Mono', monospace;
}

/* CUSTOM SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --------------------------------------------------------------------------
   3. SEMANTIC REUSABLE COMPONENT CLASSES
   -------------------------------------------------------------------------- */

/* Layout Shells */
.sidebar-panel {
    background-color: var(--sidebar-bg);
    border-color: var(--border-color);
}

.card-surface {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    transition: all 0.2s ease-in-out;
}

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

.inset-surface {
    background-color: var(--inset-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.popover-surface {
    background-color: var(--popover-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--popover-shadow);
    border-radius: 1rem;
}

/* Button Classes */
.btn-primary {
    background-color: var(--brand-coral) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(242, 85, 90, 0.25);
}

.btn-primary:hover {
    background-color: var(--brand-coral-hover) !important;
}

.btn-secondary {
    background-color: var(--brand-rose-bg) !important;
    border: 1px solid var(--brand-rose-border) !important;
    color: var(--brand-rose-text) !important;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
}

.btn-secondary:hover {
    filter: brightness(1.05);
}

.btn-neutral {
    background-color: var(--btn-neutral-bg) !important;
    border: 1px solid var(--btn-neutral-border) !important;
    color: var(--btn-neutral-text) !important;
    font-weight: 500;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
}

.btn-neutral:hover {
    background-color: var(--btn-neutral-hover) !important;
}

/* Nav Item Classes */
.nav-item-active {
    background-color: var(--brand-rose-bg) !important;
    border: 1px solid var(--brand-rose-border) !important;
    color: var(--brand-rose-text) !important;
    font-weight: 600;
}

.nav-item-inactive {
    background-color: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-muted) !important;
}

.nav-item-inactive:hover {
    background-color: var(--btn-neutral-hover) !important;
    color: var(--text-heading) !important;
}

/* Badge & Tag Classes */
.badge-chip {
    background-color: var(--badge-bg) !important;
    border: 1px solid var(--badge-border) !important;
    color: var(--badge-text) !important;
    border-radius: 0.375rem;
}

.badge-published {
    background-color: var(--status-published-bg) !important;
    border: 1px solid var(--status-published-border) !important;
    color: var(--status-published-text) !important;
}

/* Form Inputs */
.input-field {
    background-color: var(--inset-bg);
    border: 1px solid var(--border-color);
    color: var(--text-heading);
    border-radius: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field::placeholder {
    color: var(--text-placeholder);
}

.input-field:focus {
    outline: none;
    border-color: var(--brand-coral) !important;
    box-shadow: 0 0 0 3px rgba(242, 85, 90, 0.15);
}

/* --------------------------------------------------------------------------
   4. GLOBAL LIGHT MODE COMPREHENSIVE OVERRIDES
   -------------------------------------------------------------------------- */
html.light body,
html.light h1,
html.light h2,
html.light h3,
html.light h4,
html.light h5,
html.light h6,
html.light p,
html.light span:not(.btn-primary *):not(.bg-\[\#f2555a\] *),
html.light div,
html.light label,
html.light button:not(.btn-primary):not(.bg-\[\#f2555a\]):not(.bg-\[\#e0454a\]),
html.light a,
html.light input,
html.light select,
html.light textarea,
html.light th,
html.light td,
html.light i:not(.text-red-500):not(.text-blue-400):not(.text-pink-500):not(.text-cyan-400):not(.text-\[\#f2555a\]):not(.text-emerald-400):not(.text-emerald-500):not(.btn-primary *):not(.bg-\[\#f2555a\] *) {
    color: #64748b !important;
}

/* Primary Coral Buttons Always Crisp White Text */
html.light .btn-primary,
html.light .bg-\[\#f2555a\],
html.light .bg-\[\#e0454a\],
html.light .btn-primary *,
html.light .bg-\[\#f2555a\] *,
html.light .bg-\[\#e0454a\] * {
    color: #ffffff !important;
    background-color: #f2555a !important;
}

html.light .bg-\[\#e0454a\]:hover,
html.light .btn-primary:hover {
    background-color: #e0454a !important;
}

html.light body {
    background-color: #f8fafc !important;
}

html.light aside {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 1px 0 3px 0 rgba(0, 0, 0, 0.02);
}

html.light main {
    background-color: #f8fafc !important;
}

/* Comprehensive Class Name Overrides for Light Mode */
html.light .bg-\[\#181112\],
html.light .bg-\[\#1c1215\],
html.light .bg-\[\#221518\],
html.light .bg-\[\#2b1b1f\],
html.light .bg-\[\#120b0d\],
html.light .bg-\[\#2a1a1e\] {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Secondary Action Buttons & Pills in Light Mode */
html.light .bg-\[\#2a171b\],
html.light .bg-\[\#2d171a\],
html.light .bg-\[\#3d2127\],
html.light .bg-\[\#3d1d23\],
html.light .bg-\[\#8c3539\],
html.light .btn-secondary,
html.light .nav-item-active {
    background-color: #fff1f2 !important;
    border-color: #fecdd3 !important;
    color: #e11d48 !important;
}

html.light .bg-\[\#2a171b\]:hover,
html.light .bg-\[\#2d171a\]:hover,
html.light .bg-\[\#3d2127\]:hover,
html.light .bg-\[\#8c3539\]:hover {
    background-color: #ffe4e6 !important;
    color: #be123c !important;
}

/* Badges & Chips in Light Mode: strictly #64748b */
html.light .badge-chip,
html.light .bg-\[\#2a1a1e\],
html.light .bg-\[\#2d1d21\] {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
}

/* Specific Utility Text Class Overrides in Light Mode */
html.light .text-white:not(.btn-primary):not(.btn-primary *):not(.bg-\[\#f2555a\]):not(.bg-\[\#f2555a\] *) {
    color: #64748b !important;
}

html.light .text-slate-100,
html.light .text-slate-200,
html.light .text-slate-300,
html.light .text-slate-400,
html.light .text-slate-500,
html.light .text-\[\#9e8b90\] {
    color: #64748b !important;
}

html.light .placeholder-\[\#6e5d62\]::placeholder {
    color: #94a3b8 !important;
}

/* Borders & Table Dividers in Light Mode (Soft Light Border #f1f5f9 / #e2e8f0) */
html.light .border-\[\#2d1d21\],
html.light .border-\[\#301d22\],
html.light .border-\[\#332025\],
html.light .border-\[\#3b1f25\],
html.light .border-\[\#3d1f25\],
html.light .border-\[\#3d272c\] {
    border-color: #e2e8f0 !important;
}

html.light .divide-\[\#2d1d21\]> :not([hidden])~ :not([hidden]),
html.light .divide-y> :not([hidden])~ :not([hidden]),
html.light table tr,
html.light table td,
html.light table th {
    border-color: #f1f5f9 !important;
}

/* Form Elements */
html.light input,
html.light select,
html.light textarea {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus {
    border-color: #f2555a !important;
    box-shadow: 0 0 0 3px rgba(242, 85, 90, 0.15) !important;
}

/* Tables Header & Hover */
html.light table th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
}

html.light table tr:hover {
    background-color: #f8fafc !important;
}

/* Pre / Code Blocks */
html.light pre {
    background-color: #0f172a !important;
    color: #34d399 !important;
    border-color: #1e293b !important;
}

/* Popover Cards */
html.light #schedulePopover,
html.light #postToDropdown,
html.light #userProfileDropdown,
html.light #integrationModal>div,
html.light #postDetailsModal>div {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
}

/* --------------------------------------------------------------------------
   5. UNIFIED SOCIAL INBOX (MESSAGES) & SELECTION STYLES
   -------------------------------------------------------------------------- */
.msg-thread-item {
    transition: all 0.2s ease-in-out;
    border-left: 3px solid transparent;
}

.msg-thread-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.msg-thread-item.active,
.msg-thread-item.is-selected,
.msg-thread-item.bg-\[\#23171a\],
.msg-thread-item.bg-slate-500\/10 {
    background-color: #23171a !important;
    border-left: 3px solid #f2555a !important;
}

/* Light / Day Mode Overrides for Message Inbox */
html.light .msg-thread-item {
    background-color: #ffffff;
    border-color: #f1f5f9 !important;
}

html.light .msg-thread-item:hover {
    background-color: #f8fafc !important;
}

/* Selected Message Thread in Light / Day Mode - Fresh Soft Tint */
html.light .msg-thread-item.active,
html.light .msg-thread-item.is-selected,
html.light .msg-thread-item.bg-\[\#23171a\],
html.light .msg-thread-item.bg-slate-500\/10,
html.light .bg-\[\#23171a\] {
    background-color: #fff1f2 !important;
    border-left: 3px solid #f2555a !important;
}

html.light .hover\:bg-\[\#23171a\]:hover {
    background-color: #ffe4e6 !important;
}

html.light .msg-thread-item.active .font-bold,
html.light .msg-thread-item.is-selected .font-bold,
html.light .msg-thread-item.bg-\[\#23171a\] .font-bold,
html.light .msg-thread-item.bg-slate-500\/10 .font-bold,
html.light .msg-thread-item.active .text-white,
html.light .msg-thread-item.is-selected .text-white,
html.light .msg-thread-item.bg-\[\#23171a\] .text-white,
html.light .msg-thread-item.bg-slate-500\/10 .text-white {
    color: #0f172a !important;
}

html.light .msg-thread-item.active p,
html.light .msg-thread-item.is-selected p,
html.light .msg-thread-item.bg-\[\#23171a\] p,
html.light .msg-thread-item.bg-slate-500\/10 p {
    color: #475569 !important;
}

html.light .msg-thread-item.active .text-\[\#9e8b90\],
html.light .msg-thread-item.is-selected .text-\[\#9e8b90\],
html.light .msg-thread-item.bg-\[\#23171a\] .text-\[\#9e8b90\],
html.light .msg-thread-item.bg-slate-500\/10 .text-\[\#9e8b90\] {
    color: #64748b !important;
}

/* Chat Messages Bubble Light Mode Readability */
html.light #chatMessagesStream .inset-surface,
html.light #chatMessagesStream .bg-\[\#1c1215\] {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}