/*
 * recipe-mobile.css
 * ─────────────────────────────────────────────────────────────────────────────
 * Mobile SPA companion stylesheet.
 *
 * WHAT GETS INJECTED:
 *   menu_manager.js fetches the pre-compiled static recipe HTML, extracts
 *   .recipe-page-container innerHTML via DOMParser, and injects it into
 *   #recipe-mobile-container. The injected markup uses desktop recipe.css
 *   class names (.recipe-content, .recipe-banner, .ingredients-grid,
 *   .recipe-steps, etc.).
 * 
 * This CSS is the result of extrapolation from desktop-recipe.css, 
 *  previously named recipe.css, which served as a common stylesheet for both
 *  desktop and mobile recipe pages. In order to avoid any conflicts 
 *  with class and ID names, everything is referenced via the
 *  #recipe-mobile-container prefix. This is a scoped CSS.
 * ─────────────────────────────────────────────────────────────────────────────
 */

#recipe-mobile-container .side-curiosita-preview {
    display: none !important;
}

/* =============================================================================
   SCOPED RESET — only affects injected content
   ============================================================================= */

#recipe-mobile-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =============================================================================
   CONTAINER ROOT — replaces recipe.css `body` declarations
   ============================================================================= */

#recipe-mobile-container {
    font-family: 'Inter', sans-serif;
    color: #2c2418;
    line-height: 1.5;
    width: 100%;
    display: block;
}

/* =============================================================================
   PAGE CONTAINER
   ============================================================================= */

#recipe-mobile-container .recipe-page-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    /* no 1200px cap on mobile */
    margin: 0 auto;
}

/* =============================================================================
   MAIN CONTENT CARD
   ============================================================================= */

#recipe-mobile-container .recipe-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* =============================================================================
   HEADER BANNER — mobile values applied directly (no media wrapper needed)
   ============================================================================= */

#recipe-mobile-container .recipe-banner {
    position: relative;
    width: 100%;
    height: 160px;
    /* mobile override from recipe.css @media */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-image: url('../img/mobile_title_bkg.webp');
    /* mobile bg */
    background-size: cover;
    background-position: center;
    color: #ffffff;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.7);
    padding: 12px;
    box-sizing: border-box;
    -webkit-mask-image: none;
    /* remove desktop mask on mobile */
    mask-image: none;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.8rem;
}

#recipe-mobile-container .recipe-title {
    margin: 0;
    font-size: 1.2rem;
    /* mobile override */
    font-weight: bold;
    max-width: 85%;
    color: #ffffff;
    text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.8);
}

#recipe-mobile-container .recipe-subtitle {
    margin: 8px 0 0 0;
    opacity: 0.9;
    max-width: 85%;
    font-size: 0.85rem;
    /* mobile override */
    color: #ffffff;
}

/* =============================================================================
   HERO SHOWCASE — stacked column on mobile
   ============================================================================= */

#recipe-mobile-container .recipe-hero-showcase {
    display: flex;
    flex-direction: column;
    /* mobile override */
    align-items: stretch;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #f3e5d5;
    gap: 0;
    border-radius: 12px;
    /* mobile override */
    overflow: hidden;
}

#recipe-mobile-container .recipe-media-slot {
    width: 100%;
    /* mobile override */
    height: auto;
    /* mobile override */
    background-color: #dae9f4;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#recipe-mobile-container .recipe-main-photo {
    width: 100%;
    height: 100%;
    max-height: 260px;
    /* mobile override */
    object-fit: cover;
    display: block;
}

#recipe-mobile-container .recipe-side-info {
    width: 100%;
    /* mobile override */
    padding: 1.2rem;
    /* mobile override */
    background-color: #dae9f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

#recipe-mobile-container .recipe-side-info .info-badge-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* mobile override */
    gap: 0.6rem;
    /* mobile override */
    width: 100%;
}

/* =============================================================================
   EXTENDED INFO BAR
   ============================================================================= */

#recipe-mobile-container .recipe-extended-info-bar {
    width: 100%;
    padding: 1rem;
    /* mobile override */
    background-color: #dae9f4;
    border-bottom: 1px solid #f3e5d5;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.8rem;
    /* mobile override */
    border-radius: 12px;
    /* mobile override */
    overflow: hidden;
    margin-top: 0.8rem;
    /* mobile override */
}

/* =============================================================================
   INFO BADGES
   ============================================================================= */

#recipe-mobile-container .info-badge {
    background: white;
    padding: 0.6rem;
    /* mobile override */
    border-radius: 8px;
    /* mobile override */
    font-size: 0.8rem;
    /* mobile override */
    font-weight: 500;
    color: #7a4b2a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.4rem;
    border: 1px solid #fcf6ee;
}

#recipe-mobile-container .info-badge.long-badge {
    background: white;
    border: 1px solid #ebdcd0;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    /* mobile override */
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    /* mobile override */
    gap: 0.6rem;
    color: #5c3a1e;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    width: 100%;
    /* mobile override */
}

#recipe-mobile-container .info-badge i {
    color: #e07a3a;
    font-size: 1.2rem;
}

#recipe-mobile-container .info-badge strong {
    font-weight: 700;
    color: #5c3a1e;
}

/* =============================================================================
   CONTENT SECTIONS
   ============================================================================= */

#recipe-mobile-container .recipe-section>*:not(.section-title) {
    display: none;
}

#recipe-mobile-container .recipe-section.active>*:not(.section-title) {
    display: block;
}

/* Specific layout overrides when active */
#recipe-mobile-container .recipe-section.active .ingredients-grid {
    display: grid;
}

#recipe-mobile-container .recipe-section.active .recipe-list {
    display: block;
}

#recipe-mobile-container .recipe-section.active .recipe-steps {
    display: block;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    text-align: left;
}

#recipe-mobile-container .recipe-section.active .chef-note {
    display: block;
}

#recipe-mobile-container .recipe-section.active .curiosita {
    display: block;
}

/* Keep chef disclaimers bound to accordion visibility even with flex !important in chef_tip.css */
#recipe-mobile-container .recipe-section>.chef-disclaimer {
    display: none !important;
}

#recipe-mobile-container .recipe-section.active>.chef-disclaimer {
    display: flex !important;
}

#recipe-mobile-container .recipe-section:last-child {
    border-bottom: none;
}

#recipe-mobile-container .section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    /* mobile override */
    font-weight: 600;
    margin-bottom: 1rem;
    /* mobile override */
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: #3b2a1f;
    position: relative;
}

#recipe-mobile-container .section-title i {
    font-size: 1.4rem;
    color: #e7843a;
}

#recipe-mobile-container .section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 55px;
    height: 3px;
    background: linear-gradient(90deg, #f3b26b, #f7d5a3);
    border-radius: 4px;
}

/* =============================================================================
   INGREDIENTS GRID — single column on mobile
   ============================================================================= */

#recipe-mobile-container .ingredients-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* mobile override from 3 cols */
    gap: 0;
    /* mobile override */
    list-style: none;
}

#recipe-mobile-container .ingredients-grid li {
    padding: 0.6rem 0;
    border-bottom: 1px dashed #f0e2d0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
}

#recipe-mobile-container .ingredients-grid li i {
    color: #e7843a;
    width: 1.4rem;
    flex-shrink: 0;
}

/* =============================================================================
   RECIPE LIST (utensils, notes)
   ============================================================================= */

#recipe-mobile-container .recipe-list {
    list-style: none;
}

#recipe-mobile-container .recipe-list li {
    padding: 0.6rem 0;
    border-bottom: 1px dashed #f0e2d0;
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    font-size: 0.95rem;
}

#recipe-mobile-container .recipe-list li:last-child {
    border-bottom: none;
}

#recipe-mobile-container .recipe-list li i {
    color: #e7843a;
    width: 1.5rem;
    text-align: center;
}

/* =============================================================================
   PREPARATION STEPS
   ============================================================================= */

#recipe-mobile-container .recipe-steps {
    list-style: none;
    counter-reset: step-counter;
}

#recipe-mobile-container .recipe-steps li {
    counter-increment: step-counter;
    margin-bottom: 1.5rem;
    /* mobile override */
    position: relative;
    padding-left: 2.6rem;
    /* mobile override */
}

#recipe-mobile-container .recipe-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    background: linear-gradient(145deg, #ffe1be, #ffd7ac);
    width: 32px;
    /* mobile override */
    height: 32px;
    /* mobile override */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30px;
    color: #a3511c;
    font-size: 1rem;
    /* mobile override */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#recipe-mobile-container .recipe-steps li::after {
    content: "";
    display: table;
    clear: both;
}

#recipe-mobile-container .step-text {
    line-height: 1.6;
    color: #3d3224;
}

/* =============================================================================
   STEP IMAGES — all float cleared on mobile
   ============================================================================= */

#recipe-mobile-container .step-image {
    margin: 1rem 0;
}

#recipe-mobile-container .step-image img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

#recipe-mobile-container .step-image-left,
#recipe-mobile-container .step-image-right {
    float: none;
    /* mobile override */
    margin: 1rem 0;
    max-width: 100%;
    width: 100% !important;
}

#recipe-mobile-container .step-image-center {
    text-align: center;
}

#recipe-mobile-container .step-image-full {
    text-align: center;
}

#recipe-mobile-container .step-image-full img {
    width: 100%;
    max-height: 350px;
    object-fit: cover;
}

/* =============================================================================
   AD SLOTS
   ============================================================================= */

#recipe-mobile-container .ad-slot {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    /* mobile override */
    text-align: center;
    /* mobile override */
    gap: 0.8rem;
    /* mobile override */
    align-items: center;
    background: linear-gradient(135deg, #fff7f0, #fff3e8);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid #f0dcbf;
}

#recipe-mobile-container .ad-slot img {
    border-radius: 0.8rem;
    flex-shrink: 0;
    max-width: 100px;
}

#recipe-mobile-container .ad-content {
    flex: 1;
}

#recipe-mobile-container .ad-link {
    display: inline-block;
    background: #e7a15e;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.85rem;
}

#recipe-mobile-container .ad-space-top,
#recipe-mobile-container .ad-space-middle,
#recipe-mobile-container .ad-space-bottom {
    display: none;
    background: rgba(231, 166, 94, 0.08);
    border-radius: 0.8rem;
    padding: 0.8rem;
    text-align: center;
    margin: 0.5rem 1rem;
    /* mobile override */
    font-size: 0.7rem;
    color: #b78f64;
    border: 1px dashed #e7c8a8;
}

#recipe-mobile-container .ad-space-top:not(:empty),
#recipe-mobile-container .ad-space-middle:not(:empty),
#recipe-mobile-container .ad-space-bottom:not(:empty) {
    display: block;
}

/* =============================================================================
   CHEF NOTE
   ============================================================================= */

#recipe-mobile-container .chef-note {
    background: linear-gradient(135deg, #fef8f0, #fef5ea);
    padding: 1.3rem 1.8rem;
    border-radius: 1.2rem;
    border-left: 5px solid #f1ac6b;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

#recipe-mobile-container footer {
    text-align: center;
    padding: 1.3rem;
    font-size: 0.7rem;
    color: #bfa27b;
    background: #fffaf2;
    border-top: 1px solid #f5e6d6;
}

/* =============================================================================
   HOME BUTTON — hidden in SPA context (uses window.goHome() which is absent)
   ============================================================================= */

#recipe-mobile-container .home-button {
    display: none;
}

/* =============================================================================
   MOBILE BACK TO TOP BUTTON
   ============================================================================= */
#mobile-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background-color: #e7843a;
    /* Match standard theme color */
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: none;
    /* Crucial: controlled dynamically by recipe_manager.js */
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    /* Stay on top of injected recipe components */
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    /* Clean mobile tap override */
}

/* Smooth pop effect when pressed on mobile viewports */
#mobile-back-to-top:active {
    background-color: #c96b27;
    transform: scale(0.95);
}

/* Ensure the Font Awesome icon inside centers perfectly */
#mobile-back-to-top i {
    display: inline-block;
    transform: translateY(-1px);
    /* Optical centering adjustment */
}