/* ==========================================================================
   AI RECIPE CHATBOX & AUTO-FORMATTING STUDIO STYLES
   ========================================================================== */

:root {
    --chat-bg: #FBFAF6;
    --chat-card-bg: #ffffff;
    --chat-border: #CECECE;
    --chat-text-main: #3B3B3B;
    --chat-text-muted: #767676;
    --chat-primary: #005FB8;
    --chat-primary-hover: #0258A8;
    --chat-primary-light: #ADCEFF22;
    --chat-accent: #005FB8;
    --chat-user-bubble: #1F1F1F;
    --chat-user-text: #ffffff;
    --chat-bot-bubble: #ffffff;
    --chat-amber: #d97706;
}

[data-bs-theme="dark"],
.dark-mode {
    --chat-bg: #181818;
    --chat-card-bg: #313131;
    --chat-border: #3C3C3C;
    --chat-text-main: #CCCCCC;
    --chat-text-muted: #9E9E9E;
    --chat-primary: #3794FF;
    --chat-primary-hover: #1E70D6;
    --chat-primary-light: rgba(55, 148, 255, 0.15);
    --chat-accent: #3794FF;
    --chat-user-bubble: #2B2B2B;
    --chat-user-text: #ffffff;
    --chat-bot-bubble: #252526;
    --chat-amber: #f59e0b;
}

/* Antigravity Theme: Whole page background canvas */
html,
body,
#wrapper,
main,
#main-content,
.main-content,
.content-wrapper,
.page-content,
.container-fluid,
.recipe-chat-studio-wrap {
    background-color: var(--chat-bg, #FBFAF6) !important;
    color: var(--chat-text-main, #3B3B3B);
}

.recipe-chat-studio-wrap {
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px 20px 240px 20px;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Suppress page bump up / scroll to top button in AI Studio */
.btn-scroll-up,
#btn-scroll-up,
.scrollup,
.btn-scroll-top,
.scroll-to-top,
.back-to-top,
[aria-label*="Scroll back to top" i],
[aria-label*="back to top" i] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -9999 !important;
}

/* Studio Header Row */
/* Studio Intro Info Box (No border lines, transparent background) */
.recipe-chat-infobox {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 0 16px 0 !important;
    margin-bottom: 16px !important;
    box-shadow: none !important;
    box-sizing: border-box;
    width: 100%;
}
[data-bs-theme="dark"] .recipe-chat-infobox,
.dark-mode .recipe-chat-infobox {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.infobox-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.infobox-icon {
    font-size: 1.05rem;
    line-height: 1;
}
.infobox-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--chat-text-main, #3B3B3B);
    line-height: 1.3;
}
[data-bs-theme="dark"] .infobox-title,
.dark-mode .infobox-title {
    color: #F0F0F0;
}
.infobox-desc {
    font-size: 0.82rem;
    color: var(--chat-text-muted, #666666);
    line-height: 1.5;
}
[data-bs-theme="dark"] .infobox-desc,
.dark-mode .infobox-desc {
    color: #AAAAAA;
}
.infobox-list {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--chat-text-main, #3B3B3B);
    margin-bottom: 10px;
}
.infobox-list li {
    margin-bottom: 4px;
}
.infobox-list strong {
    font-weight: 600;
    color: var(--chat-text-main, #1F1F1F);
}
[data-bs-theme="dark"] .infobox-list,
.dark-mode .infobox-list {
    color: #CCCCCC;
}
[data-bs-theme="dark"] .infobox-list strong,
.dark-mode .infobox-list strong {
    color: #FFFFFF;
}
.infobox-footer {
    border-top: 1px dashed var(--chat-border, #E2E2E2);
    padding-top: 8px;
    margin-top: 4px;
}
[data-bs-theme="dark"] .infobox-footer,
.dark-mode .infobox-footer {
    border-top-color: #3C3C3C;
}
.infobox-meta-status {
    font-size: 0.76rem;
    line-height: 1.4;
}
.infobox-meta-note {
    font-size: 0.74rem;
    line-height: 1.4;
}

/* Guide Modal Button in Chatbox Toolbar (Mobile View < 1024px) */
.composer-guide-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--chat-bg, #FBFAF6);
    border: 1px solid var(--chat-border, #CECECE);
    color: var(--chat-primary, #005FB8);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    font-size: 1.05rem;
}
.composer-guide-btn:hover {
    color: #005FB8;
    border-color: #005FB8;
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 95, 184, 0.15);
}
[data-bs-theme="dark"] .composer-guide-btn,
.dark-mode .composer-guide-btn {
    background: #313131;
    border-color: #3C3C3C;
    color: #3794FF;
}
[data-bs-theme="dark"] .composer-guide-btn:hover,
.dark-mode .composer-guide-btn:hover {
    color: #3794FF;
    border-color: #3794FF;
    background: #252526;
}

/* Main Two-Column Stage (Constrained to 800px Chatbox + 28px Gap + 350px Sidebar) */
.recipe-chat-stage {
    display: grid;
    grid-template-columns: minmax(0, 800px) 350px;
    justify-content: center;
    gap: 28px;
    align-items: flex-start;
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
}
.recipe-chat-main-area {
    min-width: 0;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}
.recipe-chat-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #FFFFFF;
    color: var(--chat-text-main, #3B3B3B);
    border: 1px solid var(--chat-border, #CECECE);
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
.recipe-chat-badge i {
    color: var(--chat-primary, #005FB8);
}
[data-bs-theme="dark"] .recipe-chat-badge,
.dark-mode .recipe-chat-badge {
    background: #252526;
    border-color: #3C3C3C;
    color: #CCCCCC;
}
[data-bs-theme="dark"] .recipe-chat-badge i,
.dark-mode .recipe-chat-badge i {
    color: #3794FF;
}
.recipe-chat-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--chat-text-main);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.recipe-chat-subtitle {
    font-size: 0.95rem;
    color: var(--chat-text-muted);
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Chat Stream Container */
.recipe-chat-stream {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

/* Message Rows: Avatar stacked ABOVE messages, response box expanded to full width */
.chat-msg {
    display: flex;
    flex-direction: column;
    width: 100%;
    animation: fadeInMsg 0.28s ease-out;
    box-sizing: border-box;
}
@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-bot {
    align-self: stretch;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    gap: 8px;
}
.chat-msg-bot .chat-avatar {
    align-self: flex-start;
    margin-bottom: 2px;
}
.chat-msg-bot .chat-bubble {
    width: 100%;
    max-width: 100%;
    background: var(--chat-bot-bubble);
    border: 1px solid var(--chat-border);
    color: var(--chat-text-main);
    border-radius: 18px;
    box-sizing: border-box;
}

.chat-msg-user {
    align-self: flex-end;
    align-items: flex-end;
    flex-direction: column;
    width: auto;
    max-width: 85%;
    gap: 6px;
}
.chat-msg-user .chat-avatar {
    align-self: flex-end;
    margin-bottom: 2px;
}
.chat-msg-user .chat-bubble {
    background: var(--chat-user-bubble);
    color: var(--chat-user-text);
    border-radius: 18px;
    border-top-right-radius: 4px;
    box-sizing: border-box;
    word-break: break-word;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    overflow: hidden;
}
.chat-avatar-bot {
    background: #005FB8;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 95, 184, 0.25);
}
.chat-avatar-user {
    background: #1F1F1F;
    color: #ffffff;
    border-radius: 11px;
    overflow: hidden;
}
[data-bs-theme="dark"] .chat-avatar-user,
.dark-mode .chat-avatar-user {
    background: #334155;
}
.chat-avatar-user.has-img,
.chat-avatar-user:has(img) {
    background: #ffffff !important;
    border: 1.5px solid var(--chat-border, #CECECE);
    padding: 0;
}
.chat-avatar-user img,
.chat-avatar-user .user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
    display: block;
}

.chat-bubble {
    padding: 16px 20px;
    font-size: 0.93rem;
    line-height: 1.55;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-bubble-typing {
    width: auto !important;
    max-width: fit-content !important;
    display: inline-block;
    padding: 10px 16px;
}

.chat-bot-response-content {
    width: 100%;
}

/* Attached Image Thumbnail in User Bubble */
.chat-user-photo-wrap {
    margin-bottom: 12px;
    border-radius: 14px;
    overflow: hidden;
    max-width: 260px;
    aspect-ratio: 4 / 3;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.chat-user-photo {
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

/* Typing Indicator */
.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
}
.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chat-accent);
    animation: typingPulse 1.2s infinite ease-in-out;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================================================
   INTERACTIVE RECIPE PREVIEW CARD
   ========================================================================== */
.recipe-preview-card {
    background: var(--chat-card-bg);
    border: 1px solid var(--chat-border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
    margin-top: 14px;
    width: 100%;
    max-width: 100%;
    color: var(--chat-text-main);
}

.recipe-preview-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 480px;
    background: #e2e8f0;
    overflow: hidden;
}
.recipe-preview-hero img {
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}
.recipe-preview-hero-placeholder {
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.08), rgba(5, 150, 105, 0.14));
    color: var(--chat-accent);
}
.recipe-preview-badges-bar {
    position: absolute;
    bottom: 12px;
    left: 14px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.recipe-preview-badge {
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
}

.recipe-preview-body {
    padding: 24px;
}

.recipe-preview-title-container {
    margin-bottom: 4px;
}

.recipe-preview-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--chat-text-main);
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 3px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, outline 0.15s ease;
}

.inline-edit-title-input,
.inline-edit-title-textarea {
    font-size: 1.45rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.35 !important;
    padding: 8px 12px !important;
    color: var(--chat-text-main) !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
}
.inline-edit-title-textarea {
    min-height: 48px !important;
    resize: none !important;
    overflow-y: hidden !important;
}
[data-bs-theme="dark"] .inline-edit-title-textarea,
.dark-mode .inline-edit-title-textarea {
    color: #f1f5f9 !important;
    background: #1e293b !important;
}

.recipe-preview-summary {
    font-size: 0.88rem;
    color: var(--chat-text-muted);
    line-height: 1.5;
    margin-bottom: 18px;
}

/* Time & Stats Pills - 2 Rows (Row 1: 4 columns at 25% each | Row 2: Difficulty 25%, Cuisine 25%, Category 50%) */
.recipe-preview-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.preview-stat-box {
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    padding: 10px 8px;
    text-align: center;
    min-width: 0;
}
.preview-stat-box.stat-box-difficulty {
    grid-column: 1 / span 1;
}
.preview-stat-box.stat-box-cuisine {
    grid-column: 2 / span 1;
}
.preview-stat-box.stat-box-category {
    grid-column: 3 / span 2;
}
.preview-stat-box[onclick] {
    cursor: pointer;
    transition: all 0.15s ease;
}
.preview-stat-box[onclick]:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.04);
}

@media (max-width: 576px) {
    .recipe-preview-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .preview-stat-box.stat-box-difficulty {
        grid-column: 1 / span 1;
    }
    .preview-stat-box.stat-box-cuisine {
        grid-column: 2 / span 1;
    }
    .preview-stat-box.stat-box-category {
        grid-column: 1 / span 2;
    }
}
.preview-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--chat-text-muted);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preview-stat-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--chat-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ingredients Section */
.recipe-preview-section-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--chat-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.recipe-preview-section-title i {
    color: var(--chat-accent);
}

.preview-ing-group {
    margin-bottom: 16px;
}
.preview-ing-group-name {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--chat-text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}
.preview-ing-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 42px;
}
.preview-ing-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 11px 18px;
    margin-bottom: 0;
    cursor: default;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.preview-ing-card:hover {
    border-color: #cbd5e1;
    background: #fafbfb;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

/* Drag Handles for Ingredients & Steps */
.ing-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 28px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    color: #94a3b8;
    font-size: 1.15rem;
    border-radius: 6px;
    margin-left: -6px;
    margin-right: -2px;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}
.ing-drag-handle:hover {
    color: var(--chat-primary, #064e3b);
    background: rgba(6, 78, 59, 0.08);
}
.ing-drag-handle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.step-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 32px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    color: #94a3b8;
    font-size: 1.25rem;
    border-radius: 8px;
    margin-left: -4px;
    margin-right: -4px;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}
.step-drag-handle:hover {
    color: var(--chat-primary, #064e3b);
    background: rgba(6, 78, 59, 0.08);
}
.step-drag-handle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* SortableJS drag states */
.sortable-ghost {
    opacity: 0.35 !important;
    background: rgba(6, 78, 59, 0.06) !important;
    border: 1.5px dashed var(--chat-primary, #059669) !important;
    border-radius: 14px !important;
}
.sortable-chosen {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12) !important;
    border-color: var(--chat-primary, #059669) !important;
}
.sortable-drag {
    cursor: grabbing !important;
    opacity: 0.95 !important;
    transform: scale(1.015);
}

/* Studio Floating Toast */
.studio-floating-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10050;
    background: #111827;
    color: #f9fafb;
    padding: 10px 18px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.studio-floating-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.preview-ing-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.preview-ing-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.preview-ing-check-box {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    border-radius: 7px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    box-sizing: border-box;
}
.preview-ing-check-box svg {
    width: 15px;
    height: 15px;
    stroke: #ffffff;
    stroke-width: 3;
    fill: none;
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.preview-ing-checkbox:checked + .preview-ing-check-box {
    background: #064e3b !important;
    border-color: #064e3b !important;
}
.preview-ing-checkbox:checked + .preview-ing-check-box svg {
    opacity: 1 !important;
    transform: scale(1) !important;
}
.preview-ing-name {
    font-size: 15.5px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
    line-height: 1.4;
    word-break: break-word;
}
.preview-ing-notes {
    font-size: 0.85rem;
    font-weight: 400;
    color: #64748b;
    margin-left: 6px;
}
.preview-ing-badge {
    background: #ecfdf5;
    color: #064e3b;
    font-weight: 700;
    font-size: 14.5px;
    padding: 5px 14px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

/* Dark mode for ingredients */
html[data-bs-theme="dark"] .preview-ing-card,
html[data-theme="dark"] .preview-ing-card,
[data-bs-theme="dark"] .preview-ing-card,
[data-theme="dark"] .preview-ing-card,
.dark-mode .preview-ing-card,
body.dark-mode .preview-ing-card {
    background: #18181b !important;
    border-color: #27272a !important;
    box-shadow: none !important;
}
html[data-bs-theme="dark"] .preview-ing-card:hover,
html[data-theme="dark"] .preview-ing-card:hover,
[data-bs-theme="dark"] .preview-ing-card:hover,
[data-theme="dark"] .preview-ing-card:hover,
.dark-mode .preview-ing-card:hover,
body.dark-mode .preview-ing-card:hover {
    border-color: #3f3f46 !important;
    background: #202024 !important;
}
html[data-bs-theme="dark"] .preview-ing-check-box,
html[data-theme="dark"] .preview-ing-check-box,
[data-bs-theme="dark"] .preview-ing-check-box,
[data-theme="dark"] .preview-ing-check-box,
.dark-mode .preview-ing-check-box,
body.dark-mode .preview-ing-check-box {
    background: #27272a !important;
    border-color: #52525b !important;
}
html[data-bs-theme="dark"] .preview-ing-checkbox:checked + .preview-ing-check-box,
html[data-theme="dark"] .preview-ing-checkbox:checked + .preview-ing-check-box,
[data-bs-theme="dark"] .preview-ing-checkbox:checked + .preview-ing-check-box,
[data-theme="dark"] .preview-ing-checkbox:checked + .preview-ing-check-box,
.dark-mode .preview-ing-checkbox:checked + .preview-ing-check-box,
body.dark-mode .preview-ing-checkbox:checked + .preview-ing-check-box {
    background: #10b981 !important;
    border-color: #10b981 !important;
}
html[data-bs-theme="dark"] .preview-ing-name,
html[data-theme="dark"] .preview-ing-name,
[data-bs-theme="dark"] .preview-ing-name,
[data-theme="dark"] .preview-ing-name,
.dark-mode .preview-ing-name,
body.dark-mode .preview-ing-name {
    color: #f8fafc !important;
}
html[data-bs-theme="dark"] .preview-ing-notes,
html[data-theme="dark"] .preview-ing-notes,
[data-bs-theme="dark"] .preview-ing-notes,
[data-theme="dark"] .preview-ing-notes,
.dark-mode .preview-ing-notes,
body.dark-mode .preview-ing-notes {
    color: #a1a1aa !important;
}
html[data-bs-theme="dark"] .preview-ing-badge,
html[data-theme="dark"] .preview-ing-badge,
[data-bs-theme="dark"] .preview-ing-badge,
[data-theme="dark"] .preview-ing-badge,
.dark-mode .preview-ing-badge,
body.dark-mode .preview-ing-badge {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
}

/* Dark mode for drag handles, ghost, and toast */
html[data-bs-theme="dark"] .ing-drag-handle,
html[data-theme="dark"] .ing-drag-handle,
[data-bs-theme="dark"] .ing-drag-handle,
[data-theme="dark"] .ing-drag-handle,
.dark-mode .ing-drag-handle,
body.dark-mode .ing-drag-handle,
html[data-bs-theme="dark"] .step-drag-handle,
html[data-theme="dark"] .step-drag-handle,
[data-bs-theme="dark"] .step-drag-handle,
[data-theme="dark"] .step-drag-handle,
.dark-mode .step-drag-handle,
body.dark-mode .step-drag-handle {
    color: #64748b;
}

html[data-bs-theme="dark"] .ing-drag-handle:hover,
html[data-theme="dark"] .ing-drag-handle:hover,
[data-bs-theme="dark"] .ing-drag-handle:hover,
[data-theme="dark"] .ing-drag-handle:hover,
.dark-mode .ing-drag-handle:hover,
body.dark-mode .ing-drag-handle:hover,
html[data-bs-theme="dark"] .step-drag-handle:hover,
html[data-theme="dark"] .step-drag-handle:hover,
[data-bs-theme="dark"] .step-drag-handle:hover,
[data-theme="dark"] .step-drag-handle:hover,
.dark-mode .step-drag-handle:hover,
body.dark-mode .step-drag-handle:hover {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
}

html[data-bs-theme="dark"] .sortable-ghost,
html[data-theme="dark"] .sortable-ghost,
[data-bs-theme="dark"] .sortable-ghost,
[data-theme="dark"] .sortable-ghost,
.dark-mode .sortable-ghost,
body.dark-mode .sortable-ghost {
    background: rgba(16, 185, 129, 0.08) !important;
    border-color: #059669 !important;
}

html[data-bs-theme="dark"] .studio-floating-toast,
html[data-theme="dark"] .studio-floating-toast,
[data-bs-theme="dark"] .studio-floating-toast,
[data-theme="dark"] .studio-floating-toast,
.dark-mode .studio-floating-toast,
body.dark-mode .studio-floating-toast {
    background: #1f2937;
    color: #f3f4f6;
    border: 1px solid #374151;
}

/* Steps Section */
.preview-steps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.preview-step-card {
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    gap: 14px;
}
.preview-step-num {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--chat-primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.preview-step-content {
    flex: 1;
}
.preview-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--chat-text-main);
    margin-bottom: 2px;
}
.preview-step-text {
    font-size: 0.88rem;
    color: var(--chat-text-muted);
    line-height: 1.5;
    margin-top: 0;
    margin-bottom: 6px;
    white-space: pre-line;
}
.preview-step-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    line-height: 1.45;
}
.preview-step-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--chat-amber);
    font-weight: 700;
}
.preview-step-tip {
    color: var(--chat-accent);
    font-style: italic;
}

/* Card Action Bar */
.recipe-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 22px !important;
    border-top: 1px solid var(--chat-border, #E2E8F0) !important;
}
.btn-recipe-publish {
    background: linear-gradient(135deg, #064e3b, #059669);
    color: #ffffff;
    border: none;
    padding: 11px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}
.btn-recipe-publish:hover {
    background: linear-gradient(135deg, #047857, #065f46);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.4);
}
.btn-recipe-collection {
    background: #f8fafc;
    color: #334155;
    border: 1.5px solid #cbd5e1;
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.90rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-recipe-collection:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
}
.btn-recipe-draft {
    background: #ffffff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    padding: 11px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.90rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-recipe-draft:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
}
.btn-recipe-tweak {
    background: #ecfdf5;
    color: #065f46;
    border: 1.5px solid #a7f3d0;
    padding: 11px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.90rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-recipe-tweak:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
    transform: translateY(-1px);
}

.btn-recipe-view-post {
    background: #0284c7;
    color: #ffffff !important;
    border: none;
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.90rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}
.btn-recipe-view-post:hover {
    background: #0369a1;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

.recipe-badge-verified {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Meticulous presentation & editing toolbar */
.recipe-meticulous-bar {
    margin-top: 20px !important;
    padding-top: 18px !important;
    padding-bottom: 24px !important; /* Generous breathing room above horizontal divider bar */
    border-top: 1px solid var(--chat-border, #E2E8F0) !important;
}

.recipe-meticulous-header {
    margin-bottom: 14px !important;
}

.recipe-meticulous-pills {
    margin-top: 4px;
    gap: 8px 10px !important;
}

.recipe-meticulous-bar .btn,
.recipe-meticulous-bar .btn-outline-secondary,
.recipe-meticulous-bar .btn-outline-dark,
.btn-meticulous-pill {
    border: 1.5px solid var(--chat-border, #CBD5E1) !important;
    color: var(--chat-text-main, #334155) !important;
    background: var(--chat-card-bg, #ffffff) !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    padding: 6px 13px !important;
    border-radius: 9999px !important;
    transition: all 0.18s ease-in-out !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    text-decoration: none !important;
}

/* Hover state: Crisp dark readable font, NO BLUE on border line */
.recipe-meticulous-bar .btn:hover,
.recipe-meticulous-bar .btn:focus,
.recipe-meticulous-bar .btn:active,
.recipe-meticulous-bar .btn-outline-secondary:hover,
.recipe-meticulous-bar .btn-outline-secondary:focus,
.recipe-meticulous-bar .btn-outline-secondary:active,
.recipe-meticulous-bar .btn-outline-dark:hover,
.recipe-meticulous-bar .btn-outline-dark:focus,
.recipe-meticulous-bar .btn-outline-dark:active,
.btn-meticulous-pill:hover,
.btn-meticulous-pill:focus,
.btn-meticulous-pill:active {
    background: #f1f5f9 !important;
    color: #0f172a !important; /* Clear, dark, crisp readable font */
    border-color: #64748b !important; /* Clean slate border - ABSOLUTELY NO BLUE */
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08) !important;
}

.recipe-meticulous-bar .btn:hover i,
.recipe-meticulous-bar .btn-outline-secondary:hover i,
.recipe-meticulous-bar .btn-outline-dark:hover i,
.btn-meticulous-pill:hover i {
    color: inherit !important;
}

/* Dark mode support */
[data-bs-theme="dark"] .recipe-meticulous-bar,
.dark-mode .recipe-meticulous-bar {
    border-top-color: #3C3C3C !important;
}
[data-bs-theme="dark"] .recipe-meticulous-bar .btn,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-secondary,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-dark,
[data-bs-theme="dark"] .btn-meticulous-pill,
.dark-mode .recipe-meticulous-bar .btn,
.dark-mode .recipe-meticulous-bar .btn-outline-secondary,
.dark-mode .recipe-meticulous-bar .btn-outline-dark,
.dark-mode .btn-meticulous-pill {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .recipe-meticulous-bar .btn:hover,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn:focus,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn:active,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-secondary:hover,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-secondary:focus,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-secondary:active,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-dark:hover,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-dark:focus,
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-dark:active,
[data-bs-theme="dark"] .btn-meticulous-pill:hover,
[data-bs-theme="dark"] .btn-meticulous-pill:focus,
[data-bs-theme="dark"] .btn-meticulous-pill:active,
.dark-mode .recipe-meticulous-bar .btn:hover,
.dark-mode .recipe-meticulous-bar .btn:focus,
.dark-mode .recipe-meticulous-bar .btn:active,
.dark-mode .recipe-meticulous-bar .btn-outline-secondary:hover,
.dark-mode .recipe-meticulous-bar .btn-outline-secondary:focus,
.dark-mode .recipe-meticulous-bar .btn-outline-secondary:active,
.dark-mode .recipe-meticulous-bar .btn-outline-dark:hover,
.dark-mode .recipe-meticulous-bar .btn-outline-dark:focus,
.dark-mode .recipe-meticulous-bar .btn-outline-dark:active,
.dark-mode .btn-meticulous-pill:hover,
.dark-mode .btn-meticulous-pill:focus,
.dark-mode .btn-meticulous-pill:active {
    background: #334155 !important;
    border-color: #94a3b8 !important; /* Neutral silver-slate border - NO BLUE */
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3) !important;
}

/* Markdown formatting in bot messages */
.chat-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    background: rgba(16, 185, 129, 0.12);
    color: #065f46;
    padding: 2px 6px;
    border-radius: 6px;
}
[data-bs-theme="dark"] .chat-code,
.dark-mode .chat-code {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
.chat-section-header {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--chat-text-main);
    margin: 14px 0 6px 0;
}
.chat-bullet-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0;
}
.chat-bullet-dot {
    color: var(--chat-accent);
    font-size: 1.1rem;
    line-height: 1.3;
}
.chat-email-link {
    color: var(--chat-accent);
    text-decoration: underline;
    font-weight: 700;
}
.chat-email-link:hover {
    color: var(--chat-primary-hover);
}
.chat-paragraph-spacer {
    height: 10px;
}

/* ==========================================================================
   COMPOSER / INPUT BAR (FIXED AT VIEWPORT BOTTOM)
   ========================================================================== */
.recipe-chat-composer-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1050;
    pointer-events: none;
    padding: 0 16px 20px 16px;
    background: transparent !important;
}

.recipe-chat-composer-container {
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
    pointer-events: none;
}

@media (min-width: 1024px) {
    .recipe-chat-composer-container {
        display: grid;
        grid-template-columns: minmax(0, 800px) 350px;
        justify-content: center;
        gap: 28px;
    }
}

.recipe-chat-composer-slot {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    pointer-events: none;
    background: linear-gradient(to top, var(--chat-bg, #FBFAF6) 75%, transparent 100%);
    padding-top: 18px;
    border-radius: 24px;
}

.recipe-chat-composer-inner {
    background: var(--chat-card-bg, #ffffff);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 20px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(16px);
    pointer-events: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-sizing: border-box;
}

.recipe-chat-composer-inner:focus-within {
    border-color: #005FB8;
    box-shadow: 0 4px 24px rgba(0, 95, 184, 0.12);
}

/* Image Attachment Tray above input */
.composer-image-tray {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--chat-border, #CECECE);
}
.composer-image-preview {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--chat-accent, #005FB8);
}
.composer-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.composer-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.composer-image-info {
    font-size: 0.8rem;
    line-height: 1.45;
}

/* Composer Input Area: Full-width textarea on top, actions on second row */
.composer-input-box,
.composer-input-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.composer-textarea {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--chat-text-main, #3B3B3B);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 120px;
    max-height: 260px;
    padding: 2px 4px 6px 4px;
    outline: none;
    line-height: 1.5;
    box-sizing: border-box;
    display: block;
}
.composer-textarea::placeholder {
    color: var(--chat-text-muted, #767676);
    opacity: 0.9;
}
[data-bs-theme="dark"] .composer-textarea::placeholder,
.dark-mode .composer-textarea::placeholder {
    color: #9E9E9E;
}

/* Second Row: Toolbar with Plus on left and Arrow Up on right */
.composer-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 4px;
    margin-bottom: 2px;
}

.composer-toolbar-left,
.composer-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-attach-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--chat-bg, #FBFAF6);
    border: 1px solid var(--chat-border, #CECECE);
    color: var(--chat-text-main, #3B3B3B);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin: 0;
}
.composer-attach-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.composer-attach-btn:hover {
    color: #005FB8;
    border-color: #005FB8;
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 95, 184, 0.15);
}
[data-bs-theme="dark"] .composer-attach-btn,
.dark-mode .composer-attach-btn {
    background: #313131;
    border-color: #3C3C3C;
    color: #CCCCCC;
}
[data-bs-theme="dark"] .composer-attach-btn:hover,
.dark-mode .composer-attach-btn:hover {
    color: #3794FF;
    border-color: #3794FF;
    background: #252526;
}

.composer-submit-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #005FB8;
    color: #ffffff;
    border: 1px solid #005FB8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin: 0;
    box-shadow: 0 3px 12px rgba(0, 95, 184, 0.25);
}
.composer-submit-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.composer-submit-btn:hover:not(:disabled) {
    background: #0258A8;
    border-color: #0258A8;
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(0, 95, 184, 0.35);
}
.composer-submit-btn:disabled {
    background: #E5E5E5;
    border-color: #CECECE;
    color: #767676;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    opacity: 0.9;
}
[data-bs-theme="dark"] .composer-submit-btn:disabled,
.dark-mode .composer-submit-btn:disabled {
    background: #2B2B2B;
    border-color: #3C3C3C;
    color: #616161;
}

/* Clarification Option Chips inside bot message */
.chat-options-chips {
    margin-top: 10px;
    padding-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chat-option-chip {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--chat-primary, #059669);
    color: var(--chat-primary, #059669);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.chat-option-chip:hover {
    background: var(--chat-primary, #059669);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

/* Hidden File Input */
.composer-file-input {
    display: none;
}

@media (max-width: 768px) {
    .recipe-chat-studio-wrap {
        padding-bottom: 210px;
    }
    .recipe-chat-composer-wrap {
        padding: 6px 10px 12px 10px;
    }
    .recipe-chat-composer-container {
        border-radius: 18px;
        padding: 0;
        max-width: 800px;
        margin: 0 auto;
    }
    .composer-textarea {
        min-height: 70px !important;
        height: 70px !important;
        max-height: 120px !important;
        line-height: 1.4 !important;
        font-size: 0.92rem !important;
        padding: 4px 6px !important;
        box-sizing: border-box !important;
    }
}

/* ==========================================================================
   HIDE SITE FOOTER ON RECIPE STUDIO PAGE
   Ensure ONLY the chatbox is visible at the bottom of the viewport
   ========================================================================== */
body.page-recipe-studio footer,
body.page-recipe-studio #v3-footer,
body.page-recipe-studio .v3-site-footer,
body.page-recipe-studio .footer,
body.page-recipe-studio .custom-footer-wrapper,
body.page-recipe-studio #footer,
body.page-recipe-studio .v3-footer-mode-section,
body.page-recipe-studio .v3-footer-bottom,
body.page-recipe-ai-studio footer,
body.page-recipe-ai-studio #v3-footer,
body.page-recipe-ai-studio .v3-site-footer,
body.page-recipe-ai-studio .footer,
body.page-recipe-ai-studio .custom-footer-wrapper,
body.page-recipe-ai-studio #footer,
body.page-recipe-ai-studio .v3-footer-mode-section,
body.page-recipe-ai-studio .v3-footer-bottom,
body:has(.recipe-chat-studio-wrap) footer,
body:has(.recipe-chat-studio-wrap) #v3-footer,
body:has(.recipe-chat-studio-wrap) .v3-site-footer,
body:has(.recipe-chat-studio-wrap) .footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* ==========================================================================
   BETA DISCLAIMER BELOW CHATBOX COMPOSER (SINGLE-LINE COLLAPSIBLE)
   ========================================================================== */
.composer-beta-disclaimer {
    display: block;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--chat-border, #E5E5E5);
    font-size: 0.70rem;
    color: var(--chat-text-muted, #767676);
    line-height: 1.35;
    text-align: center;
}
[data-bs-theme="dark"] .composer-beta-disclaimer,
.dark-mode .composer-beta-disclaimer {
    border-top-color: #3C3C3C;
    color: #9E9E9E;
}
.composer-beta-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    outline: none;
    width: 100%;
    margin: 0;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.composer-beta-summary:hover {
    background-color: rgba(0, 0, 0, 0.04);
}
[data-bs-theme="dark"] .composer-beta-summary:hover,
.dark-mode .composer-beta-summary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.composer-beta-summary::-webkit-details-marker,
.composer-beta-summary::marker {
    display: none;
}
.composer-beta-badge {
    background: #E5E5E5;
    color: #3B3B3B;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
    line-height: 1.3;
}
[data-bs-theme="dark"] .composer-beta-badge,
.dark-mode .composer-beta-badge {
    background: #333333;
    color: #CCCCCC;
}
.composer-beta-line-text,
.composer-beta-text {
    font-size: 0.70rem;
    line-height: 1.35;
    color: var(--chat-text-muted, #767676);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 0 1 auto;
}
[data-bs-theme="dark"] .composer-beta-line-text,
[data-bs-theme="dark"] .composer-beta-text,
.dark-mode .composer-beta-line-text,
.dark-mode .composer-beta-text {
    color: #9E9E9E;
}
.composer-beta-action {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    margin-left: auto;
    font-size: 0.68rem;
    font-weight: 600;
    color: #005FB8;
    padding: 1px 4px;
    border-radius: 4px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.composer-beta-summary:hover .composer-beta-action {
    color: #0258A8;
    background-color: rgba(0, 95, 184, 0.08);
}
[data-bs-theme="dark"] .composer-beta-action,
.dark-mode .composer-beta-action {
    color: #3794FF;
}
[data-bs-theme="dark"] .composer-beta-summary:hover .composer-beta-action,
.dark-mode .composer-beta-summary:hover .composer-beta-action {
    color: #68A3DA;
    background-color: rgba(55, 148, 255, 0.15);
}
.composer-beta-action-icon {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.composer-beta-disclaimer[open] .composer-beta-action-icon {
    transform: rotate(180deg);
}
.composer-beta-full-content {
    margin-top: 6px;
    padding: 8px 12px;
    font-size: 0.70rem;
    line-height: 1.45;
    color: #475569;
    background: rgba(241, 245, 249, 0.85);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 8px;
    text-align: left;
    animation: fadeInDisclaimer 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-bs-theme="dark"] .composer-beta-full-content,
.dark-mode .composer-beta-full-content {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(51, 65, 85, 0.9);
    color: #cbd5e1;
}
@keyframes fadeInDisclaimer {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   MOBILE VIEWPORT ADAPTATIONS (<= 768px)
   1. Move chatbox composer above the fixed mobile bottom menu (60px high)
   2. Ensure when burger icon opens slideup menu, it shows neatly not floating
   ========================================================================== */
@media (max-width: 768px) {
    /* Position chatbox composer right above the fixed mobile bottom navigation bar */
    .recipe-chat-composer-wrap {
        bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
        padding: 8px 12px 10px 12px !important;
        background: linear-gradient(to top, var(--chat-bg, #FBFAF6) 85%, transparent 100%) !important;
    }

    .recipe-chat-composer-container {
        padding: 10px 12px !important;
        border-radius: 18px !important;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12) !important;
    }

    /* Provide generous bottom clearance in stream so messages aren't obscured */
    .recipe-chat-studio-wrap {
        padding-bottom: calc(260px + 60px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Completely hide chatbox composer when ANY drawer or offcanvas is open */
    body.mobile-menu-open .recipe-chat-composer-wrap,
    body.mobile-search-open .recipe-chat-composer-wrap,
    body.offcanvas-open .recipe-chat-composer-wrap,
    body:has(#mobileMenu.show) .recipe-chat-composer-wrap,
    body:has(#mobileMenu.showing) .recipe-chat-composer-wrap,
    body:has(.offcanvas.show) .recipe-chat-composer-wrap,
    body:has(#mobile-bottom-search-drawer.is-open) .recipe-chat-composer-wrap {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Anchor slideup bottom sheet seamlessly to bottom: 0 (not floating in mid-air) */
    #mobileMenu.offcanvas,
    #mobileMenu.offcanvas-start,
    .mobile-nav-wrapper .custom-offcanvas#mobileMenu {
        bottom: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-bottom: none !important;
        z-index: 10007 !important;
        max-height: 86vh !important;
    }

    #mobileMenu .offcanvas-body {
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Anchor mobile search sheet cleanly to bottom: 0 */
    .mobile-search-sheet {
        bottom: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-bottom: none !important;
        padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
        max-height: 86vh !important;
        z-index: 10007 !important;
    }
}

/* ==========================================================================
   RECIPE FORMAT GUIDE SIDEBAR (Sticky like Recipe Post, scrollable with no top clipping)
   ========================================================================== */
@media (min-width: 1024px) {
    .recipe-chat-sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 80px;
        max-height: calc(100vh - 95px);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        padding-right: 4px;
        padding-bottom: 24px;
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 95, 184, 0.35) transparent;
        z-index: 10;
        width: 350px;
        max-width: 100%;
        align-self: flex-start;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    .recipe-chat-sidebar::-webkit-scrollbar {
        width: 5px;
    }
    .recipe-chat-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }
    .recipe-chat-sidebar::-webkit-scrollbar-thumb {
        background: rgba(0, 95, 184, 0.28);
        border-radius: 9999px;
        transition: background-color 0.2s ease;
    }
    .recipe-chat-sidebar:hover::-webkit-scrollbar-thumb {
        background: var(--chat-primary, #005FB8);
    }
    [data-bs-theme="dark"] .recipe-chat-sidebar,
    html.dark-mode .recipe-chat-sidebar,
    .dark-mode .recipe-chat-sidebar {
        scrollbar-color: rgba(55, 148, 255, 0.35) transparent;
    }
    [data-bs-theme="dark"] .recipe-chat-sidebar::-webkit-scrollbar-thumb,
    html.dark-mode .recipe-chat-sidebar::-webkit-scrollbar-thumb,
    .dark-mode .recipe-chat-sidebar::-webkit-scrollbar-thumb {
        background: rgba(55, 148, 255, 0.3);
    }
    [data-bs-theme="dark"] .recipe-chat-sidebar:hover::-webkit-scrollbar-thumb,
    html.dark-mode .recipe-chat-sidebar:hover::-webkit-scrollbar-thumb,
    .dark-mode .recipe-chat-sidebar:hover::-webkit-scrollbar-thumb {
        background: #3794FF;
    }
}

.recipe-guide-card {
    background: var(--chat-card-bg, #ffffff);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}
[data-bs-theme="dark"] .recipe-guide-card,
.dark-mode .recipe-guide-card {
    background: #252526;
    border-color: #3C3C3C;
}

.recipe-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--chat-border, #CECECE);
}
.guide-badge-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--chat-primary-light, rgba(0, 95, 184, 0.12));
    color: var(--chat-primary, #005FB8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.guide-title {
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--chat-text-main, #3B3B3B);
    line-height: 1.2;
}
.guide-subtitle {
    font-size: 0.74rem;
    color: var(--chat-text-muted, #767676);
    display: block;
}
.guide-mobile-close {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--chat-text-muted, #767676);
    cursor: pointer;
    padding: 4px;
}

.guide-blueprint-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.blueprint-pill {
    background: var(--chat-bg, #FBFAF6);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
[data-bs-theme="dark"] .blueprint-pill,
.dark-mode .blueprint-pill {
    background: #1e1e1e;
    border-color: #333333;
}
.blueprint-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--chat-primary, #005FB8);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.blueprint-pill strong {
    display: block;
    font-size: 0.78rem;
    line-height: 1.15;
    color: var(--chat-text-main, #3B3B3B);
}
.blueprint-pill small {
    display: block;
    font-size: 0.68rem;
    color: var(--chat-text-muted, #767676);
    line-height: 1.2;
}

.guide-template-card {
    background: var(--chat-bg, #FBFAF6);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 16px;
}
[data-bs-theme="dark"] .guide-template-card,
.dark-mode .guide-template-card {
    background: #1e1e1e;
    border-color: #333333;
}
.guide-template-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.guide-template-tag {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--chat-primary, #005FB8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.btn-template-copy {
    background: transparent;
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--chat-text-main, #3B3B3B);
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-template-copy:hover {
    background: var(--chat-card-bg, #ffffff);
    border-color: var(--chat-primary, #005FB8);
    color: var(--chat-primary, #005FB8);
}
.guide-template-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--chat-text-main, #3B3B3B);
    background: var(--chat-card-bg, #ffffff);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 10px;
    padding: 10px;
    margin: 0 0 10px 0;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
[data-bs-theme="dark"] .guide-template-code,
.dark-mode .guide-template-code {
    background: #141414;
    border-color: #2b2b2b;
    color: #e2e8f0;
}
.btn-template-insert {
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--chat-primary, #005FB8);
    color: #ffffff;
    border: none;
    font-size: 0.8rem;
    font-weight: 750;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 2px 8px rgba(0, 95, 184, 0.2);
}
.btn-template-insert:hover {
    background: var(--chat-primary-hover, #0258A8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 95, 184, 0.3);
}

.guide-tips-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.guide-tip-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.78rem;
}
.guide-tip-icon {
    font-size: 0.95rem;
    line-height: 1.3;
    flex-shrink: 0;
    margin-top: 1px;
}
.guide-tip-item strong {
    display: block;
    font-weight: 750;
    color: var(--chat-text-main, #3B3B3B);
    font-size: 0.8rem;
    line-height: 1.2;
}
.guide-tip-item p {
    color: var(--chat-text-muted, #767676);
    font-size: 0.74rem;
    line-height: 1.35;
}
.guide-tip-item kbd {
    background: var(--chat-card-bg, #ffffff);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.7rem;
    color: var(--chat-text-main, #3B3B3B);
}

/* Mobile Sidebar Drawer / Modal (< 1024px) */
@media (max-width: 1023.98px) {
    .composer-guide-btn {
        display: inline-flex !important;
    }
    .composer-textarea {
        font-size: 0.82rem !important;
        line-height: 1.45 !important;
    }
    .recipe-chat-stage {
        grid-template-columns: 1fr;
    }
    .recipe-chat-sidebar {
        position: fixed !important;
        top: 0 !important;
        right: -420px !important;
        bottom: 0 !important;
        width: 380px !important;
        max-width: 92vw !important;
        max-height: 100vh !important;
        height: 100vh !important;
        background: var(--chat-card-bg, #ffffff) !important;
        z-index: 10050 !important;
        border-radius: 0 !important;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25) !important;
        transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding: 20px 18px 50px 18px !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .recipe-chat-sidebar.sidebar-mobile-open {
        right: 0 !important;
    }
    .recipe-guide-card {
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    .recipe-guide-backdrop {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, 0.45) !important;
        backdrop-filter: blur(2px) !important;
        z-index: 10040 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.25s ease, visibility 0.25s ease !important;
    }
    .recipe-guide-backdrop.show {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}

/* ==========================================================================
   INTERACTIVE RECIPE CARD CONTROLS, NUTRITION, TIMERS & PRINT ENGINE
   ========================================================================== */

/* Servings Stepper */
.servings-stepper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--chat-primary-light, rgba(0, 95, 184, 0.08));
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 9999px;
    padding: 2px 8px;
    margin: 0 auto;
}
.btn-stepper {
    border: none;
    background: transparent;
    color: var(--chat-primary, #005FB8);
    font-size: 0.85rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    line-height: 1;
}
.btn-stepper:hover {
    background: var(--chat-primary, #005FB8);
    color: #ffffff;
    transform: scale(1.1);
}
.stepper-val {
    font-weight: 700;
    font-size: 0.88rem;
    min-width: 18px;
    text-align: center;
}

/* Units & Aisle View Segmented Toggle Controls */
.recipe-view-toggles {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--chat-border, #E2E2E2);
}
.segmented-control {
    display: inline-flex;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
[data-bs-theme="dark"] .segmented-control,
.dark-mode .segmented-control {
    background: #1e293b;
    border-color: #334155;
}
.segmented-btn {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
[data-bs-theme="dark"] .segmented-btn,
.dark-mode .segmented-btn {
    color: #94a3b8;
}
.segmented-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
[data-bs-theme="dark"] .segmented-btn.active,
.dark-mode .segmented-btn.active {
    background: #334155;
    color: #f8fafc;
}

/* Nutrition Macro Facts Pill Bar */
.recipe-nutrition-bar {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    margin-top: 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
[data-bs-theme="dark"] .recipe-nutrition-bar,
.dark-mode .recipe-nutrition-bar {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
}
.nutrition-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--chat-text-main, #333333);
}
[data-bs-theme="dark"] .nutrition-pill,
.dark-mode .nutrition-pill {
    color: #f1f5f9;
}
.nutrition-pill-title {
    font-size: 0.72rem;
    color: var(--chat-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

/* Aisle Group Header */
.aisle-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 10px;
    margin-top: 12px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 700;
}
.aisle-allergen-tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 9999px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    font-weight: 600;
}

/* Interactive Timer Floating Overlay */
.active-kitchen-timer {
    position: fixed;
    bottom: 95px;
    right: 24px;
    background: var(--chat-card-bg, #ffffff);
    border: 2px solid var(--chat-primary, #005FB8);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    padding: 12px 18px;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUpTimer 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpTimer {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.timer-digits {
    font-family: monospace;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--chat-primary, #005FB8);
    min-width: 75px;
    text-align: center;
}

/* Voice Dictation Microphone Button (Temporarily Hidden per Request) */
.composer-mic-btn,
#composerVoiceBtn {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
}
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    font-size: 1.05rem;
}
.composer-mic-btn:hover {
    color: var(--chat-primary, #005FB8);
    border-color: var(--chat-primary, #005FB8);
    background: #ffffff;
    transform: translateY(-1px);
}
.composer-mic-btn.listening {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    animation: micPulse 1.2s infinite;
}
@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Clean Recipe Print Styles */
@media print {
    body, html {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .recipe-chat-composer-wrap,
    .recipe-chat-sidebar,
    .recipe-meticulous-bar,
    .recipe-preview-actions,
    .composer-beta-disclaimer,
    .chat-avatar,
    .chat-bubble,
    .guide-template-card,
    header, nav, #header, #nav, footer, #footer,
    .btn, button, .recipe-save-status, .active-kitchen-timer,
    .recipe-view-toggles {
        display: none !important;
    }
    .recipe-chat-stage {
        display: block !important;
    }
    .recipe-chat-studio-wrap {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .recipe-preview-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .preview-step-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc !important;
        margin-bottom: 8px !important;
    }
    .preview-ing-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
    }
}

/* ==========================================================================
   PASTE & PARSE & IMPORT FROM URL MODALS & TOOLBAR BUTTONS
   ========================================================================== */

.composer-tool-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--chat-primary, #005FB8);
}
.composer-tool-btn:hover {
    color: var(--chat-primary-hover, #0258A8);
}
[data-bs-theme="dark"] .composer-tool-btn,
.dark-mode .composer-tool-btn {
    color: var(--chat-primary, #3794FF);
}

.studio-quick-btn {
    font-size: 0.8rem !important;
    border-radius: 9999px !important;
    padding: 4px 14px !important;
    font-weight: 500 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.studio-quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 95, 184, 0.15);
}

/* Studio Modal Overlay & Dialog */
.studio-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10010;
    transition: opacity 0.2s ease;
}

.studio-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 620px;
    z-index: 10020;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.studio-modal-dialog {
    background: var(--chat-card-bg, #ffffff);
    border: 1px solid var(--chat-border, #CECECE);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

[data-bs-theme="dark"] .studio-modal-dialog,
.dark-mode .studio-modal-dialog {
    background: #222223 !important;
    border-color: #3C3C3C !important;
    color: #E2E8F0 !important;
}

.studio-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--chat-border, #E2E2E2);
}
[data-bs-theme="dark"] .studio-modal-header,
.dark-mode .studio-modal-header {
    border-bottom-color: #333333;
}

.studio-modal-badge-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.studio-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--chat-text-main, #1F1F1F);
}
[data-bs-theme="dark"] .studio-modal-title,
.dark-mode .studio-modal-title {
    color: #F8FAFC !important;
}

.studio-modal-subtitle {
    font-size: 0.78rem;
    color: var(--chat-text-muted, #767676);
}
[data-bs-theme="dark"] .studio-modal-subtitle,
.dark-mode .studio-modal-subtitle {
    color: #94A3B8 !important;
}

.studio-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--chat-text-muted, #767676);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s ease;
}
.studio-modal-close:hover {
    color: #dc2626;
}

.studio-mode-pill {
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
}
.btn-check:checked + .studio-mode-pill {
    background-color: var(--chat-primary, #005FB8) !important;
    border-color: var(--chat-primary, #005FB8) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.studio-paste-textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, monospace, sans-serif !important;
    font-size: 0.84rem !important;
    line-height: 1.55 !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    border: 1px solid var(--chat-border, #CECECE) !important;
    background: var(--chat-bg, #FBFAF6) !important;
    color: var(--chat-text-main, #3B3B3B) !important;
    resize: vertical !important;
}
[data-bs-theme="dark"] .studio-paste-textarea,
.dark-mode .studio-paste-textarea {
    background: #181818 !important;
    border-color: #3C3C3C !important;
    color: #E2E8F0 !important;
}

.studio-url-input {
    font-size: 0.88rem !important;
    border-radius: 0 10px 10px 0 !important;
    border: 1px solid var(--chat-border, #CECECE) !important;
    background: var(--chat-bg, #FBFAF6) !important;
    color: var(--chat-text-main, #3B3B3B) !important;
}
[data-bs-theme="dark"] .studio-url-input,
.dark-mode .studio-url-input {
    background: #181818 !important;
    border-color: #3C3C3C !important;
    color: #E2E8F0 !important;
}

.studio-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--chat-border, #E2E2E2);
}
[data-bs-theme="dark"] .studio-modal-footer,
.dark-mode .studio-modal-footer {
    border-top-color: #333333;
}

.studio-btn-cancel {
    font-size: 0.84rem !important;
    border-radius: 10px !important;
    padding: 7px 16px !important;
}
.studio-btn-submit {
    font-size: 0.84rem !important;
    border-radius: 10px !important;
    padding: 7px 20px !important;
    font-weight: 600 !important;
}

/* Recipe Source & Attribution Card Styling */
.recipe-credit-credential-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.recipe-credit-credential-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}
.recipe-credit-avatar-box {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.recipe-credit-action-btn {
    transition: all 0.2s ease;
}
.recipe-credit-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.2);
}
[data-bs-theme="dark"] .recipe-credit-credential-card,
.dark-mode .recipe-credit-credential-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-bs-theme="dark"] .recipe-credit-credential-card .text-dark,
.dark-mode .recipe-credit-credential-card .text-dark {
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .recipe-credit-credential-card .text-secondary,
.dark-mode .recipe-credit-credential-card .text-secondary {
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .recipe-credit-avatar-box,
.dark-mode .recipe-credit-avatar-box {
    background: rgba(96, 165, 250, 0.15) !important;
}
[data-bs-theme="dark"] .recipe-credit-avatar-box i,
.dark-mode .recipe-credit-avatar-box i {
    color: #60a5fa !important;
}

/* Sidebar Moved Info & Disclaimer Cards */
.recipe-sidebar-status-card,
.recipe-sidebar-disclaimer-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.recipe-sidebar-status-card:hover,
.recipe-sidebar-disclaimer-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}
[data-bs-theme="dark"] .recipe-sidebar-status-card,
.dark-mode .recipe-sidebar-status-card,
[data-bs-theme="dark"] .recipe-sidebar-disclaimer-card,
.dark-mode .recipe-sidebar-disclaimer-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .recipe-sidebar-status-card .text-dark,
.dark-mode .recipe-sidebar-status-card .text-dark {
    color: #f1f5f9 !important;
}

/* Video Preview Embed Player Card */
.recipe-video-player-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #090d16;
    border-radius: 12px;
    border: 1px solid #1e293b;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.recipe-video-poster {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.62);
    transition: transform 0.4s ease, filter 0.4s ease;
}
.recipe-video-player-container:hover .recipe-video-poster {
    transform: scale(1.03);
    filter: brightness(0.72);
}
.video-play-button-pulse {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}
.recipe-video-player-container:hover .video-play-button-pulse {
    transform: scale(1.12);
    filter: drop-shadow(0 0 18px rgba(239, 68, 68, 0.8));
}
.recipe-preview-video-embed iframe,
.recipe-preview-video-embed video {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* Blue Badge Styles */
.recipe-badge-blue {
    color: #2563eb !important;
    background-color: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
}

[data-bs-theme="dark"] .recipe-badge-blue,
.dark-mode .recipe-badge-blue {
    color: #60a5fa !important;
    background-color: rgba(37, 99, 235, 0.18) !important;
    border-color: rgba(96, 165, 250, 0.35) !important;
}

[data-bs-theme="dark"] .btn-recipe-collection,
.dark-mode .btn-recipe-collection {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    border-color: #334155;
}
[data-bs-theme="dark"] .btn-recipe-collection:hover,
.dark-mode .btn-recipe-collection:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #475569;
    color: #ffffff;
}
[data-bs-theme="dark"] .btn-recipe-draft,
.dark-mode .btn-recipe-draft {
    background: rgba(255, 255, 255, 0.02);
    color: #94a3b8;
    border-color: #1e293b;
}
[data-bs-theme="dark"] .btn-recipe-draft:hover,
.dark-mode .btn-recipe-draft:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: #334155;
    color: #e2e8f0;
}

/* Open Source Video Action Button */
.btn-recipe-source-video {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
    font-size: 0.74rem !important;
    font-weight: 600 !important;
    padding: 3px 10px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
    transition: all 0.18s ease-in-out !important;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.06) !important;
    cursor: pointer !important;
}
.btn-recipe-source-video:hover {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border-color: #93c5fd !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15) !important;
    transform: translateY(-1px);
}
.btn-recipe-source-video i {
    font-size: 0.68rem !important;
    color: #2563eb !important;
    transition: transform 0.15s ease !important;
}
.btn-recipe-source-video:hover i {
    color: #1e40af !important;
    transform: translate(1px, -1px);
}

[data-bs-theme="dark"] .btn-recipe-source-video,
.dark-mode .btn-recipe-source-video {
    background-color: rgba(37, 99, 235, 0.18) !important;
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, 0.35) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}
[data-bs-theme="dark"] .btn-recipe-source-video:hover,
.dark-mode .btn-recipe-source-video:hover {
    background-color: rgba(37, 99, 235, 0.3) !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.55) !important;
}
[data-bs-theme="dark"] .btn-recipe-source-video i,
.dark-mode .btn-recipe-source-video i {
    color: #93c5fa !important;
}

/* ==========================================================================
   PREMIUM RECIPE DIFFICULTY MODAL (Level Selector UI/UX)
   ========================================================================== */
.difficulty-modal-container {
    max-width: 540px !important;
    width: 95% !important;
    padding: 0 !important;
    border-radius: 24px !important;
    border: none !important;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
    overflow: visible !important;
    animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.difficulty-modal-card {
    background: #ffffff;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.difficulty-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.difficulty-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #4f46e5;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}
.difficulty-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}
.difficulty-modal-subtitle {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #64748b;
    margin: 2px 0 0;
}
.difficulty-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.18s ease;
}
.difficulty-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.05);
}

/* Body & Cards */
.difficulty-modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diff-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.diff-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.08);
}

/* Card Left Section */
.diff-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.diff-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.diff-card:hover .diff-card-icon {
    transform: scale(1.08);
}

.diff-card-text {
    flex: 1;
    min-width: 0;
}

.diff-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}
.diff-card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    margin: 0;
}

/* Pill Badges */
.diff-pill {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 9999px;
    line-height: 1.35;
}

/* Mini Visual Skill Meter (3 Bars) */
.diff-meter {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
}
.diff-meter-bar {
    width: 4px;
    height: 12px;
    border-radius: 2px;
    background: #cbd5e1;
    transition: all 0.2s ease;
}

.diff-card-desc {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #64748b;
    margin: 0;
    padding-right: 8px;
}

/* Radio Indicator on Right */
.diff-radio-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------- TIER SPECIFIC THEMES ---------------- */

/* Tier 1: Easy */
.diff-card-easy .diff-card-icon {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    color: #059669;
}
.diff-card-easy .diff-pill {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}
.diff-card-easy .diff-meter-bar.active {
    background: #10b981;
}

.diff-card-easy.is-selected {
    border-color: #10b981 !important;
    background: #f0fdf4 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18), 0 8px 20px -4px rgba(16, 185, 129, 0.12) !important;
}
.diff-card-easy.is-selected .diff-radio-circle {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

/* Tier 2: Medium */
.diff-card-med .diff-card-icon {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    color: #d97706;
}
.diff-card-med .diff-pill {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}
.diff-card-med .diff-meter-bar.active {
    background: #f59e0b;
}

.diff-card-med.is-selected {
    border-color: #f59e0b !important;
    background: #fffbeb !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18), 0 8px 20px -4px rgba(245, 158, 11, 0.12) !important;
}
.diff-card-med.is-selected .diff-radio-circle {
    border-color: #f59e0b;
    background: #f59e0b;
    color: #ffffff;
}

/* Tier 3: Hard */
.diff-card-hard .diff-card-icon {
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
    border: 1px solid #fecdd3;
    color: #e11d48;
}
.diff-card-hard .diff-pill {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}
.diff-card-hard .diff-meter-bar.active {
    background: #f43f5e;
}

.diff-card-hard.is-selected {
    border-color: #f43f5e !important;
    background: #fff1f2 !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.18), 0 8px 20px -4px rgba(244, 63, 94, 0.12) !important;
}
.diff-card-hard.is-selected .diff-radio-circle {
    border-color: #f43f5e;
    background: #f43f5e;
    color: #ffffff;
}

/* Footer Actions */
.difficulty-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 24px 22px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.difficulty-btn-cancel {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap !important;
    line-height: 1.4;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.difficulty-btn-cancel:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.difficulty-btn-apply {
    background: linear-gradient(135deg, #005FB8 0%, #0284c7 100%);
    border: none;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 10px 26px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 95, 184, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap !important;
    line-height: 1.4;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.difficulty-btn-apply:hover {
    background: linear-gradient(135deg, #004c94 0%, #0369a1 100%);
    box-shadow: 0 6px 18px rgba(0, 95, 184, 0.35);
    transform: translateY(-1px);
}

/* ---------------- DARK MODE ---------------- */
[data-bs-theme="dark"] .difficulty-modal-card,
.dark-mode .difficulty-modal-card {
    background: #1e293b !important;
    color: #f8fafc !important;
}
[data-bs-theme="dark"] .difficulty-modal-header,
.dark-mode .difficulty-modal-header {
    border-bottom-color: #334155 !important;
}
[data-bs-theme="dark"] .difficulty-modal-title,
.dark-mode .difficulty-modal-title {
    color: #ffffff !important;
}
[data-bs-theme="dark"] .difficulty-modal-subtitle,
.dark-mode .difficulty-modal-subtitle {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .difficulty-close-btn,
.dark-mode .difficulty-close-btn {
    background: #334155 !important;
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .difficulty-close-btn:hover,
.dark-mode .difficulty-close-btn:hover {
    background: #475569 !important;
    color: #ffffff !important;
}
[data-bs-theme="dark"] .diff-card,
.dark-mode .diff-card {
    background: #0f172a !important;
    border-color: #334155 !important;
}
[data-bs-theme="dark"] .diff-card:hover,
.dark-mode .diff-card:hover {
    background: #1e293b !important;
    border-color: #475569 !important;
}
[data-bs-theme="dark"] .diff-card-title,
.dark-mode .diff-card-title {
    color: #f8fafc !important;
}
[data-bs-theme="dark"] .diff-card-desc,
.dark-mode .diff-card-desc {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .diff-radio-circle,
.dark-mode .diff-radio-circle {
    background: #1e293b !important;
    border-color: #475569 !important;
}

/* Dark mode active states */
[data-bs-theme="dark"] .diff-card-easy.is-selected,
.dark-mode .diff-card-easy.is-selected {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: #10b981 !important;
}
[data-bs-theme="dark"] .diff-card-med.is-selected,
.dark-mode .diff-card-med.is-selected {
    background: rgba(245, 158, 11, 0.12) !important;
    border-color: #f59e0b !important;
}
[data-bs-theme="dark"] .diff-card-hard.is-selected,
.dark-mode .diff-card-hard.is-selected {
    background: rgba(244, 63, 94, 0.12) !important;
    border-color: #f43f5e !important;
}

[data-bs-theme="dark"] .difficulty-modal-footer,
.dark-mode .difficulty-modal-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
}
[data-bs-theme="dark"] .difficulty-btn-cancel,
.dark-mode .difficulty-btn-cancel {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .difficulty-btn-cancel:hover,
.dark-mode .difficulty-btn-cancel:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   INLINE EDITING ENGINE (Hover Pencil & In-Place Text Editing)
   ========================================================================== */
.editable-field {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    padding: 1px 4px;
    margin: -1px -4px;
    transition: background-color 0.15s ease, outline 0.15s ease, box-shadow 0.15s ease;
    display: inline-block;
    max-width: 100%;
    outline: 1.5px solid transparent;
}
.editable-field:hover {
    background-color: rgba(0, 95, 184, 0.06);
    outline: 1.5px dashed rgba(0, 95, 184, 0.45);
}
[data-bs-theme="dark"] .editable-field:hover,
.dark-mode .editable-field:hover {
    background-color: rgba(55, 148, 255, 0.12);
    outline: 1.5px dashed rgba(55, 148, 255, 0.5);
}

/* Hover Pencil Icon Indicator - Hidden per user request */
.editable-pencil-icon,
i.editable-pencil-icon {
    display: none !important;
    visibility: hidden !important;
}

/* Add Placeholders (+ notes, + qty, + summary, + full description) */
.editable-add-field {
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    color: var(--chat-primary, #005FB8);
    font-size: 0.74rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 95, 184, 0.06);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.editable-field:hover ~ .editable-add-field,
.editable-add-field:hover {
    opacity: 1 !important;
    background: rgba(0, 95, 184, 0.15);
}
.recipe-preview-summary-container:hover .editable-add-field,
.recipe-preview-content-box:hover .editable-add-field {
    opacity: 0.75;
}

/* Description Full-Width & Block Styling */
.recipe-preview-title-container,
.recipe-preview-title,
.recipe-preview-summary-container,
.recipe-preview-content-box,
.recipe-preview-summary,
.recipe-preview-summary-add,
.recipe-preview-content-lead,
.recipe-preview-content-add,
.editable-field[data-field="recipe_title"],
.editable-field[data-field="recipe_summary"],
.editable-add-field[data-field="recipe_summary"],
.editable-field[data-field="recipe_content"],
.editable-add-field[data-field="recipe_content"],
.editable-field[data-field="step_content"] {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 2px 4px !important;
    margin: 0 !important;
}

.editable-field.is-editing,
.editable-field.is-editing:hover,
.editable-add-field.is-editing,
.editable-add-field.is-editing:hover,
.is-editing,
.is-editing:hover {
    cursor: default !important;
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.recipe-preview-summary {
    font-size: 0.9rem;
    color: var(--chat-text-muted);
    line-height: 1.55;
    margin-bottom: 8px;
    padding: 3px 6px;
}
.recipe-preview-content-box {
    background: rgba(0, 95, 184, 0.02);
    border: 1px dashed rgba(0, 95, 184, 0.2);
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 14px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}
.recipe-preview-content-box:hover {
    border-color: rgba(0, 95, 184, 0.4);
    background: rgba(0, 95, 184, 0.04);
}
[data-bs-theme="dark"] .recipe-preview-content-box,
.dark-mode .recipe-preview-content-box {
    background: rgba(55, 148, 255, 0.05);
    border-color: rgba(55, 148, 255, 0.25);
}
.recipe-preview-content-lead {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--chat-text-main, #334155);
    white-space: pre-wrap;
    padding: 4px 6px;
}

/* Chef Tips Editable List Styling - Parity with Chef's Final Note (Bullets & Proper Spacing) */
.recipe-chef-tips-list {
    list-style-type: disc !important;
    padding-left: 1.25rem !important;
}
.recipe-chef-tip-item {
    position: relative;
    padding-left: 4px;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}
.recipe-chef-tip-text {
    cursor: pointer;
}
.recipe-chef-tip-text:hover {
    color: #d97706;
    text-decoration: underline;
}
.recipe-chef-tip-item .btn-remove-tip {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.recipe-chef-tip-item:hover .btn-remove-tip {
    opacity: 0.85;
}
.recipe-chef-tip-item .btn-remove-tip:hover {
    opacity: 1 !important;
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1);
}

/* High-Contrast Chef Tip Button */
.btn-add-chef-tip {
    background: #d97706 !important;
    color: #ffffff !important;
    border: 1px solid #b45309 !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    padding: 4px 14px !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    box-shadow: 0 1px 3px rgba(180, 83, 9, 0.28) !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
    text-decoration: none !important;
    line-height: 1.3 !important;
}
.btn-add-chef-tip:hover {
    background: #b45309 !important;
    color: #ffffff !important;
    border-color: #92400e !important;
    box-shadow: 0 2px 6px rgba(180, 83, 9, 0.38) !important;
    transform: translateY(-1px);
}
.btn-add-chef-tip i {
    font-size: 0.85rem !important;
    color: #ffffff !important;
}

/* Inline Edit Active Container */
.inline-edit-wrap {
    width: 100% !important;
    display: block !important;
    margin: 4px 0;
    position: relative;
    z-index: 15;
    box-sizing: border-box !important;
}
.inline-edit-input,
.inline-edit-textarea {
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff;
    color: #1e293b;
    border: 1.5px solid var(--chat-primary, #005FB8);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.5;
    box-shadow: 0 0 0 3px rgba(0, 95, 184, 0.15);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box !important;
    display: block !important;
}
.inline-edit-textarea {
    min-height: 80px;
    resize: vertical;
}
[data-bs-theme="dark"] .inline-edit-input,
[data-bs-theme="dark"] .inline-edit-textarea,
.dark-mode .inline-edit-input,
.dark-mode .inline-edit-textarea {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #3794FF !important;
    box-shadow: 0 0 0 3px rgba(55, 148, 255, 0.2) !important;
}

/* Inline Edit Action Buttons */
.inline-edit-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}
.inline-edit-hint {
    font-size: 0.72rem;
    color: #64748b;
    margin-right: auto;
}
[data-bs-theme="dark"] .inline-edit-hint,
.dark-mode .inline-edit-hint {
    color: #94a3b8;
}
.btn-inline-save {
    background: var(--chat-primary, #005FB8);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 3px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}
.btn-inline-save:hover {
    background: #004a93;
}
.btn-inline-cancel {
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.76rem;
    padding: 3px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}
.btn-inline-cancel:hover {
    background: #f1f5f9;
    color: #334155;
}
[data-bs-theme="dark"] .btn-inline-cancel,
.dark-mode .btn-inline-cancel {
    color: #cbd5e1;
    border-color: #475569;
}
[data-bs-theme="dark"] .btn-inline-cancel:hover,
.dark-mode .btn-inline-cancel:hover {
    background: #334155;
    color: #ffffff;
}

/* Card layout adjustments for right edit buttons */
.preview-ing-card {
    position: relative;
}
.preview-ing-right-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.preview-step-card {
    position: relative;
}
.preview-step-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* =========================================================
   PREMIUM CUISINE MODAL & AUTOSUGGESTION UI/UX
   ========================================================= */
.cuisine-modal-container {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 92% !important;
    max-width: 480px !important;
    z-index: 10030 !important;
    max-height: none !important;
    overflow: visible !important; /* CRITICAL: Never clip or show scrollbars on the modal frame! */
    box-sizing: border-box !important;
    animation: cuisineModalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cuisineModalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.cuisine-modal-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 25px 65px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    overflow: visible !important;
    position: relative;
}

[data-bs-theme="dark"] .cuisine-modal-card,
.dark-mode .cuisine-modal-card {
    background: #18181b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 65px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
    color: #f4f4f5;
}

/* Header */
.cuisine-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}

[data-bs-theme="dark"] .cuisine-modal-header,
.dark-mode .cuisine-modal-header {
    border-bottom-color: #27272a;
}

.cuisine-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid rgba(251, 146, 60, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ea580c;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.12);
}

[data-bs-theme="dark"] .cuisine-icon-badge,
.dark-mode .cuisine-icon-badge {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.2) 0%, rgba(194, 65, 12, 0.3) 100%);
    border-color: rgba(234, 88, 12, 0.35);
    color: #fb923c;
}

.cuisine-modal-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.01em;
}

[data-bs-theme="dark"] .cuisine-modal-title,
.dark-mode .cuisine-modal-title {
    color: #ffffff;
}

.cuisine-modal-subtitle {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #64748b;
    margin: 2px 0 0 0;
}

[data-bs-theme="dark"] .cuisine-modal-subtitle,
.dark-mode .cuisine-modal-subtitle {
    color: #a1a1aa;
}

.cuisine-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.cuisine-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.06);
}

[data-bs-theme="dark"] .cuisine-close-btn,
.dark-mode .cuisine-close-btn {
    background: #27272a;
    color: #a1a1aa;
}

[data-bs-theme="dark"] .cuisine-close-btn:hover,
.dark-mode .cuisine-close-btn:hover {
    background: #3f3f46;
    color: #ffffff;
}

/* Body */
.cuisine-modal-body {
    padding: 20px 24px;
    overflow: visible !important;
}

.cuisine-input-wrapper {
    position: relative;
}

.cuisine-input-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    margin-bottom: 8px;
}

[data-bs-theme="dark"] .cuisine-input-label,
.dark-mode .cuisine-input-label {
    color: #94a3b8;
}

.cuisine-input-hint {
    font-size: 0.74rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

/* Search Box */
.cuisine-search-box {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.cuisine-search-icon {
    position: absolute;
    left: 15px;
    color: #94a3b8;
    font-size: 1.05rem;
    pointer-events: none;
    transition: color 0.18s ease;
    z-index: 2;
}

.cuisine-search-box:focus-within .cuisine-search-icon {
    color: #005FB8;
}

[data-bs-theme="dark"] .cuisine-search-box:focus-within .cuisine-search-icon,
.dark-mode .cuisine-search-box:focus-within .cuisine-search-icon {
    color: #38bdf8;
}

.cuisine-search-input {
    width: 100%;
    height: 48px;
    padding: 0 42px 0 44px;
    border-radius: 12px;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.98rem;
    font-weight: 500;
    color: #0f172a;
    transition: all 0.18s ease;
    outline: none;
    box-sizing: border-box;
}

.cuisine-search-input:focus {
    border-color: #005FB8;
    box-shadow: 0 0 0 4px rgba(0, 95, 184, 0.14);
    background: #ffffff;
}

[data-bs-theme="dark"] .cuisine-search-input,
.dark-mode .cuisine-search-input {
    background: #27272a;
    border-color: #3f3f46;
    color: #ffffff;
}

[data-bs-theme="dark"] .cuisine-search-input:focus,
.dark-mode .cuisine-search-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
    background: #27272a;
}

.cuisine-clear-icon {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    z-index: 2;
}

.cuisine-clear-icon:hover {
    color: #64748b;
}

/* Floating Autosuggest Panel */
.cuisine-autosuggest-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04);
    max-height: 240px;
    overflow-y: auto;
    z-index: 1080;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

[data-bs-theme="dark"] .cuisine-autosuggest-panel,
.dark-mode .cuisine-autosuggest-panel {
    background: #222225;
    border-color: #3f3f46;
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5);
    scrollbar-color: #3f3f46 transparent;
}

.cuisine-autosuggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.92rem;
    color: #1e293b;
    transition: all 0.12s ease;
    user-select: none;
    margin-bottom: 2px;
}

[data-bs-theme="dark"] .cuisine-autosuggest-item,
.dark-mode .cuisine-autosuggest-item {
    color: #f1f5f9;
}

.cuisine-autosuggest-item:hover,
.cuisine-autosuggest-item.is-active {
    background: #f1f5f9;
    color: #0f172a;
}

[data-bs-theme="dark"] .cuisine-autosuggest-item:hover,
[data-bs-theme="dark"] .cuisine-autosuggest-item.is-active,
.dark-mode .cuisine-autosuggest-item:hover,
.dark-mode .cuisine-autosuggest-item.is-active {
    background: #2e2e33;
    color: #ffffff;
}

.cuisine-autosuggest-item.is-active {
    background: rgba(0, 95, 184, 0.09) !important;
    color: #005FB8 !important;
    font-weight: 600;
}

[data-bs-theme="dark"] .cuisine-autosuggest-item.is-active,
.dark-mode .cuisine-autosuggest-item.is-active {
    background: rgba(56, 189, 248, 0.16) !important;
    color: #38bdf8 !important;
}

.cuisine-suggest-name {
    font-weight: 500;
}

.cuisine-suggest-name mark {
    background: rgba(0, 95, 184, 0.12);
    color: #005FB8;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 4px;
}

[data-bs-theme="dark"] .cuisine-suggest-name mark,
.dark-mode .cuisine-suggest-name mark {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.cuisine-suggest-badge {
    font-size: 0.74rem;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 3px 9px;
    border-radius: 9999px;
    font-weight: 500;
    margin-left: 8px;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .cuisine-suggest-badge,
.dark-mode .cuisine-suggest-badge {
    background: #1e1e21;
    border-color: #3f3f46;
    color: #94a3b8;
}

/* Popular Quick Picks Area */
.cuisine-popular-wrap {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

[data-bs-theme="dark"] .cuisine-popular-wrap,
.dark-mode .cuisine-popular-wrap {
    border-top-color: #27272a;
}

.cuisine-popular-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.cuisine-popular-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cuisine-pop-chip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.cuisine-pop-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

[data-bs-theme="dark"] .cuisine-pop-chip,
.dark-mode .cuisine-pop-chip {
    background: #27272a;
    border-color: #3f3f46;
    color: #d4d4d8;
}

[data-bs-theme="dark"] .cuisine-pop-chip:hover,
.dark-mode .cuisine-pop-chip:hover {
    background: #3f3f46;
    color: #ffffff;
}

/* Footer */
.cuisine-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-radius: 0 0 20px 20px;
}

[data-bs-theme="dark"] .cuisine-modal-footer,
.dark-mode .cuisine-modal-footer {
    background: #1c1c1f;
    border-top-color: #27272a;
}

.cuisine-kbd-hints {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    color: #94a3b8;
}

.cuisine-kbd-hints kbd {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
    color: #475569;
    font-family: inherit;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

[data-bs-theme="dark"] .cuisine-kbd-hints kbd,
.dark-mode .cuisine-kbd-hints kbd {
    background: #27272a;
    border-color: #3f3f46;
    color: #cbd5e1;
}

.cuisine-btn-secondary {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

[data-bs-theme="dark"] .cuisine-btn-secondary,
.dark-mode .cuisine-btn-secondary {
    background: #27272a;
    border-color: #3f3f46;
    color: #d4d4d8;
}

[data-bs-theme="dark"] .cuisine-btn-secondary:hover,
.dark-mode .cuisine-btn-secondary:hover {
    background: #3f3f46;
    color: #ffffff;
}

.cuisine-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 10px;
    border: 1px solid #005FB8;
    background: #005FB8;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 95, 184, 0.25);
    transition: all 0.18s ease;
}

.cuisine-btn-primary:hover {
    background: #004c94;
    border-color: #004c94;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 95, 184, 0.35);
}

/* ==========================================================================
   INTERACTIVE TAGS STYLES
   ========================================================================== */
.recipe-tag-pill {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}
.recipe-tag-pill:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.recipe-tag-pill .tag-label {
    cursor: pointer;
}
.recipe-tag-pill .tag-label:hover {
    color: #2563eb;
    text-decoration: underline;
}
.btn-tag-remove {
    background: none;
    border: none;
    padding: 0;
    margin-left: 6px;
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    transition: all 0.15s ease;
}
.btn-tag-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}
.btn-add-tag-inline {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #2563eb;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-add-tag-inline:hover {
    background: #eff6ff;
    border-color: #2563eb;
}
.wp-tags-box {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 8px;
}
.wp-tag-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #2563eb;
    font-size: 0.95rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 3;
}
.wp-tag-input {
    width: 100%;
    height: 38px;
    background-color: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 6px 14px 6px 32px !important;
    font-size: 0.83rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    box-shadow: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.wp-tag-input:focus {
    background-color: #ffffff !important;
    border-color: #2563eb !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
}
.wp-tag-input::placeholder {
    color: #94a3b8 !important;
    font-size: 0.82rem !important;
}
.wp-btn-add-tag {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb !important;
    border: 1.5px solid #2563eb !important;
    color: #ffffff !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 0 16px !important;
    border-radius: 8px !important;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}
.wp-btn-add-tag:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.wp-btn-add-tag:active {
    transform: scale(0.98);
}
[data-bs-theme="dark"] .recipe-tag-pill,
.dark-mode .recipe-tag-pill {
    background: #252526 !important;
    border-color: #3c3c3c !important;
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .recipe-tag-pill:hover,
.dark-mode .recipe-tag-pill:hover {
    background: #1e293b !important;
    border-color: #3b82f6 !important;
}
[data-bs-theme="dark"] .btn-add-tag-inline,
.dark-mode .btn-add-tag-inline {
    background: #1e1e1e !important;
    border-color: #4b5563 !important;
    color: #60a5fa !important;
}
[data-bs-theme="dark"] .wp-tags-box,
.dark-mode .wp-tags-box {
    background: transparent !important;
    border: none !important;
}
[data-bs-theme="dark"] .wp-tag-input-icon,
.dark-mode .wp-tag-input-icon {
    color: #60a5fa !important;
}
[data-bs-theme="dark"] .wp-tag-input,
.dark-mode .wp-tag-input {
    background-color: #252526 !important;
    border: 1.5px solid #3c3c3c !important;
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .wp-tag-input:focus,
.dark-mode .wp-tag-input:focus {
    background-color: #252526 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}
[data-bs-theme="dark"] .wp-tag-input::placeholder,
.dark-mode .wp-tag-input::placeholder {
    color: #64748b !important;
}
[data-bs-theme="dark"] .wp-btn-add-tag,
.dark-mode .wp-btn-add-tag {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}
[data-bs-theme="dark"] .wp-btn-add-tag:hover,
.dark-mode .wp-btn-add-tag:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

/* ==========================================================================
   CATEGORY SELECTOR MODAL STYLES
   ========================================================================== */
.cat-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cat-item-row:hover {
    background: #f8fafc;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.cat-item-row.active {
    background: #ecfdf5;
    border-color: #10b981;
    font-weight: 600;
}
.cat-item-name {
    font-size: 0.9rem;
    color: #1e293b;
}
.cat-item-parent-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #64748b;
    margin-left: 8px;
    font-weight: 500;
}
[data-bs-theme="dark"] .cat-item-row,
.dark-mode .cat-item-row {
    background: #252526 !important;
    border-color: #3c3c3c !important;
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .cat-item-row:hover,
.dark-mode .cat-item-row:hover {
    background: #2d2d30 !important;
    border-color: #10b981 !important;
}
[data-bs-theme="dark"] .cat-item-row.active,
.dark-mode .cat-item-row.active {
    background: #064e3b !important;
    border-color: #059669 !important;
}
[data-bs-theme="dark"] .cat-item-name,
.dark-mode .cat-item-name {
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .cat-item-parent-badge,
.dark-mode .cat-item-parent-badge {
    background: #334155 !important;
    color: #94a3b8 !important;
}

/* ==========================================================================
   FINAL NOTES STUDIO STYLES
   ========================================================================== */
.recipe-final-notes-section {
    background: rgba(245, 158, 11, 0.04);
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-left: 4px solid #f59e0b;
}
.btn-add-final-note {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #f59e0b;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #d97706;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-add-final-note:hover {
    background: #fef3c7;
    color: #b45309;
}
.recipe-final-note-item {
    position: relative;
    padding-left: 4px;
    line-height: 1.6;
}
.recipe-final-note-text {
    cursor: pointer;
}
.recipe-final-note-text:hover {
    color: #d97706;
    text-decoration: underline;
}
.btn-remove-note {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}
.btn-remove-note:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1);
}
[data-bs-theme="dark"] .recipe-final-notes-section,
.dark-mode .recipe-final-notes-section {
    background: rgba(245, 158, 11, 0.06) !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
}
[data-bs-theme="dark"] .btn-add-final-note,
.dark-mode .btn-add-final-note {
    background: #27272a !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
}

/* ==========================================================================
   Baker's Math % Button (Artisan Bakery Pill)
   ========================================================================== */
.btn-bakers-math {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    font-size: 0.74rem !important;
    font-weight: 650 !important;
    line-height: 1.25 !important;
    padding: 0.28rem 0.75rem !important;
    border-radius: 50rem !important;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    color: #92400e !important;
    border: 1px solid #f59e0b !important;
    box-shadow: 0 1px 2px rgba(217, 119, 6, 0.1) !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.18s ease-in-out !important;
    white-space: nowrap !important;
}

.btn-bakers-math:hover {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
    color: #78350f !important;
    border-color: #d97706 !important;
    box-shadow: 0 3px 8px rgba(217, 119, 6, 0.22) !important;
    transform: translateY(-1px) !important;
}

.btn-bakers-math:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(217, 119, 6, 0.1) !important;
}

.btn-bakers-math .btn-bakers-math-icon {
    font-size: 0.88rem !important;
    line-height: 1 !important;
}

[data-bs-theme="dark"] .btn-bakers-math,
body.dark-mode .btn-bakers-math {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.22) 100%) !important;
    color: #fde68a !important;
    border-color: rgba(245, 158, 11, 0.45) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .btn-bakers-math:hover,
body.dark-mode .btn-bakers-math:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.28) 0%, rgba(217, 119, 6, 0.36) 100%) !important;
    color: #ffffff !important;
    border-color: #f59e0b !important;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25) !important;
}

/* ==========================================================================
   Baker's Math Card & Markdown Tables Presentation
   ========================================================================== */
.bakers-math-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    overflow: hidden;
    margin: 0.5rem 0 0.25rem 0;
    font-family: inherit;
}

.bakers-card-header {
    background: linear-gradient(135deg, #fffdf5 0%, #fef9c3 100%);
    border-bottom: 1px solid #fef08a;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.bakers-card-icon {
    font-size: 1.35rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(180, 83, 9, 0.15));
}

.bakers-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #78350f;
    line-height: 1.25;
}

.bakers-card-subtitle {
    font-size: 0.73rem;
    color: #92400e;
    font-weight: 500;
    line-height: 1.2;
}

.bakers-type-badge {
    font-size: 0.72rem !important;
    font-weight: 650 !important;
    color: #92400e !important;
    border-color: #fde047 !important;
    background: #ffffff !important;
}

.bakers-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fafafa;
    border-bottom: 1px solid #f1f5f9;
}

.bakers-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.bakers-stat-label {
    font-size: 0.69rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.bakers-stat-value {
    font-size: 1.18rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bakers-table-container {
    padding: 0;
    background: #ffffff;
}

/* Chat Markdown Tables */
.chat-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.83rem;
    line-height: 1.4;
    text-align: left;
}

.chat-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.6rem 0.95rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.chat-table tbody td {
    padding: 0.55rem 0.95rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.chat-table tbody tr:last-child td {
    border-bottom: none;
}

.chat-table tbody tr:hover td {
    background-color: #f8fafc;
}

/* Baker's Math Flour Baseline Highlight */
.chat-table-bakers .bakers-flour-row td {
    background-color: #fffbeb !important;
    color: #78350f !important;
    font-weight: 600;
}

.chat-table-bakers .bakers-flour-row:hover td {
    background-color: #fef3c7 !important;
}

.bakers-flour-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.67rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    background: #fef08a;
    color: #854d0e;
    border: 1px solid #facc15;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.bakers-weight-val {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.84rem;
}

.bakers-pct-badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    font-size: 0.77rem;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    min-width: 3.2rem;
    text-align: center;
}

.bakers-pct-badge.bakers-pct-base {
    background: #fef08a;
    color: #854d0e;
    border-color: #facc15;
    font-weight: 800;
}

.bakers-card-footer {
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.74rem;
    color: #64748b;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.4;
}

/* Dark mode compatibility */
[data-bs-theme="dark"] .bakers-math-card,
body.dark-mode .bakers-math-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .bakers-card-header,
body.dark-mode .bakers-card-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.2) 100%);
    border-bottom-color: rgba(245, 158, 11, 0.3);
}

[data-bs-theme="dark"] .bakers-card-title,
body.dark-mode .bakers-card-title {
    color: #fef08a;
}

[data-bs-theme="dark"] .bakers-card-subtitle,
body.dark-mode .bakers-card-subtitle {
    color: #fde68a;
}

[data-bs-theme="dark"] .bakers-stats-grid,
body.dark-mode .bakers-stats-grid {
    background: #0f172a;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .bakers-stat-card,
body.dark-mode .bakers-stat-card {
    background: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .bakers-stat-value,
body.dark-mode .bakers-stat-value {
    color: #f8fafc;
}

[data-bs-theme="dark"] .chat-table thead th,
body.dark-mode .chat-table thead th {
    background: #0f172a;
    color: #94a3b8;
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .chat-table tbody td,
body.dark-mode .chat-table tbody td {
    border-bottom-color: #334155;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .chat-table tbody tr:hover td,
body.dark-mode .chat-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .chat-table-bakers .bakers-flour-row td,
body.dark-mode .chat-table-bakers .bakers-flour-row td {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #fef08a !important;
}

[data-bs-theme="dark"] .bakers-weight-val,
body.dark-mode .bakers-weight-val {
    color: #f1f5f9;
}

[data-bs-theme="dark"] .bakers-pct-badge,
body.dark-mode .bakers-pct-badge {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}

[data-bs-theme="dark"] .bakers-pct-badge.bakers-pct-base,
body.dark-mode .bakers-pct-badge.bakers-pct-base {
    background: #854d0e;
    color: #fef08a;
    border-color: #a16207;
}

[data-bs-theme="dark"] .bakers-card-footer,
body.dark-mode .bakers-card-footer {
    background: #0f172a;
    border-top-color: #334155;
    color: #94a3b8;
}

/* ==========================================================================
   CHEF TIPS & FINAL NOTES - RIGHT-ALIGNED DELETE ICONS & FLEX CONTAINER
   Keeps delete/trash icons pinned properly to the far right margin in a neat column,
   rather than floating haphazardly inline at the end of variable-length text.
   ========================================================================== */
.recipe-chef-tips-list,
.recipe-final-notes-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.recipe-chef-tip-item,
.recipe-final-note-item {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 3px 6px !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    transition: background-color 0.15s ease !important;
}

.recipe-chef-tip-item:hover {
    background-color: rgba(245, 158, 11, 0.06) !important;
}

.recipe-final-note-item:hover {
    background-color: rgba(99, 102, 241, 0.06) !important;
}

.recipe-tip-body,
.recipe-note-body {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    line-height: 1.55 !important;
}

.recipe-tip-bullet,
.recipe-note-bullet {
    flex-shrink: 0 !important;
    font-weight: 700 !important;
    line-height: 1.55 !important;
    user-select: none !important;
}

.recipe-tip-bullet {
    color: #d97706 !important;
}

.recipe-note-bullet {
    color: #4f46e5 !important;
}

.recipe-chef-tip-text,
.recipe-final-note-text {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: break-word !important;
}

/* Right-aligned delete button */
.btn-remove-tip,
.btn-remove-note {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    align-self: flex-start !important;
    background: transparent !important;
    border: none !important;
    padding: 3px 7px !important;
    border-radius: 6px !important;
    color: #94a3b8 !important;
    font-size: 0.82rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    opacity: 0.45 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: opacity 0.18s ease, color 0.18s ease, background-color 0.18s ease, transform 0.12s ease !important;
}

.recipe-chef-tip-item:hover .btn-remove-tip,
.recipe-final-note-item:hover .btn-remove-note {
    opacity: 0.85 !important;
}

.btn-remove-tip:hover,
.btn-remove-note:hover {
    opacity: 1 !important;
    color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.12) !important;
    transform: scale(1.12) !important;
}

.btn-remove-tip:active,
.btn-remove-note:active {
    transform: scale(0.95) !important;
}

/* Dark mode overrides */
[data-bs-theme="dark"] .recipe-chef-tip-item:hover,
body.dark-mode .recipe-chef-tip-item:hover {
    background-color: rgba(245, 158, 11, 0.12) !important;
}

[data-bs-theme="dark"] .recipe-final-note-item:hover,
body.dark-mode .recipe-final-note-item:hover {
    background-color: rgba(99, 102, 241, 0.14) !important;
}

[data-bs-theme="dark"] .btn-remove-tip,
[data-bs-theme="dark"] .btn-remove-note,
body.dark-mode .btn-remove-tip,
body.dark-mode .btn-remove-note {
    color: #64748b !important;
}

[data-bs-theme="dark"] .btn-remove-tip:hover,
[data-bs-theme="dark"] .btn-remove-note:hover,
body.dark-mode .btn-remove-tip:hover,
body.dark-mode .btn-remove-note:hover {
    color: #f87171 !important;
    background-color: rgba(239, 68, 68, 0.2) !important;
}



