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

:root {
    --chat-bg: #F8F8F8;
    --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, #F8F8F8) !important;
    color: var(--chat-text-main, #3B3B3B);
}

.recipe-chat-studio-wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px 260px 16px;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

/* 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 */
.recipe-chat-header {
    text-align: center;
    margin-bottom: 20px;
}
.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 */
.chat-msg {
    display: flex;
    gap: 12px;
    max-width: 88%;
    animation: fadeInMsg 0.28s ease-out;
}
@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-bot {
    align-self: flex-start;
}
.chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    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: 12px;
    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: 10px;
    display: block;
}

.chat-bubble {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 0.93rem;
    line-height: 1.55;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.chat-msg-bot .chat-bubble {
    background: var(--chat-bot-bubble);
    border: 1px solid var(--chat-border);
    color: var(--chat-text-main);
    border-top-left-radius: 4px;
}
.chat-msg-user .chat-bubble {
    background: var(--chat-user-bubble);
    color: var(--chat-user-text);
    border-top-right-radius: 4px;
}

/* 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: 780px;
    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 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--chat-text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.recipe-preview-title input {
    background: transparent;
    border: 1px dashed transparent;
    color: inherit;
    font: inherit;
    width: 100%;
    border-radius: 8px;
    padding: 2px 6px;
    transition: all 0.2s;
}
.recipe-preview-title input:focus {
    outline: none;
    border-color: var(--chat-accent);
    background: var(--chat-primary-light);
}

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

/* Time & Stats Pills */
.recipe-preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}
.preview-stat-box {
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    padding: 10px 12px;
    text-align: center;
}
.preview-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--chat-text-muted);
    margin-bottom: 2px;
}
.preview-stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--chat-text-main);
}

/* 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;
}
.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: pointer;
    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);
}
.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;
}

/* 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: 4px;
}
.preview-step-text {
    font-size: 0.88rem;
    color: var(--chat-text-muted);
    line-height: 1.5;
    margin-bottom: 6px;
}
.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: 18px;
    border-top: 1px solid var(--chat-border);
}
.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-draft {
    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-draft:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    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 {
    border-color: var(--chat-border, #E2E8F0) !important;
}
.recipe-meticulous-bar .btn-outline-secondary {
    border-color: var(--chat-border, #CBD5E1);
    color: var(--chat-text-main, #334155);
    background: var(--chat-card-bg, #ffffff);
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}
.recipe-meticulous-bar .btn-outline-secondary:hover {
    background: var(--chat-bg, #F1F5F9);
    color: var(--chat-primary, #005FB8);
    border-color: var(--chat-primary, #005FB8);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-secondary,
.dark-mode .recipe-meticulous-bar .btn-outline-secondary {
    background: #252526;
    border-color: #3C3C3C;
    color: #CCCCCC;
}
[data-bs-theme="dark"] .recipe-meticulous-bar .btn-outline-secondary:hover,
.dark-mode .recipe-meticulous-bar .btn-outline-secondary:hover {
    background: #2d2d30;
    border-color: #3794FF;
    color: #3794FF;
}

/* 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: 12px 16px 20px 16px;
    background: linear-gradient(to top, var(--chat-bg) 70%, transparent 100%);
}

.recipe-chat-composer-container {
    max-width: 960px;
    margin: 0 auto;
    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;
}

.recipe-chat-composer-container: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, #F8F8F8);
    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: 270px;
    }
    .recipe-chat-composer-wrap {
        padding: 8px 10px 14px 10px;
    }
    .recipe-chat-composer-container {
        border-radius: 18px;
        padding: 10px 12px;
    }
}

/* ==========================================================================
   HIDE SITE FOOTER ON RECIPE AI STUDIO PAGE
   Ensure ONLY the chatbox is visible at the bottom of the viewport
   ========================================================================== */
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;
    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, #f8fafc) 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;
    }
}


