/* ============================
   Sidebar Gradient (Ocean Theme)
   ============================ */
.blob-bg {
    background: linear-gradient(135deg, #2d8b8b 0%, #1a2332 100%);
}

/* ============================
   Start Mode Cards
   ============================ */
.start-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.start-mode-card:hover {
    border-color: #2d8b8b;
    box-shadow: 0 4px 12px rgba(45, 139, 139, 0.15);
    transform: translateY(-2px);
}

.start-mode-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-bottom: 8px;
}

/* ============================
   Sidebar Arrow Hint
   ============================ */
.sidebar-arrow-hint {
    position: fixed;
    top: 50%;
    left: 270px;
    transform: translateY(-50%);
    font-size: 48px;
    color: #2d8b8b;
    z-index: 100;
    animation: bounceLeft 0.6s ease-in-out infinite;
    filter: drop-shadow(0 2px 8px rgba(45, 139, 139, 0.4));
    transition: opacity 0.5s ease;
}

.sidebar-arrow-hint.fade-out {
    opacity: 0;
}

@keyframes bounceLeft {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(-16px); }
}

/* ============================
   Loading Overlay (centered pill with bouncing dots)
   ============================ */
.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(240, 253, 253, 0.6);
    backdrop-filter: blur(2px);
}

.loading-overlay.hidden {
    display: none !important;
}

.loading-pill {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    padding: 16px 28px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(45, 139, 139, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(45, 139, 139, 0.15);
}

.loading-pill-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #2d8b8b;
}

.loading-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2d8b8b;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Alternates loading — same pill style inline */
.alternates-loading-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(45, 139, 139, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(45, 139, 139, 0.12);
    margin: 20px auto;
    width: fit-content;
}

.alternates-loading-pill .loading-dots span {
    width: 6px;
    height: 6px;
}

.alternates-loading-pill .loading-pill-text {
    font-size: 0.85rem;
}

/* ============================
   Chat Message Styles (Ocean Theme)
   ============================ */
.chat-msg-user {
    background: #2d8b8b;
    color: #f1faee;
    border-radius: 18px 18px 4px 18px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
    margin-left: auto;
    max-width: 80%;
}

.chat-msg-assistant {
    background: #a8dadc;
    color: #1a2332;
    border-radius: 18px 18px 18px 4px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
    margin-right: auto;
    max-width: 90%;
}

.chat-msg-assistant.preview-msg {
    background: transparent;
    padding: 0;
    max-width: 100%;
}

/* ============================
   Catalog Sidebar Styles
   ============================ */
.catalog-scroll::-webkit-scrollbar {
    width: 4px;
}
.catalog-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.catalog-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}
.catalog-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}

.catalog-category {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    user-select: none;
}
.catalog-category:hover {
    background: rgba(255,255,255,0.1);
}

.catalog-topics {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.catalog-topics.open {
    max-height: 500px;
}

.catalog-topic {
    cursor: pointer;
    padding: 5px 10px 5px 24px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.catalog-topic:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ============================
   PDF Preview Styles — fixed 8.5 × 11 in
   ============================ */
.pdf-infosheet {
    --theme-color: #1a5276;
    background: #ffffff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    /* Fixed letter-size: 8.5in × 11in at 96 dpi */
    width: 816px;
    min-height: 1056px;
    max-height: 1056px;
    margin: 0 auto;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

/* Applied during PDF export */
.pdf-infosheet.pdf-export-mode {
    overflow: visible !important;
    max-height: none !important;
}
.pdf-export-mode .pdf-key-points li {
    border-bottom: none !important;
}
.pdf-export-mode .pdf-org-card .org-website {
    line-height: 2 !important;
    padding-bottom: 4px !important;
}
.pdf-export-mode .pdf-org-card .org-description {
    line-height: 1.6 !important;
    padding-bottom: 2px !important;
}

/* --- Section 1: Header Banner --- */
.pdf-header {
    background: linear-gradient(135deg, var(--theme-color) 0%, color-mix(in srgb, var(--theme-color) 70%, #3498db) 50%, color-mix(in srgb, var(--theme-color) 40%, #3498db) 100%);
    color: white;
    text-align: center;
    position: relative;
    height: 290px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.pdf-header.has-hero {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: grab;
}

/* Background image resize handle — bottom-right corner */
.bg-resize-handle {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 3px;
    border: 1.5px solid rgba(0, 0, 0, 0.3);
}

.bg-resize-handle::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid rgba(0, 0, 0, 0.5);
}

.pdf-header:hover .bg-resize-handle,
.pdf-header.bg-editing .bg-resize-handle {
    opacity: 1;
}

/* Change image button — top-right */
.bg-change-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s, background 0.15s;
    font-size: 0.85rem;
}

.bg-change-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.pdf-header:hover .bg-change-btn {
    opacity: 1;
}

/* "Update Background Image" button for headers with no hero — top right */
.add-hero-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    z-index: 5;
    opacity: 0;
    white-space: nowrap;
}

.pdf-header:hover .add-hero-btn {
    opacity: 1;
}

.add-hero-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.add-hero-btn i {
    font-size: 15px;
}

.pdf-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--theme-color);
    z-index: 2;
}

/* White title box — centered in header */
.pdf-title-box {
    background: rgba(255, 255, 255, 0.92);
    width: 480px;
    max-width: 100%;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 24px 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    text-align: center;
}

.pdf-observance-name {
    font-family: Georgia, 'DejaVu Serif', 'Times New Roman', serif;
    font-size: calc(1.45rem * var(--title-scale, 1));
    font-weight: 700;
    color: var(--theme-color);
    line-height: 1.25;
    margin-bottom: 0.35rem;
}

.pdf-ml-title {
    font-size: calc(0.9rem * var(--title-scale, 1));
    font-weight: 400;
    color: #555;
    line-height: 1.3;
}

/* Logo wrapper — in-flow inside title box, draggable */
.pdf-logo-wrap {
    margin-top: auto;
    margin-bottom: 8px;
    cursor: grab;
    position: relative;
    z-index: 4;
    display: inline-block;
}

.pdf-company-logo {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    transform-origin: center center;
    pointer-events: auto;
    cursor: grab;
}

.pdf-company-logo.logo-dragging {
    cursor: grabbing;
}

/* Logo resize handle — bottom-right of logo */
.logo-resize-handle {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s;
    background: rgba(45, 139, 139, 0.8);
    border-radius: 2px;
}

.logo-resize-handle::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid white;
    border-bottom: 1.5px solid white;
}

.pdf-logo-wrap:hover .logo-resize-handle,
.pdf-logo-wrap:hover .logo-toggle-btn {
    opacity: 1;
}

/* Logo upload prompt for standalone users */
.pdf-logo-upload-prompt {
    cursor: default;
    margin-bottom: 16px;
}

.logo-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px dashed rgba(45, 139, 139, 0.5);
    border-radius: 8px;
    color: rgba(45, 139, 139, 0.8);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.6);
}

.logo-upload-label:hover {
    border-color: rgba(45, 139, 139, 0.9);
    color: rgba(45, 139, 139, 1);
    background: rgba(255, 255, 255, 0.9);
}

.logo-upload-label i {
    font-size: 16px;
}

@media print {
    .pdf-logo-upload-prompt {
        display: none !important;
    }
}

/* Logo hide/show toggle — top-right of logo wrap */
.logo-toggle-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    opacity: 0;
    transition: opacity 0.2s, background 0.15s;
    padding: 0;
    line-height: 1;
}
.logo-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.logo-change-btn {
    position: absolute;
    top: -6px;
    right: 18px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(45, 139, 139, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    opacity: 0;
    transition: opacity 0.2s, background 0.15s;
    padding: 0;
    line-height: 1;
}
.logo-change-btn:hover {
    background: rgba(45, 139, 139, 1);
}
.pdf-logo-wrap:hover .logo-change-btn {
    opacity: 1;
}

/* Box controls — inside title box bottom, visible on hover */
.pdf-box-controls {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    border-radius: 6px;
    padding: 4px 12px;
    display: flex;
    gap: 10px;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.pdf-title-box:hover .pdf-box-controls {
    opacity: 1;
    pointer-events: auto;
}

.box-ctrl-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.box-ctrl-row label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.6rem;
}

.box-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.box-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.box-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.box-reset-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    padding: 1px 6px;
    cursor: pointer;
    font-size: 0.6rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.box-reset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.pdf-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 300;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* --- Script-style headings --- */
.pdf-script-heading {
    font-size: calc(1.05rem * var(--title-scale, 1));
    font-weight: 400;
    color: #333;
    margin-bottom: 0.6rem;
    line-height: 1.3;
    text-align: center;
    position: relative;
}

/* Per-heading +/- size buttons (hover-only, no-print) */
.title-size-buttons {
    position: absolute;
    top: -6px;
    right: -6px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
}

.pdf-script-heading:hover .title-size-buttons,
.pdf-title-box:hover .title-size-buttons {
    opacity: 1;
}

.title-size-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    color: #2d8b8b;
    border: 1px solid rgba(45, 139, 139, 0.35);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: background 0.15s, color 0.15s;
}

.title-size-btn:hover {
    background: #2d8b8b;
    color: white;
}

.pdf-script-heading .script {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-size: calc(1.5rem * var(--title-scale, 1));
    font-weight: 700;
    color: var(--theme-color);
    display: block;
}

.pdf-script-heading.centered {
    text-align: center;
}

/* --- Section 2: Two-Column Body --- */
.pdf-body {
    padding: 0.75rem 1.25rem;
    flex: 1;
    min-height: 0;
}

.pdf-columns {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 1.25rem;
}

.pdf-column {
    min-width: 0;
}

/* Vibe toggle buttons */
.vibe-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pdf-column-left:hover .vibe-buttons {
    opacity: 1;
}

.vibe-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.6rem;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.vibe-story {
    border-color: #e9d5ff;
    color: #7c3aed;
}

.vibe-story:hover {
    background: #7c3aed;
    color: white;
    border-color: #7c3aed;
}

.vibe-data {
    border-color: #bfdbfe;
    color: #2563eb;
}

.vibe-data:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.vibe-btn:disabled {
    cursor: not-allowed;
}

/* Key points (left column) */
.pdf-key-points {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pdf-key-points li {
    position: relative;
    padding: 0.3rem 0 0.3rem 1rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #333;
    border-bottom: 1px solid #eee;
}

.pdf-key-points li:last-child {
    border-bottom: none;
}

.pdf-key-points li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: var(--theme-color);
    font-weight: bold;
    font-size: 0.9rem;
    line-height: 1.45;
}

.pdf-key-points li strong {
    color: var(--theme-color);
    font-weight: 700;
}

/* Media flow (right column) — single flex container for books + podcasts */
.pdf-media-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    position: relative;
}

/* Drag handle for repositioning the entire media grid */
.media-grid-drag-handle {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    color: #2d8b8b;
    border: 1px solid rgba(45, 139, 139, 0.35);
    border-radius: 4px;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    font-size: 0.85rem;
    z-index: 4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.media-grid-drag-handle:active { cursor: grabbing; }

.pdf-media-flow:hover .media-grid-drag-handle {
    opacity: 1;
}

.media-grid-drag-handle:hover {
    background: #2d8b8b;
    color: white;
}

body.media-grid-dragging,
body.media-grid-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

.pdf-media-flow > .pdf-media-item {
    flex: 0 0 calc((100% - 1rem) / 3);
    max-width: calc((100% - 1rem) / 3);
}

.pdf-media-item {
    text-align: center;
}

.pdf-media-item img {
    width: 100%;
    max-width: 100px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: block;
    margin: 0 auto 0.25rem;
}

.pdf-media-item .media-placeholder {
    width: 100%;
    max-width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: #888;
    margin: 0 auto 0.25rem;
}

.pdf-media-item .media-title {
    font-size: 0.73rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.pdf-media-item .media-author {
    font-size: 0.67rem;
    color: #666;
    font-style: italic;
}


/* --- Section 3: Get Involved --- */
.pdf-get-involved {
    background: #f8f9fa;
    padding: 0.75rem 1.25rem 0.75rem;
    border-top: 3px solid var(--theme-color);
    flex-shrink: 0;
    position: relative;
}

.pdf-orgs-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.pdf-org-card {
    text-align: center;
    position: relative;
    min-width: 0;
}

/* Bottom-section subtitle and title — inline-block so dashed outlines hug the text */
.pdf-get-involved .pdf-script-heading .script {
    display: inline-block;
}

.pdf-get-involved .pdf-script-heading .bottom-subtitle {
    display: inline-block;
}

/* Drag handle (top-left of card) */
.org-drag-handle {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 4px;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    font-size: 0.7rem;
    z-index: 3;
}

.org-drag-handle:active { cursor: grabbing; }

.pdf-org-card:hover .org-drag-handle {
    opacity: 1;
}

.org-drag-handle:hover {
    color: #2d8b8b;
    background: #fff;
}

/* Link toggle (top-right of card) */
.org-link-toggle {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2d8b8b;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    font-size: 0.75rem;
    padding: 0;
    z-index: 3;
}

.pdf-org-card:hover .org-link-toggle {
    opacity: 1;
}

.org-link-toggle:hover {
    background: #fff;
}

.org-link-toggle.is-off {
    color: #9ca3af;
}

/* Vertical column resize handle on right edge of cards 0 and 1 */
.org-resize-handle {
    position: absolute;
    top: 0;
    right: -10px;
    width: 14px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.org-resize-handle::before {
    content: '';
    width: 2px;
    height: 60%;
    background: rgba(45, 139, 139, 0.45);
    border-radius: 2px;
}

.pdf-org-card:hover .org-resize-handle,
.org-resize-handle:hover {
    opacity: 1;
}

.org-resize-handle:hover::before {
    background: #2d8b8b;
    width: 3px;
}

/* While a column resize drag is in progress: force col-resize cursor + suppress text selection */
body.org-resize-active,
body.org-resize-active * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.org-resize-active .org-resize-handle {
    opacity: 1;
}

.pdf-org-card .org-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--theme-color);
    text-decoration: underline;
    margin-bottom: 0.25rem;
    cursor: text;
}

a.org-name {
    display: block;
    color: var(--theme-color);
}

.pdf-org-card .org-description {
    font-size: 0.73rem;
    color: #444;
    line-height: 1.4;
}

.pdf-org-card .org-website-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 0.2rem;
    max-width: 100%;
}

.pdf-org-card .org-website {
    font-size: 0.67rem;
    color: var(--theme-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.pdf-org-card .org-visit-link {
    flex-shrink: 0;
    color: #2563eb;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.pdf-org-card:hover .org-visit-link {
    opacity: 1;
}

/* Bottom section accuracy warning */
.bottom-section-warning {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #fef3c7;
    color: #92400e;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 8px;
    border: 1px solid #fbbf24;
    white-space: nowrap;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.bottom-section-warning i {
    font-size: 0.75rem;
}

/* Footer */
.pdf-footer {
    background: linear-gradient(135deg, var(--theme-color) 0%, color-mix(in srgb, var(--theme-color) 60%, #3498db) 100%);
    color: white;
    text-align: center;
    padding: 0.4rem 1.25rem;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.pdf-footer p {
    margin: 0;
    opacity: 0.9;
}

/* ============================
   Inline Editing Styles
   ============================ */
.editable {
    cursor: text;
    border-radius: 3px;
    transition: outline 0.15s, background 0.15s;
    outline: 2px solid transparent;
}

.editable:hover {
    outline: 2px dashed rgba(45, 139, 139, 0.35);
    background: rgba(45, 139, 139, 0.03);
}

.editable:focus {
    outline: 2px solid #2d8b8b;
    background: rgba(45, 139, 139, 0.05);
}

/* ============================
   Drag-and-drop reorder
   ============================ */
.pdf-media-item[draggable="true"] {
    cursor: grab;
}

.pdf-media-item[draggable="true"]:active {
    cursor: grabbing;
}

.drag-active {
    opacity: 0.4;
}

.drag-over {
    outline: 2px dashed #2d8b8b;
    outline-offset: 2px;
    border-radius: 4px;
}

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

/* ============================
   Print Styles
   ============================ */
@media print {
    /* Reset the full-screen flex layout */
    body {
        background: white !important;
        overflow: visible !important;
        height: auto !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide EVERYTHING first */
    body * {
        visibility: hidden;
    }

    /* Then show only the PDF infosheet and its children */
    .pdf-infosheet,
    .pdf-infosheet * {
        visibility: visible !important;
    }

    /* Flatten the layout so the PDF can flow naturally */
    body,
    body > div,
    body > div > div,
    #chat-messages,
    #chat-messages-inner,
    .preview-msg {
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Sidebar: completely remove from flow */
    .blob-bg {
        display: none !important;
    }

    /* PDF infosheet print formatting */
    .pdf-infosheet {
        box-shadow: none !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        margin: 0 !important;
    }

    .pdf-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-header.has-hero {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-title-box {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-header::after {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-footer {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-get-involved {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .pdf-columns {
        grid-template-columns: 1.1fr 1fr !important;
    }

    .pdf-key-points li {
        break-inside: avoid;
    }

    .pdf-org-card {
        break-inside: avoid;
    }

    @page {
        size: letter portrait;
        margin: 0;
    }

    .editable {
        outline: none !important;
        cursor: default !important;
    }
}

/* ============================
   Alternates Selector
   ============================ */
.alternates-selector {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    max-width: 816px;
    margin-left: auto;
    margin-right: auto;
}

.alt-selector-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alt-section { margin-bottom: 12px; }
.alt-section:last-child { margin-bottom: 0; }

.alt-section-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alt-items-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.alt-item {
    flex: 0 0 auto;
    width: 100px;
    text-align: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}

.alt-item:hover {
    border-color: #2d8b8b;
    background: rgba(45, 139, 139, 0.05);
}

.alt-item.alt-selected {
    border-color: #2d8b8b;
    background: rgba(45, 139, 139, 0.1);
}

/* Alt item action buttons (delete + size toggle) */
.alt-item {
    position: relative;
}

.alt-item-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}

.alt-item:hover .alt-item-actions {
    opacity: 1;
}

.alt-add-btn,
.alt-delete-btn,
.alt-size-toggle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    line-height: 1;
}

.alt-add-btn {
    background: #27ae60;
    color: white;
}

.alt-add-btn:hover { background: #1e8449; }

.alt-delete-btn {
    background: #e74c3c;
    color: white;
}

.alt-delete-btn:hover { background: #c0392b; }

.alt-size-toggle {
    background: #2d8b8b;
    color: white;
}

.alt-size-toggle:hover { background: #1a6b6b; }

/* Cover wrap */
.alt-cover-wrap {
    cursor: pointer;
}

/* Book size: tall rectangle */
.alt-size-book .alt-cover-wrap img,
.alt-size-book .alt-placeholder {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    margin: 0 auto 6px;
    display: block;
}

/* Podcast size: square */
.alt-size-podcast .alt-cover-wrap img,
.alt-size-podcast .alt-placeholder {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    margin: 0 auto 6px;
    display: block;
}

.alt-placeholder {
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #888;
}

.alt-item-title { font-size: 0.7rem; font-weight: 600; color: #333; line-height: 1.3; }
.alt-item-author { font-size: 0.65rem; color: #666; font-style: italic; }
.alt-item-desc { font-size: 0.65rem; color: #555; line-height: 1.3; margin-top: 2px; }
.alt-item-relevance { font-size: 0.6rem; color: #2d8b8b; line-height: 1.3; margin-top: 3px; font-style: italic; }
.alt-item-link { font-size: 0.6rem; color: #1a5276; text-decoration: underline; display: block; margin-top: 2px; word-break: break-all; }
.alt-item-link:hover { color: #2d8b8b; }

.alt-org-item { width: 140px; text-align: left; }
.alt-orgs-row { flex-wrap: wrap; }

/* Alternate key points */
.alt-keypoints-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alt-keypoint-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.alt-keypoint-item:hover {
    border-color: #2d8b8b;
}

.alt-keypoint-text {
    flex: 1;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #333;
    outline: none;
    min-height: 1.2em;
}

.alt-keypoint-text:focus {
    border-bottom: 1px dashed #2d8b8b;
}

.alt-keypoint-text:empty::before {
    content: attr(placeholder);
    color: #aaa;
    font-style: italic;
}

.alt-keypoint-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.alt-keypoint-add {
    padding: 4px 0;
}

.alt-add-custom-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    color: #2d8b8b;
    background: none;
    border: 1px dashed #2d8b8b;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.alt-add-custom-btn:hover {
    background: #2d8b8b;
    color: white;
}

/* Download warning modal */
.download-warning-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s;
}

.download-warning-overlay.visible {
    background: rgba(0, 0, 0, 0.5);
}

.download-warning-modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.95) translateY(-10px);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.download-warning-overlay.visible .download-warning-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.download-warning-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fef3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.8rem;
    color: #d97706;
}

.download-warning-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 10px;
}

.download-warning-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.55;
    margin-bottom: 24px;
}

.download-warning-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-warning-factcheck {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid #f59e0b;
    color: #d97706;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.download-warning-factcheck:hover {
    background: #fef3c7;
}

.download-warning-proceed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    color: white;
    background: #2d8b8b;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.download-warning-proceed:hover {
    background: #1a2332;
}

/* Swap target overlay on PDF items */
.swap-target-overlay {
    position: absolute;
    inset: 0;
    background: rgba(45, 139, 139, 0.85);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    z-index: 10;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Delete button on infosheet book/podcast items */
.pdf-media-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: #e74c3c;
    color: white;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
    line-height: 1;
    padding: 0;
}

.pdf-media-item:hover .pdf-media-delete {
    opacity: 1;
}

.pdf-media-delete:hover {
    background: #c0392b;
}

/* Refresh cover button on infosheet items */
.pdf-media-refresh {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2d8b8b;
    color: white;
    border: none;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
    padding: 0;
}

.pdf-media-item:hover .pdf-media-refresh {
    opacity: 1;
}

.pdf-media-refresh:hover {
    background: #1a6b6b;
}

/* Delete button on key point bullets */
.pdf-key-points li {
    position: relative;
}

.pdf-keypoint-delete {
    position: absolute;
    top: 50%;
    right: -2px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e74c3c;
    color: white;
    border: none;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
    z-index: 5;
}

.pdf-key-points li:hover .pdf-keypoint-delete {
    opacity: 1;
}

.pdf-keypoint-delete:hover {
    background: #c0392b;
}

/* Verify links on infosheet covers */
.pdf-verify-link {
    display: block;
    text-align: center;
    font-size: 0.55rem;
    color: #2d8b8b;
    text-decoration: underline;
    margin-top: 2px;
    cursor: pointer;
}

.pdf-verify-link:hover {
    color: #1a5276;
}

/* Quick-action research buttons */
.alt-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.alt-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #2d8b8b;
    background: white;
    border: 1px solid #d0e8e8;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.alt-quick-btn:hover {
    background: #2d8b8b;
    color: white;
    border-color: #2d8b8b;
}

.alt-quick-btn i {
    font-size: 0.8rem;
}

/* Re-search box */
.alt-research-section {
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
}

.alt-research-box {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.alt-research-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.8rem;
    resize: vertical;
    font-family: inherit;
    min-height: 40px;
}

.alt-research-input:focus {
    outline: none;
    border-color: #2d8b8b;
}

.alt-research-btn {
    padding: 8px 16px;
    background: #2d8b8b;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    height: 40px;
}

.alt-research-btn:hover {
    background: #1a6b6b;
}

.alt-research-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Hide delete buttons, verify links, and hover hints in print */
@media print {
    .pdf-header::before,
    .pdf-box-controls,
    .bg-resize-handle,
    .add-hero-btn,
    .bg-change-btn,
    .logo-resize-handle,
    .logo-toggle-btn,
    .vibe-buttons,
    .pdf-media-delete,
    .pdf-media-refresh,
    .pdf-keypoint-delete,
    .pdf-verify-link,
    .org-visit-link,
    .org-drag-handle,
    .org-link-toggle,
    .org-resize-handle,
    .title-size-buttons,
    .media-grid-drag-handle,
    .bottom-section-warning,
    .section-mode-buttons {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .pdf-columns {
        grid-template-columns: 1fr;
    }
}

/* Floating jump-to-infosheet button */
#jump-to-infosheet-btn {
    position: fixed;
    bottom: 90px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #2d8b8b;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: background 0.15s;
}

#jump-to-infosheet-btn:hover {
    background: #1a6b6b;
}

/* Bottom section mode buttons */
.section-mode-buttons {
    display: none;
    justify-content: center;
    gap: 8px;
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.pdf-get-involved:hover .section-mode-buttons {
    display: flex;
}

.section-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(45, 139, 139, 0.12);
    color: #2d8b8b;
    border: 1px solid rgba(45, 139, 139, 0.3);
    border-radius: 14px;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.section-mode-btn:hover {
    background: #2d8b8b;
    color: white;
    border-color: #2d8b8b;
}

.section-mode-btn i {
    font-size: 0.75rem;
}

/* Hide alternates and floating UI in print */
@media print {
    .alternates-selector,
    .alternates-loading,
    .loading-overlay,
    .section-mode-buttons,
    #jump-to-infosheet-btn {
        display: none !important;
    }
}
