:root {
    /* Global Color Palette */
    --primary-dark: #1B221E;
    --contextual-dark: #36443C;
    --mid-tone-neutral: #DDE4E0;
    --primary-light: #F4F6F5;
    --primary-accent: #DD502C;

    /* Legacy Mappings */
    --bg-color: var(--primary-light);
    --text-primary: var(--primary-dark);
    --text-secondary: var(--contextual-dark);
    --border-color: var(--mid-tone-neutral);
    --grid-border: var(--mid-tone-neutral);
    --primary-color: var(--contextual-dark);
    
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --border-radius: 12px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* GLOBAL DESIGN OVERHAUL OVERRIDES */
body, button, input, select, textarea {
    font-family: var(--font-family) !important;
}

/* Global Navigation Overhaul */
#global-nav-header {
    font-family: 'Inter', sans-serif;
}
.top-nav-bar {
    background-color: #36443C !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
}
.top-bar-logo img {
    height: 42px;
}
.top-bar-right, .top-bar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}
.top-nav-btn {
    background: var(--primary-accent);
    color: white !important;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.sign-out-icon {
    color: #f1f3f5 !important;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Main Nav Bar */
.main-nav-bar {
    background-color: white !important;
    border-bottom: 2px solid #36443C;
    display: flex;
    justify-content: center;
    padding: 0 24px;
}
.main-nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}
.nav-item {
    position: relative;
    padding: 6px 0;
}
.nav-link {
    color: #36443C !important;
    text-decoration: none !important;
    font-weight: 400;
    transition: transform 0.2s ease, font-weight 0.2s ease;
    display: inline-block;
}
.nav-link.active {
    font-weight: 700 !important;
    text-shadow: 0 0 .01px #36443C, 0 0 .01px #36443C; /* Extra bold trick in case of font failure */
}
.nav-link:hover {
    transform: translateY(-2px);
}

/* Dropdown Menu */
.has-dropdown {
    cursor: pointer;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #DDE4E0;
    border: 1px solid #36443C;
    border-radius: 4px;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    flex-direction: column;
}
.dropdown-menu.show {
    display: flex;
}
.dropdown-item {
    padding: 8px 12px;
    color: #36443C !important;
    text-decoration: none !important;
    font-size: 14px;
    transition: transform 0.2s ease;
    display: block;
    text-align: center;
}
.dropdown-item:hover {
    transform: translateY(-2px);
    background-color: rgba(54, 68, 60, 0.05);
}

/* Table Headers */
th {
    background-color: var(--mid-tone-neutral) !important;
    text-align: center !important;
    text-transform: none !important;
}

/* Form Accents */
input[type="radio"], input[type="checkbox"] {
    accent-color: var(--primary-accent) !important;
}

/* Pill Shapes */
button, .btn, .primary-btn, .secondary-btn, .tab-btn {
    font-weight: 600 !important;
}

button, .btn, .primary-btn, .secondary-btn, .tab-btn, 
input[type="text"], input[type="email"], input[type="password"], input[type="search"], 
select {
    border-radius: 9999px !important;
    box-shadow: none !important; /* Strip legacy 3D bevels */
    border-style: solid !important;
    font-family: inherit !important;
}

/* Standard Shapes */
textarea, .settings-card, .modal-content, .outreach-page, .dialog {
    border-radius: 12px !important;
}

/* FAB */
.fab-button, #create-post-fab, .fab, .fab-wrapper .btn {
    background: var(--primary-accent) !important;
}

/* Button Interactivity */
.btn.primary, .primary-btn, .primary {
    transition: all 0.2s ease !important;
    background: #36443C !important;
    color: #F4F6F5 !important;
    border-color: #36443C !important;
}

.btn.primary:hover, .primary-btn:hover, .primary:hover {
    background: #36443C !important;
    color: #F4F6F5 !important;
    border-color: #36443C !important;
    box-shadow: 0 4px 14px rgba(54, 68, 60, 0.4) !important;
    transform: translateY(-1px) !important;
    filter: brightness(1.15) !important;
}

.btn.primary:active, .primary-btn:active, .primary:active {
    transform: translateY(1px) scale(0.98) !important;
    box-shadow: none !important;
}

/* Glassmorphism */
.sticky-header, .dialog footer, .notification-tray-backdrop, .modal-header {
    background: rgba(244, 246, 245, 0.75) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

/* Deep Glassmorphism for Drawer */
.post-creator-container, .drawer-content {
    background: rgba(244, 246, 245, 0.45) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}

/* To Do List Progress Colors */
.status-not-started { background-color: #fee2e2 !important; color: #991b1b !important; }
.status-in-progress { background-color: #fef3c7 !important; color: #92400e !important; }
.status-done { background-color: #dcfce7 !important; color: #166534 !important; }
.status-on-hold { background-color: #e0f2fe !important; color: #075985 !important; }
.status-coming-up { background-color: #f3e8ff !important; color: #6b21a8 !important; }

select.progress-select {
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    border: none !important;
    appearance: none;
    -webkit-appearance: none;
    padding: 6px 36px 6px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' 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;
    background-size: 14px;
    border-radius: 9999px !important;
    display: inline-block;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-nav-header {
    width: 100%;
    background-color: var(--white);
    padding: 1.25rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.header-logo {
    height: 60px;
    object-fit: contain;
    transform: translateY(-4px);
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.main-nav a:hover {
    color: var(--primary-color);
}

.planner-canvas-frame {
    background-color: var(--white);
    max-width: 1400px;
    width: 95%;
    min-height: calc(100vh - 140px);
    height: auto;
    margin: 3rem auto;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    margin-top: 1.5rem;
}

.app-header {
    width: 95%;
    max-width: 1400px;
    margin: 2rem auto 0 auto;
}

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

#calendar-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.mode-toggle {
    display: flex;
    gap: 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.control-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

select, input[type="number"], input[type="date"] {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--white);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease-in-out;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

select:focus, input[type="number"]:focus, input[type="date"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input[type="number"] {
    width: 90px;
}

.calendar-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 0.5rem;
    background-color: var(--white);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--grid-border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.calendar-header div {
    text-align: right;
    padding-right: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    /* Set a reasonable minimum height for the calendar cells to look like a planner */
    grid-auto-rows: auto;
    gap: 1px;
    background-color: var(--grid-border);
    border: 1px solid var(--grid-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    flex: 1 0 auto;
}

.calendar-day, .calendar-empty {
    background-color: var(--white);
    padding: 0.75rem;
    position: relative;
    transition: background-color 0.2s ease;
    display: block;
    min-height: 120px;
    height: auto !important;
}

.calendar-day:hover {
    background-color: #f4f8fd; /* Very subtle blue tint on hover */
}

.calendar-empty {
    background-color: #f8fafc; /* Slightly darker than white for empty spaces */
}

.date-number {
    float: right;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.calendar-day .first-of-month-badge {
    width: auto;
    height: 28px;
    padding: 0 0.75rem;
    border-radius: 14px;
    background-color: var(--primary-color);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
}

.calendar-day.today .date-number {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

.calendar-day.today .first-of-month-badge {
    background-color: #1e3a8a; /* darker blue to distinguish */
}

/* Settings Area */
.settings-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto 4rem auto;
}

.settings-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.settings-card {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.settings-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
}

.settings-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.platform-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.platform-chip, .other-platform-input {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.platform-chip i {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.platform-chip:hover {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.platform-chip.active {
    background-color: var(--brand-color, var(--primary-color));
    color: var(--white);
    border-color: var(--brand-color, var(--primary-color));
}

.platform-chip.active:hover {
    filter: brightness(0.9);
}

.other-platform-input {
    width: 140px;
    cursor: text;
}

.other-platform-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Frequency Area */
.frequency-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.frequency-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.freq-platform-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.freq-platform-name i {
    font-size: 1.2rem;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

.freq-days {
    display: flex;
    gap: 0.5rem;
}

.freq-day-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    font-family: inherit;
}

.freq-day-btn:hover {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.freq-day-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.freq-select-all {
    display: flex;
    align-items: center;
    border-left: 1px solid var(--border-color);
    padding-left: 0.5rem;
    margin-left: 0.5rem;
}

.freq-select-all-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.freq-select-all-btn:hover {
    background-color: #f1f5f9;
}

.freq-select-all-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Calendar Event Badges */
.event-rows {
    clear: both;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 0.5rem;
    flex: none;
    align-items: flex-start;
}

.calendar-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--brand-color, var(--primary-color));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.calendar-event-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.calendar-event-text {
    font-size: 0.85rem;
    white-space: normal;
    flex-grow: 1;
    word-break: break-word;
    overflow-wrap: break-word;
}

.post-details-link {
    word-break: break-word;
    overflow-wrap: break-word;
}

.post-details-link:hover {
    text-decoration: underline !important;
}
.scheduled-post-badge:hover {
    opacity: 0.8;
}

.scheduled-post-badge .text-icon, .scheduled-post-badge i {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    margin-right: 6px;
    flex-shrink: 0;
}

.badge-text {
    font-size: 0.75rem;
    white-space: nowrap; flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.empty-state-msg {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-style: italic;
}

.text-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
}

/* URL Shortener Styles */
.page-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem auto;
    width: 95%;
    max-width: 1400px;
}

.url-shortener-container {
    margin-top: 0;
}

.shortener-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.shortener-form input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.shortener-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.primary-btn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 1rem;
    font-family: inherit;
}

.primary-btn:hover {
    background-color: #2563eb;
}

.primary-btn:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

.shortlink-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 1rem;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.shortlink-box a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    font-size: 1.1rem;
    flex: 1;
    word-break: break-all;
}

.shortlink-box a:hover {
    text-decoration: underline;
}

.secondary-btn {
    background-color: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.secondary-btn:hover {
    background-color: #f1f5f9;
}

.error-msg {
    color: #ef4444;
    margin-top: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Post Creator Layout */
.post-creator-container {
    position: fixed;
    top: 0;
    right: -100%;
    width: 32%;
    min-width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    padding: 24px;
    margin: 0;
    box-shadow: -4px 0 15px rgba(0,0,0,0.2);
}

.post-creator-container.drawer-open {
    right: 0;
}

.drawer-step { display: none; flex-direction: column; }
.drawer-step.active { display: flex; }
.drawer-footer { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-top: 24px; padding-top: 24px; border-top: 1px solid #e2e8f0; 
}
.drawer-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 24px; color: var(--text-primary); }

.work-zone-panel {
    background-color: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 24px;
}

.section-sub-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.015em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.topic-group-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
}

.topic-group-label:first-child {
    margin-top: 0;
}

/* Platform Post Templates */
.platform-template-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.guideline-text {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.guideline-text strong {
    color: var(--text-primary);
}

.template-form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.template-textarea, .template-input, .media-upload-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: all 0.2s ease;
    background-color: var(--white);
}

.template-textarea {
    min-height: 120px;
    resize: vertical;
}

.template-textarea:focus, .template-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.char-counter {
    font-size: 0.8rem;
    color: #64748b;
    text-align: right;
    font-weight: 500;
}

.text-red {
    color: #ef4444 !important;
    font-weight: bold;
}

.template-shortener-box {
    background-color: #f1f5f9;
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
}

.inline-shortener {
    flex-direction: column;
    margin-bottom: 0;
}

.inline-shortlink-box {
    margin-top: 1rem;
    background-color: var(--white);
}

.preview-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.preview-link:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.preview-modal-content {
    background-color: var(--background-color);
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.preview-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--white);
    border-radius: 12px 12px 0 0;
}

.preview-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s ease;
}

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

/* Facebook Mockup */
.fb-post-mockup {
    background-color: var(--white);
    padding: 1rem 0;
    overflow-y: auto;
}

.fb-mockup-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem 0.75rem 1rem;
}

.fb-mockup-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e2e8f0;
}

.fb-mockup-author {
    display: flex;
    flex-direction: column;
}

.fb-mockup-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #050505;
}

.fb-mockup-time {
    font-size: 0.8rem;
    color: #65676B;
}

.fb-mockup-body {
    padding: 0 1rem 0.5rem 1rem;
    font-size: 0.95rem;
    color: #050505;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.fb-mockup-hashtags {
    padding: 0 1rem 0.75rem 1rem;
    font-size: 0.95rem;
    color: #1877F2;
    font-weight: 500;
    word-break: break-word;
}

.fb-mockup-media {
    width: 100%;
}

.fb-mockup-media img, .fb-mockup-media video {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

.fb-mockup-footer {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 1rem 0 1rem;
    border-top: 1px solid #CED0D4;
    margin-top: 0.5rem;
}

.fb-mockup-footer span {
    font-size: 0.95rem;
    color: #65676B;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Section 4 Assign Date */
.mini-calendar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-height: 400px;
    overflow-y: auto;
}

.mini-cal-month-block {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.mini-cal-month-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ef4444; /* red header from screenshot */
    margin-bottom: 0.75rem;
}

.mini-cal-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.5rem;
}

.mini-cal-header div {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.mini-cal-grid > div {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}

.mini-cal-date {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #cbd5e1;
    background-color: transparent;
    cursor: default;
    user-select: none;
    font-weight: 500;
}

.mini-cal-date.active {
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mini-cal-date.active:hover {
    background-color: #f1f5f9;
}

.mini-cal-date.selected {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.post-preview-summary {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.post-preview-summary h4 {
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.post-preview-summary p {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.summary-post-preview {
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    background-color: #f8fafc;
    font-size: 0.85rem;
    transform: scale(0.9);
    transform-origin: top left;
    width: 111%;
}

/* Post Details Modal */
.post-details-ui {
    max-width: 800px;
}

.post-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: #f8fafc;
    overflow-y: auto;
}

.details-left-col {
    background-color: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0;
    overflow: hidden;
}

.details-right-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.details-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.copy-box {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
}

.copy-box p, .copy-box a {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-word;
    flex-grow: 1;
}

.icon-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    color: var(--primary-color);
    background-color: #eff6ff;
}

.muted-text {
    color: #64748b;
    font-size: 0.95rem;
}

.post-details-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--white);
    border-radius: 0 0 12px 12px;
}

.calendar-badge {
    cursor: pointer;
    transition: opacity 0.2s;
}

.calendar-badge:hover {
    opacity: 0.8;
}

.calendar-badge-text {
    font-size: 0.75rem;
    white-space: nowrap; flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 4px;
    font-weight: 500;
}

.post-creator-platforms {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-creator-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    user-select: none;
}

.post-creator-chip:hover {
    border-color: var(--primary-color);
    background-color: #f8fafc;
}

.post-creator-chip.active {
    border-color: var(--brand-color, var(--primary-color));
    background-color: var(--brand-color, var(--primary-color));
    color: var(--white);
}

.post-creator-chip i {
    font-size: 1.1rem;
}

.topic-dropdowns {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.custom-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    appearance: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    font-family: inherit;
    /* Custom arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' 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 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.custom-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.custom-select option {
    padding: 0.5rem;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.custom-checkbox:hover {
    background-color: #f8fafc;
}

.custom-checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}


.cross-platform-badge {
    background-color: #475569;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap; flex-shrink: 0;
    margin-left: 6px;
    margin-right: -4px;
}

/* Phase 1 Refactor Overrides */
.side-section h4, #settings-modules h4, #survey-settings-modules h4, .sidebar-header {
    background-color: var(--contextual-dark) !important;
    color: var(--white) !important;
}

.builder-block:hover, .builder-block.active,
.content-module-wrapper:hover, .content-module-wrapper.active {
    border-color: var(--primary-accent) !important;
}

.builder-block .drag-handle, .module-drag-handle {
    background-color: var(--primary-accent) !important;
}

/* Rap Sheet Builder specific styles */
.rap-sheet-section {
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2.5rem;
}
.rap-sheet-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.rubric-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}
.rubric-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--white);
}
.rubric-col:last-child {
    border-right: none;
}
.rubric-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.rubric-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.rubric-col textarea {
    border: none;
    resize: none;
    padding: 1rem;
    width: 100%;
    height: 100%;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}
.preview-section {
    margin-bottom: 2rem;
}
.preview-section-title {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}
.preview-text {
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

@media print {
    body {
        background: white;
    }
    .no-print, .main-nav-header, .app-header, .planner-canvas-frame {
        display: none !important;
    }
    #rs-preview-modal {
        display: block !important;
        position: static;
        background: transparent;
        padding: 0;
    }
    #rs-preview-modal .preview-modal-content {
        box-shadow: none;
        max-width: 100%;
        margin: 0;
    }
    #rs-preview-modal .modal-footer {
        display: none !important;
    }
    #print-area {
        padding: 0 !important;
    }
}

/* ==========================================================================
   PLANNER TABS
   ========================================================================== */
.planner-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.planner-tabs-row {
  align-items: center;
  border-bottom: 2px solid #e9ecef;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 14px;
}
.tab-btn {
  border: 0;
  border-radius: 50px;
  background: #fff;
  color: #6c757d;
  font-weight: 900;
  padding: 12px 22px;
  cursor: pointer;
  font-size: 1rem;
  white-space: nowrap !important;
}
.tab-btn.active {
  background: var(--primary-color, #3b82f6);
  color: #fff;
}
.tab-btn:hover:not(.active) {
  background: #f1f3f5;
  color: var(--primary-color, #3b82f6);
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* ==========================================================================
   PLANNING TAB
   ========================================================================== */
.planning-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
@media (max-width: 900px) {
    .planning-grid-2col {
        grid-template-columns: 1fr;
    }
}
.planning-col {
    display: flex;
    flex-direction: column;
}
.planning-platforms-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.planning-platforms-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #495057;
    cursor: pointer;
}
.planning-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
}
.planning-table th {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
}
.planning-table td {
    border: 1px solid #e2e8f0;
    padding: 0;
}
.planning-table td:first-child:not(:has(.template-input)) {
    padding: 10px 12px;
    font-size: 0.95rem;
    font-weight: 500;
}
.planning-table td .template-input:not(.progress-select) {
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    outline: none !important;
    width: 100% !important;
    box-shadow: none !important;
    height: 100%;
    min-height: 40px;
    padding: 10px 12px;
}
.planning-table td .template-input:not(.progress-select):focus {
    background: #fff !important;
    box-shadow: inset 0 0 0 2px var(--primary-color) !important;
}

/* ========================================================================== */
/* BLUESKY FEED (LINK LIBRARY)                                                */
/* ========================================================================== */

.link-library-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    height: calc(100vh - 180px); /* Account for top headers */
    background-color: var(--white);
}

.bsky-sidebar {
    background: linear-gradient(to bottom, #1B221E 0%, #36443C 100%); /* Carbon Black to Charcoal Brown gradient */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

/* Link Library Content Styles */
.permanent-links-container {
    padding: 40px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.link-library-section {
    margin-bottom: 48px;
}

.link-library-section h2 {
    color: #36443C;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    border-bottom: 2px solid #EBE9E1;
    padding-bottom: 8px;
}

.library-resource {
    margin-bottom: 32px;
}

.library-resource-title {
    display: block; /* Force the source badge to the next line */
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    margin-bottom: 4px;
}

.library-resource-title:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.library-resource-source {
    display: inline-block;
    background-color: #f1f3f4;
    color: #5f6368;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 8px;
    margin-bottom: 12px;
}

.library-resource-annotation {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4a4a4a;
    margin: 0;
}

.library-bookmarks {
    background-color: #f1f4f2;
    border: 1px solid #dcdede;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 48px;
}

.library-bookmarks h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #36443C;
    font-size: 1.2rem;
}

.library-bookmarks ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.library-bookmarks a {
    color: #36443C;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s ease;
}

.library-bookmarks a i {
    font-size: 0.9rem;
    color: var(--primary-color);
}

.library-bookmarks a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.sidebar-header {
    flex-shrink: 0;
    padding: 32px 24px 16px 24px;
    z-index: 2;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 24px 32px 24px;
}

.sidebar-title {
    color: #F4F6F5; /* White Smoke */
    margin-bottom: 4px;
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-subtitle {
    color: #DDE4E0; /* Alabaster Grey */
    display: block;
    margin-bottom: 24px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.sidebar-subtitle:hover {
    color: #DD502C; /* Fiery Terracotta */
}

.bsky-feed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

.bsky-post-tile {
    background: rgba(255, 255, 255, 0.65); /* Increased glassmorphic transparency */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.bsky-post-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.bsky-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.bsky-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e2e8f0;
    object-fit: cover;
}

.bsky-post-author-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.bsky-post-name {
    font-weight: 700;
    color: #111827;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bsky-post-handle {
    color: #6b7280;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bsky-post-body {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
}

.bsky-post-media img {
    width: 100%;
    border-radius: 8px;
    margin-top: 8px;
}

.bsky-post-footer {
    font-size: 0.85rem;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
}

/* Glassmorphic Styles for unionkit */
.glass-dark {
    background: rgba(30, 30, 30, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}
.glass-input {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: whitesmoke !important;
}
.glass-input:focus {
    border-color: #e07a5f !important;
    outline: none;
}

/* UI Refinements */
.btn.danger {
    background-color: transparent !important;
}
.safe-note {
    background-color: #DDE4E0 !important;
    color: #36443C !important;
    border: none !important;
    border-left: 4px solid var(--primary-accent) !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    margin-bottom: 14px !important;
}
.module-card.primary {
    background-color: var(--primary-accent) !important;
    border-color: var(--primary-accent) !important;
    color: white !important;
}
.survey-fab-main, .survey-canvas-fab .survey-fab-main {
    background-color: var(--primary-accent) !important;
    border-color: var(--primary-accent) !important;
}
.text-link, a, .linklike {
    color: var(--primary-accent) !important;
    text-decoration: underline;
    cursor: pointer;
}
body .outreach-page .btn.accent,
body .outreach-modal .btn.accent,
body .btn.accent {
    background-color: var(--primary-accent) !important;
    color: white !important;
    border-color: var(--primary-accent) !important;
}
body .outreach-page .btn.accent:hover,
body .outreach-modal .btn.accent:hover,
body .btn.accent:hover {
    background-color: #C03B1E !important;
}
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
}
.icon-btn:hover { 
    background: var(--mid-tone-neutral); 
}
