/* ============================================
   RECIPES SIDEBAR — Estilos
   Requiere: app.css, news.css (filter-bar, bchip, state-msg)
============================================ */

.recipes-sidebar-inner {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    padding: 14px 14px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--border-subtle);
}

.recipes-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.recipes-sidebar-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recipes-sidebar-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Two compact filter-bar rows */
.recipes-sidebar-inner .filter-bar {
    margin-bottom: 6px;
    padding-bottom: 6px;
}

.recipes-sidebar-inner .filter-bar:last-of-type {
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
    padding-bottom: 8px;
}

.recipes-sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    margin-right: -6px;
    padding-right: 6px;
}

.recipes-feed-main {
    padding-top: 4px;
    padding-bottom: 12px;
}

/* ============================================
   RECIPE CARD — Accordion
============================================ */
.recipes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recipe-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    animation: fadeIn 0.2s ease both;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Expanded state — accent border */
.recipe-card.expanded {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

@media (hover: hover) {
    .recipe-card:not(.expanded):hover {
        border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* ════════════════════════════════════════
   PHOTO STRIP (3 thumbnails, each opens lightbox)
════════════════════════════════════════ */
.recipe-photo-strip {
    display: flex;
    gap: 2px;
    border-radius: 9px 9px 0 0;
    overflow: hidden;
    flex-shrink: 0;
}

.recipe-photo-btn {
    flex: 1;
    padding: 0;
    background: var(--bg-sunken, rgba(0,0,0,0.3));
    border: none;
    cursor: zoom-in;
    overflow: hidden;
    display: block;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.recipe-photo-btn::after {
    content: "⤢";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.15s ease;
}

@media (hover: hover) {
    .recipe-photo-btn:hover::after {
        opacity: 1;
    }
}

.recipe-preview-thumb {
    display: block;
    width: 100%;
    height: 100px;
    object-fit: cover;
    object-position: center 40%;
    transition: transform 0.2s ease;
    -webkit-user-drag: none;
    pointer-events: none;
}

@media (hover: hover) {
    .recipe-photo-btn:hover .recipe-preview-thumb {
        transform: scale(1.06);
    }
}

/* ── Compare button overlay (top-right corner of photo strip) ── */
.recipe-photo-wrapper {
    position: relative;
}

.recipe-compare-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.recipe-compare-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.12);
}

.recipe-compare-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.recipe-compare-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Accordion toggle button (texto solamente) ── */
.recipe-card-toggle {
    display: block;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.recipe-card-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: 0 0 9px 9px;
}

/* ── Body row: summary text + expand icon ── */
.recipe-card-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px 12px;
    transition: background 0.12s ease;
}

.recipe-card-toggle:hover .recipe-card-body {
    background: rgba(255, 255, 255, 0.03);
}
[data-theme="light"] .recipe-card-toggle:hover .recipe-card-body {
    background: rgba(0, 0, 0, 0.03);
}

/* ── Summary column (fills space beside expand icon) ── */
.recipe-card-summary {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Meta row: aesthetic chip + camera ── */
.recipe-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Aesthetic chips ── */
.recipe-aesthetic-chip {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    line-height: 1.5;
}

.aesthetic-bw {
    background: rgba(161, 161, 170, 0.15);
    color: #a1a1aa;
    border: 1px solid rgba(161, 161, 170, 0.4);
}
[data-theme="light"] .aesthetic-bw {
    color: #52525b;
    border-color: rgba(82, 82, 91, 0.4);
    background: rgba(82, 82, 91, 0.1);
}

.aesthetic-retro {
    background: rgba(251, 191, 36, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(251, 191, 36, 0.3);
}
[data-theme="light"] .aesthetic-retro {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.08);
}

.aesthetic-slide {
    background: rgba(132, 204, 22, 0.12);
    color: #84cc16;
    border: 1px solid rgba(132, 204, 22, 0.3);
}
[data-theme="light"] .aesthetic-slide {
    color: #65a30d;
    border-color: rgba(101, 163, 13, 0.3);
    background: rgba(101, 163, 13, 0.08);
}

.aesthetic-other {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* ── Camera label ── */
.recipe-camera-label {
    font-size: 0.67rem;
    font-weight: 500;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Recipe name ── */
.recipe-name {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
    letter-spacing: -0.01em;
    margin: 0;
}

/* ── Description — clamp to 2 lines ── */
.recipe-desc {
    font-size: 0.77rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-card.expanded .recipe-desc {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

/* ── Expand icon ── */
.recipe-expand-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-faint);
    font-size: 0.85rem;
    font-style: normal;
    line-height: 1;
    margin-top: 2px;
    transition: transform 0.2s ease, background 0.15s ease, color 0.15s ease;
    user-select: none;
}
[data-theme="light"] .recipe-expand-icon {
    background: rgba(0, 0, 0, 0.07);
}

.recipe-card.expanded .recipe-expand-icon {
    transform: rotate(90deg);
    background: var(--accent-dim);
    color: var(--accent);
}

/* ── Steps panel (hidden by default via `hidden` attr) ── */
.recipe-steps-panel {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border-subtle);
}

.recipe-steps-label {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-faint);
    margin: 10px 0 8px;
}

.recipe-steps {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 14px;
    margin: 0;
}

.recipe-steps dt {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    padding: 1px 0;
    align-self: baseline;
}

.recipe-steps dd {
    font-size: 0.74rem;
    font-family: "DM Mono", "Fira Mono", monospace;
    font-weight: 500;
    color: var(--accent);
    margin: 0;
    word-break: break-word;
    padding: 1px 0;
    align-self: baseline;
}

/* Subtle row stripe for readability */
.recipe-steps dt:nth-child(4n+1),
.recipe-steps dd:nth-child(4n+2) {
    background: rgba(255, 255, 255, 0.025);
    border-radius: 3px;
}
[data-theme="light"] .recipe-steps dt:nth-child(4n+1),
[data-theme="light"] .recipe-steps dd:nth-child(4n+2) {
    background: rgba(0, 0, 0, 0.03);
}

/* ── Mobile: full-screen recipes view (mirrors news mobile layout) ── */
@media (max-width: 1080px) {
    .recipes-sidebar-inner {
        position: relative;
        top: auto;
        max-height: none;
        flex: 1;
        min-height: 0;
    }

    .app-layout[data-mobile-view="recipes"] .recipes-sidebar-inner {
        flex: 1;
        min-height: 0;
        max-height: none;
    }

    .app-layout[data-mobile-view="recipes"] .recipes-sidebar-scroll {
        flex: 1;
        min-height: 0;
    }
}

/* ════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════ */
.recipe-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9200; /* above compare modal (9100) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.recipe-lightbox[hidden] {
    display: none;
}

.recipe-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: zoom-out;
}

.recipe-lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: min(94vw, 820px);
    width: 100%;
    animation: lbIn 0.2s ease both;
}

@keyframes lbIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.recipe-lightbox-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.recipe-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.recipe-lightbox-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Wrap around image so detail overlay can be positioned inside */
.recipe-lightbox-img-wrap {
    position: relative;
    width: 100%;
    line-height: 0; /* remove gap below inline img */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
}

.recipe-lightbox-img {
    display: block;
    width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 10px;
}

/* ── Recipe detail overlay (bottom-right of photo) ── */
.recipe-lightbox-detail {
    position: absolute;
    bottom: 12px;
    right: 12px;
    max-width: 210px;
    max-height: 55%;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 12px;
    pointer-events: auto;
    /* Thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.recipe-lightbox-detail[hidden] {
    display: none;
}

.lb-detail-head {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.lb-detail-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.lb-detail-cam {
    font-size: 0.64rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.01em;
}

.lb-detail-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
}

.lb-detail-steps dt {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 5px;
    line-height: 1.2;
}

.lb-detail-steps dd {
    font-size: 0.68rem;
    font-family: "DM Mono", "Fira Mono", monospace;
    font-weight: 500;
    color: #a78bfa;
    margin: 0 0 1px;
    line-height: 1.3;
    word-break: break-word;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lb-detail-steps dd:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

@media (max-width: 600px) {
    .recipe-lightbox-detail {
        max-width: 160px;
        font-size: 0.6rem;
        padding: 8px 10px;
    }
}

.recipe-lightbox-caption {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-align: center;
    margin: 0;
}

/* ════════════════════════════════════════
   COMPARE TRAY (sticky bottom of sidebar)
════════════════════════════════════════ */
.compare-tray {
    border-top: 1px solid var(--border-subtle);
    padding: 10px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.compare-tray-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.compare-tray-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
}

.compare-tray-clear {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.12s;
}

.compare-tray-clear:hover {
    color: var(--text-muted);
}

.compare-tray-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.compare-tray-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-dim);
    border-radius: 99px;
    padding: 3px 6px 3px 8px;
    max-width: 100%;
}

.compare-tray-chip-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.compare-tray-chip-remove {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 1px;
    opacity: 0.7;
    transition: opacity 0.12s;
}

.compare-tray-chip-remove:hover {
    opacity: 1;
}

.compare-open-btn {
    width: 100%;
    padding: 8px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
    letter-spacing: 0.01em;
}

.compare-open-btn:hover:not(:disabled) {
    opacity: 0.88;
}

.compare-open-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ════════════════════════════════════════
   COMPARE MODAL
════════════════════════════════════════ */
.compare-modal {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.compare-modal[hidden] {
    display: none;
}

.compare-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: zoom-out;
}

.compare-modal-panel {
    position: relative;
    z-index: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: lbIn 0.2s ease both;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.compare-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.compare-modal-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
    white-space: nowrap;
}

.compare-photo-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}

.compare-photo-tab {
    padding: 5px 12px;
    border-radius: 99px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.compare-photo-tab.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.compare-photo-tab:hover:not(.active) {
    border-color: var(--text-faint);
    color: var(--text-main);
}

.compare-modal-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.compare-modal-close:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

.compare-modal-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Columns */
.compare-columns {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.compare-col {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
}

.compare-col:last-child {
    border-right: none;
}

.compare-col-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.compare-col-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compare-col-cam {
    font-size: 0.68rem;
    color: var(--text-faint);
    white-space: nowrap;
}

.compare-col-remove {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.12s;
    flex-shrink: 0;
}

.compare-col-remove:hover {
    color: var(--text-main);
}

.compare-col-img-wrap {
    flex: 1;
    overflow: hidden;
    background: var(--bg-base);
}

.compare-col-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    cursor: zoom-in;
    transition: transform 0.2s ease;
    min-height: 260px;
}

@media (hover: hover) {
    .compare-col-img:hover {
        transform: scale(1.03);
    }
}

/* On small screens, columns stack vertically */
@media (max-width: 600px) {
    .compare-col {
        min-width: 85vw;
    }
}
