/* ============================================================
   BabyBite Smart Planner — Feature CSS
   Mobile-first, BabyBite brand palette
   ============================================================ */

/* ---- Layout Overrides ---- */
.container.main-container {
    max-width: 680px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}
.container.main-container.wide {
    max-width: 1200px;
}

/* ---- Step Progress Indicator ---- */
.sp-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 36px;
    padding: 0 8px;
}
.sp-step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}
.sp-step-dot .dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E8E6F0;
    color: #8E8A9E;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}
.sp-step-dot.active .dot {
    background: #343275;
    color: white;
    box-shadow: 0 4px 12px rgba(52,50,117,0.3);
    transform: scale(1.1);
}
.sp-step-dot.done .dot {
    background: #22c55e;
    color: white;
    border-color: #16a34a;
}
.sp-step-dot .label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #8E8A9E;
    text-align: center;
    white-space: nowrap;
    font-family: 'Nunito', sans-serif;
}
.sp-step-dot.active .label { color: #343275; }
.sp-step-dot.done .label  { color: #16a34a; }
.sp-connector {
    flex: 1;
    height: 2px;
    background: #E8E6F0;
    max-width: 40px;
    margin-bottom: 22px;
    transition: background 0.3s;
}
.sp-connector.done { background: #22c55e; }

/* ---- Step Panels ---- */
.sp-step-panel { display: none; }
.sp-step-panel.active { display: block; animation: spFadeIn 0.3s ease; }
@keyframes spFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Mode Cards (Step 1) ---- */
.sp-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}
@media (max-width: 500px) { .sp-mode-grid { grid-template-columns: 1fr; } }
.sp-mode-card {
    border: 2px solid #E8E6F0;
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}
.sp-mode-card:hover {
    border-color: #343275;
    box-shadow: 0 8px 24px rgba(52,50,117,0.1);
    transform: translateY(-2px);
}
.sp-mode-card.selected {
    border-color: #343275;
    background: #f0effc;
    box-shadow: 0 8px 24px rgba(52,50,117,0.15);
}
.sp-mode-card .mode-icon { font-size: 2.5rem; margin-bottom: 12px; }
.sp-mode-card h3 {
    font-size: 1rem;
    color: #343275;
    margin-bottom: 6px;
    font-family: 'Nunito', sans-serif;
}
.sp-mode-card p { font-size: 0.82rem; color: #8E8A9E; line-height: 1.4; }

/* ---- Upload Zone (Step 2) ---- */
.sp-upload-zone {
    border: 2px dashed #B86DCD;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fcf5ff;
    position: relative;
}
.sp-upload-zone:hover,
.sp-upload-zone.drag-over {
    border-color: #343275;
    background: #f0effc;
    box-shadow: 0 8px 24px rgba(52,50,117,0.08);
}
.sp-upload-zone .upload-icon { font-size: 3rem; margin-bottom: 12px; }
.sp-upload-zone h3 { font-size: 1.1rem; color: #343275; margin-bottom: 6px; }
.sp-upload-zone p  { font-size: 0.85rem; color: #8E8A9E; }
.sp-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    min-height: unset;
}
.sp-image-preview {
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 200px;
    display: none;
}
.sp-image-preview img { width: 100%; object-fit: cover; border-radius: 12px; }

/* Input method tabs */
.sp-input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #E8E6F0;
    padding-bottom: 0;
}
.sp-tab-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #8E8A9E;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: 'Nunito', sans-serif;
    box-shadow: none;
    border-radius: 0;
    transition: all 0.2s;
    min-height: unset;
}
.sp-tab-btn:hover { color: #343275; background: none; transform: none; }
.sp-tab-btn.active {
    color: #343275;
    border-bottom-color: #343275;
    background: none;
    transform: none;
    box-shadow: none;
}
.sp-tab-panel { display: none; }
.sp-tab-panel.active { display: block; animation: spFadeIn 0.25s ease; }

/* ---- Day Toggle Buttons ---- */
.sp-day-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.sp-day-btn {
    background: #F0EEFA;
    color: #343275;
    border: 2px solid transparent;
    border-radius: 50px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s ease;
    box-shadow: none;
    min-height: unset;
}
.sp-day-btn:hover  { background: #e0ddff; transform: none; }
.sp-day-btn.active {
    background: #343275;
    color: white;
    border-color: #343275;
    box-shadow: 0 3px 8px rgba(52,50,117,0.3);
    transform: none;
}

/* ---- Monthly Week Tabs ---- */
.sp-week-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sp-week-tabs::-webkit-scrollbar { display: none; }
.sp-week-tab-btn {
    flex: 0 0 auto;
    background: #FDFBFF;
    border: 1px solid #D6D2FA;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    color: #343275;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.3;
}
.sp-week-tab-btn:hover { background: #F0EDFD; }
.sp-week-tab-btn.active {
    background: #343275;
    color: white;
    border-color: #343275;
}
.sp-week-tab-btn.active span { color: rgba(255,255,255,0.8) !important; }

/* ---- Step 3 Profile Options ---- */
.sp-meal-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.sp-meal-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #E8E6F0;
    border-radius: 50px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #343275;
    transition: all 0.15s;
    font-family: 'Nunito', sans-serif;
}
.sp-meal-check-label:hover { background: #f0effc; }
.sp-meal-check-label input[type="checkbox"] {
    width: 16px; height: 16px; min-height: unset;
    accent-color: #343275;
}

/* ---- Body Scroll Lock During Loading ---- */
body.sp-loading-lock {
    overflow: hidden !important;
    touch-action: none;
}

/* ---- Loading State ---- */
.sp-loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
    min-height: 55vh;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
}
.sp-loading .sp-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid #E8E6F0;
    border-top-color: #343275;
    border-radius: 50%;
    animation: spSpin 0.8s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spSpin { to { transform: rotate(360deg); } }
.sp-loading h3 { color: #343275; font-size: 1.2rem; margin-bottom: 8px; }
.sp-loading p  { color: #8E8A9E; font-size: 0.9rem; }


/* ---- Brand-Aligned Premium Loader Styles ---- */
.sp-loader-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-loader-pot {
    font-size: 3.5rem;
    animation: spLoaderPotPulse 1.8s ease-in-out infinite alternate;
}
@keyframes spLoaderPotPulse {
    0% { transform: scale(0.95) rotate(-3deg); }
    100% { transform: scale(1.05) rotate(3deg); }
}
.sp-loader-floating-emoji {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0;
    bottom: 20px;
    animation: spLoaderFloat 3s infinite linear;
}
.sp-loader-floating-emoji.emoji-1 { left: 10px; animation-delay: 0s; }
.sp-loader-floating-emoji.emoji-2 { left: 30px; animation-delay: 0.6s; }
.sp-loader-floating-emoji.emoji-3 { right: 30px; animation-delay: 1.2s; }
.sp-loader-floating-emoji.emoji-4 { right: 10px; animation-delay: 1.8s; }
.sp-loader-floating-emoji.emoji-5 { left: 45px; animation-delay: 2.4s; }

@keyframes spLoaderFloat {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    30% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-80px) scale(1.1);
        opacity: 0;
    }
}

/* Premium Skeleton Layout */
.sp-loader-skeleton-grid {
    display: flex;
    justify-content: center;
    gap: 16px;
    width: 100%;
    margin-top: 15px;
}
.sp-loader-skeleton-card {
    flex: 1;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.7);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.01);
}
@media (max-width: 600px) {
    .sp-loader-skeleton-grid {
        flex-direction: column;
    }
    .sp-loader-skeleton-card.text-only {
        display: none;
    }
}
.skeleton-header {
    height: 18px;
    border-radius: 4px;
    width: 60%;
    background: #F1F5F9;
    margin-bottom: 8px;
}
.skeleton-meal {
    height: 38px;
    border-radius: 8px;
    background: #F8FAFC;
    width: 100%;
}
.shimmer {
    background: linear-gradient(
        90deg,
        #F1F5F9 25%,
        #E2E8F0 50%,
        #F1F5F9 75%
    );
    background-size: 200% 100%;
    animation: spShimmerAnimation 1.5s infinite linear;
}
@keyframes spShimmerAnimation {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Extraction Preview (Step 4) ---- */
.sp-preview-grid {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}
.sp-preview-day {
    border: 1px solid #E8E6F0;
    border-radius: 12px;
    overflow: hidden;
}
.sp-preview-day-header {
    background: #343275;
    color: white;
    padding: 10px 16px;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-preview-meal-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #F1F0F8;
    gap: 12px;
}
.sp-preview-meal-row:last-child { border-bottom: none; }
.sp-meal-type-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 50px;
    white-space: nowrap;
    font-family: 'Nunito', sans-serif;
}
.badge-breakfast    { background: #FEF3C7; color: #92400E; }
.badge-lunch        { background: #DCFCE7; color: #15803D; }
.badge-morning_snack,
.badge-afternoon_snack { background: #E0F2FE; color: #0369A1; }
.badge-dinner       { background: #EDE9FE; color: #5B21B6; }
.badge-bedtime_snack { background: #FCE7F3; color: #9D174D; }

.sp-preview-meal-text {
    flex: 1;
    font-size: 0.9rem;
    color: #343275;
    font-weight: 500;
    outline: none;
    border: none;
    background: transparent;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
    min-height: unset;
    font-family: inherit;
}
.sp-preview-meal-text:focus {
    background: #f0effc;
    box-shadow: none;
}

/* ---- Weekly Planner Output ---- */
.sp-week-summary {
    background: linear-gradient(135deg, #343275 0%, #0E73ED 100%);
    color: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.sp-week-summary::before {
    content: '🌟';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.2;
}
.sp-week-summary h3 { color: white; margin-bottom: 4px; font-size: 1rem; }
.sp-week-summary p  { color: rgba(255,255,255,0.85); font-size: 0.9rem; margin: 0; }
.sp-nutrition-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(255,255,255,0.15);
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 10px;
}
.score-item {
    font-size: 0.85rem;
    color: white;
}

/* Desktop: 7-col grid */
.sp-planner-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
@media (max-width: 900px) { .sp-planner-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .sp-planner-grid { grid-template-columns: 1fr; } }

.sp-day-column {
    background: white;
    border: 1px solid #E8E6F0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(52,50,117,0.06);
    display: flex;
    flex-direction: column;
}
.sp-day-column.weekend {
    background: #FDFBFF;
    border-color: #D6D2FA;
}
.sp-day-col-header {
    background: #343275;
    color: white;
    text-align: center;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.sp-day-col-header .day-name {
    font-weight: 800;
    font-size: 0.95rem;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sp-day-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 50px;
    white-space: nowrap;
}
.sp-day-badge.fully-planned { background: #15803D; color: #DCFCE7; }
.sp-day-badge.school-included { background: rgba(255,255,255,0.2); color: white; }

.sp-meal-block {
    padding: 12px 10px;
    border-bottom: 1px solid #F1F0F8;
    flex: 1;
    box-sizing: border-box;
    word-break: break-word;
}
.sp-meal-block:last-child { border-bottom: none; }
.sp-meal-block.daycare-meal {
    background: linear-gradient(135deg, #EEF2FF 0%, #E8EFFF 100%);
    border-left: 4px solid #3B4FD4;
    padding: 0 0 10px 0;
    overflow: hidden;
}
.sp-meal-block.generated-meal {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-left: 4px solid #16a34a;
}

/* School Lunch Banner Header */
.school-meal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(90deg, #3B4FD4, #4F62E0);
    color: white;
    font-size: 0.62rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 5px 10px;
    margin-bottom: 8px;
    font-family: 'Nunito', sans-serif;
}
.school-meal-header .school-icon { font-size: 0.85rem; }
.school-meal-body {
    padding: 0 12px;
}
.school-meal-source {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.62rem;
    color: #4F62E0;
    font-weight: 700;
    font-style: italic;
    font-family: 'Nunito', sans-serif;
}
.sp-meal-block .meal-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8E8A9E;
    margin-bottom: 4px;
    font-family: 'Nunito', sans-serif;
}
.sp-meal-block.daycare-meal .school-meal-body .meal-label  { color: #2D3BAA; }
.sp-meal-block.generated-meal .meal-label { color: #15803D; }
.sp-meal-block .meal-emoji { font-size: 1.3rem; display: block; margin-bottom: 4px; }
.sp-meal-block .meal-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #343275;
    line-height: 1.3;
    margin-bottom: 3px;
    font-family: 'Nunito', sans-serif;
}
.sp-meal-block .meal-desc {
    font-size: 0.72rem;
    color: #8E8A9E;
    line-height: 1.3;
}
.sp-nutrition-note {
    margin: 8px 12px;
    padding: 6px 10px;
    background: #FFFBEB;
    border-left: 3px solid #F59E0B;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #78350F;
    line-height: 1.3;
}

/* Mobile accordion */
@media (max-width: 600px) {
    .sp-day-column { border-radius: 12px; margin-bottom: 10px; }
    .sp-day-col-header { 
        cursor: pointer; 
        display: flex; 
        flex-direction: row;
        justify-content: space-between; 
        align-items: center; 
        text-align: left;
        padding: 16px;
    }
    .sp-day-col-header .day-name { font-size: 1.1rem; }
    .sp-day-col-header::after { content: '▼'; font-size: 0.8rem; opacity: 0.7; margin-left: 10px; }
    .sp-day-col-header.collapsed::after { content: '▶'; }
    .sp-day-col-body { overflow: hidden; }
    .sp-day-col-body.collapsed { display: none; }
}

/* ---- Output Action Buttons ---- */
.sp-output-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.sp-btn-print {
    background: white;
    color: #343275;
    border: 2px solid #343275;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Nunito', sans-serif;
    box-shadow: none;
    transition: all 0.2s;
}
.sp-btn-print:hover { background: #f0effc; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(52,50,117,0.15); }
.sp-btn-generate-new {
    background: white;
    color: #64748B;
    border: 2px solid #E8E6F0;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    box-shadow: none;
    transition: all 0.2s;
}
.sp-btn-generate-new:hover { border-color: #343275; color: #343275; transform: none; background: white; box-shadow: none; }

/* ---- Navigation Buttons ---- */
.sp-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    gap: 12px;
}
.sp-btn-back {
    background: transparent;
    color: #8E8A9E;
    border: 1px solid #E8E6F0;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.sp-btn-back:hover { color: #343275; border-color: #343275; background: transparent; transform: none; box-shadow: none; }
.sp-btn-next {
    background: #343275;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(52,50,117,0.25);
    transition: all 0.2s;
    margin-left: auto;
}
.sp-btn-next:hover { background: #0E2CED; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(52,50,117,0.3); }

/* ---- Legend ---- */
.sp-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.sp-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #64748B;
    font-weight: 600;
}
.sp-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
.sp-legend-dot.daycare  { background: #3B4FD4; }
.sp-legend-dot.generated { background: #16a34a; }

/* ---- Error Banner ---- */
.sp-error {
    display: none;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid #EF4444;
    border-radius: 12px;
    padding: 16px 20px;
    color: #991B1B;
    font-size: 0.9rem;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ---- Page Header ---- */
.sp-page-header {
    text-align: center;
    margin-bottom: 32px;
}
.sp-page-header .sp-badge {
    display: inline-block;
    background: linear-gradient(135deg, #A41CAC, #343275);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 50px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
    font-family: 'Nunito', sans-serif;
}
.sp-page-header h1 { font-size: 1.6rem; margin-bottom: 8px; }
.sp-page-header p  { color: #8E8A9E; font-size: 0.95rem; }

/* By default, isolated print area is hidden */
#sp-isolated-print-area {
    display: none;
}

/* ═══════════════════════════════════════════════════════
   NEW FEATURE STYLES: Saved Plans / Recipe / Grocery
═══════════════════════════════════════════════════════ */

/* ---- New action buttons ---- */
.sp-btn-grocery {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff; border: none; border-radius: 12px;
    padding: 12px 22px; font-size: 0.95rem; font-weight: 700;
    cursor: pointer; font-family: 'Nunito', sans-serif;
    box-shadow: 0 4px 14px rgba(16,185,129,0.3);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sp-btn-grocery:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,185,129,0.4); }

.sp-btn-save {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #6366F1, #4F46E5);
    color: #fff; border: none; border-radius: 12px;
    padding: 12px 22px; font-size: 0.95rem; font-weight: 700;
    cursor: pointer; font-family: 'Nunito', sans-serif;
    box-shadow: 0 4px 14px rgba(99,102,241,0.3);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sp-btn-save:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }

/* ---- "View Recipe" micro-button ---- */
.bb-view-recipe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #343275;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s ease;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
    line-height: 1.2;
}
.bb-view-recipe-btn:hover {
    background: #343275;
    color: #fff;
    border-color: #343275;
}

/* ═══════════════ SAVED PLANS SECTION ═══════════════ */
.bb-saved-plans-section {
    max-width: 960px; margin: 32px auto 0; padding: 0 16px;
}
.bb-saved-plans-header {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; border: 1px solid #E2E8F0; border-radius: 16px;
    padding: 16px 24px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.bb-saved-plans-header:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.bb-saved-plans-title { font-size: 1.1rem; font-weight: 800; color: #343275; font-family: 'Nunito', sans-serif; }
.bb-saved-plans-toggle { font-size: 0.9rem; color: #8E8A9E; transition: transform 0.2s; }

.bb-saved-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px; padding: 20px 0 8px;
}

/* Plan card */
.bb-plan-card {
    background: #fff; border: 1px solid #E2E8F0; border-radius: 16px;
    padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}
.bb-plan-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(52,50,117,0.1); }
.bb-plan-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.bb-plan-card-title { font-size: 1rem; font-weight: 800; color: #1E293B; font-family: 'Nunito', sans-serif; }
.bb-plan-card-sub { font-size: 0.8rem; color: #64748B; margin-top: 2px; }
.bb-plan-card-mode {
    font-size: 0.7rem; font-weight: 700; padding: 4px 10px;
    background: #EEF2FF; color: #4F46E5; border-radius: 20px; white-space: nowrap;
}
.bb-plan-card-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.78rem; color: #94A3B8; margin-bottom: 14px; }
.bb-plan-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bb-btn-card {
    flex: 1; min-width: 80px; padding: 8px 10px;
    font-size: 0.78rem; font-weight: 700; border: none; border-radius: 10px;
    cursor: pointer; font-family: 'Nunito', sans-serif; transition: opacity 0.15s;
}
.bb-btn-open   { background: #343275; color: #fff; }
.bb-btn-print  { background: #F0FDF4; color: #059669; border: 1px solid #A7F3D0; }
.bb-btn-delete { background: #FEF2F2; color: #DC2626; border: 1px solid #FCA5A5; }
.bb-btn-card:hover { opacity: 0.85; }

/* Empty state */
.bb-saved-empty { text-align: center; padding: 40px 20px; color: #94A3B8; }
.bb-saved-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.bb-saved-empty h3 { color: #64748B; font-size: 1rem; margin-bottom: 8px; }
.bb-saved-empty p  { font-size: 0.85rem; }

/* ═══════════════ MODALS (shared) ═══════════════ */
.bb-modal-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(15,23,42,0.65); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    padding: 16px; overflow-y: auto;
}
.bb-modal-panel {
    position: relative; background: #fff; border-radius: 24px;
    width: 100%; max-width: 680px; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    animation: bbModalIn 0.22s ease;
}
@keyframes bbModalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.bb-modal-close {
    position: sticky; top: 12px; float: right; margin: 12px 12px 0 0;
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: #F1F5F9; color: #64748B; font-size: 1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    z-index: 10; transition: background 0.15s;
}
.bb-modal-close:hover { background: #E2E8F0; color: #1E293B; }
.bb-modal-body { padding: 20px 24px 28px; }

/* ═══════════════ RECIPE MODAL ═══════════════ */
.bb-recipe-loading, .bb-recipe-error {
    text-align: center; padding: 48px 20px; color: #64748B;
}
.bb-recipe-loader-pot { font-size: 3rem; animation: spLoaderPotPulse 1.4s ease-in-out infinite alternate; margin-bottom: 12px; }
.bb-recipe-hero { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.bb-recipe-emoji { font-size: 4rem; flex-shrink: 0; }
.bb-recipe-title { font-size: 1.4rem; font-weight: 800; color: #1E293B; font-family: 'Nunito', sans-serif; margin-bottom: 8px; }
.bb-recipe-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bb-tag {
    font-size: 0.75rem; font-weight: 700; padding: 4px 10px;
    background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 20px; color: #475569;
}
.bb-recipe-nutrition { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bb-nutrition-pill {
    font-size: 0.72rem; font-weight: 700; padding: 3px 10px;
    background: #F0FDF4; color: #059669; border-radius: 20px;
}
.bb-recipe-allergens {
    font-size: 0.78rem; font-weight: 600; color: #B45309;
    background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 8px;
    padding: 6px 12px; margin-top: 4px;
}
.bb-recipe-section { margin-bottom: 20px; }
.bb-recipe-section h3 { font-size: 1rem; font-weight: 800; color: #343275; margin-bottom: 10px; font-family: 'Nunito', sans-serif; }
.bb-recipe-ingredients { padding-left: 18px; margin: 0; }
.bb-recipe-ingredients li { font-size: 0.9rem; color: #334155; margin-bottom: 5px; line-height: 1.4; }
.bb-recipe-note { color: #94A3B8; font-size: 0.8rem; }
.bb-recipe-steps { display: flex; flex-direction: column; gap: 10px; }
.bb-recipe-step { display: flex; gap: 12px; align-items: flex-start; }
.bb-step-num {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
    background: #343275; color: #fff; font-size: 0.75rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center; font-family: 'Nunito', sans-serif;
}
.bb-recipe-tip { font-size: 0.9rem; color: #475569; line-height: 1.5; background: #F8FAFC; border-radius: 10px; padding: 10px 14px; }

/* ═══════════════ GROCERY MODAL ═══════════════ */
.bb-grocery-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.bb-grocery-title { font-size: 1.4rem; font-weight: 800; color: #1E293B; font-family: 'Nunito', sans-serif; margin-bottom: 4px; }
.bb-grocery-sub { font-size: 0.85rem; color: #64748B; margin-bottom: 4px; }
.bb-grocery-summary { font-size: 0.85rem; color: #475569; font-style: italic; }
.bb-grocery-header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.bb-grocery-categories { display: flex; flex-direction: column; gap: 16px; }
.bb-grocery-category { border: 1px solid #E2E8F0; border-radius: 12px; overflow: hidden; }
.bb-grocery-cat-header {
    background: #F8FAFC; padding: 10px 16px;
    font-size: 0.85rem; font-weight: 800; color: #343275; font-family: 'Nunito', sans-serif;
    border-bottom: 1px solid #E2E8F0;
}
.bb-grocery-items { padding: 8px 16px; display: flex; flex-direction: column; gap: 4px; }
.bb-grocery-item {
    display: flex; align-items: center; gap: 10px; padding: 6px 4px;
    border-radius: 8px; cursor: pointer; transition: background 0.12s;
}
.bb-grocery-item:hover { background: #F1F5F9; }
.bb-grocery-check { width: 16px; height: 16px; accent-color: #343275; flex-shrink: 0; cursor: pointer; }
.bb-grocery-name { flex: 1; font-size: 0.88rem; color: #1E293B; }
.bb-grocery-amount { font-size: 0.78rem; font-weight: 700; color: #6366F1; min-width: 50px; text-align: right; }
.bb-grocery-note { font-size: 0.72rem; color: #94A3B8; }
.bb-grocery-item input:checked + .bb-grocery-name { text-decoration: line-through; color: #94A3B8; }
.bb-grocery-note-box {
    margin-top: 16px; padding: 10px 14px;
    background: #EFF6FF; border-radius: 10px; font-size: 0.8rem; color: #1D4ED8;
}

/* ═══════════════ Print — hide new modal UI ═══════════════ */

/* ---- Print Styles ---- */

@media print {
    @page { 
        size: A4 landscape; 
        margin: 8mm; 
    }
    
    * {
        box-sizing: border-box !important;
    }
    
    html, body {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Completely hide every element on the page except the isolated printable container */
    body > :not(#sp-isolated-print-area) {
        display: none !important;
    }

    #sp-isolated-print-area {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
    }
    
    #sp-isolated-print-area * {
        visibility: visible !important;
    }

    /* Separate Print Grid: strictly 7 columns spanning full width */
    .sp-planner-grid {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        gap: 4px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* Column Card Styling */
    .sp-day-column {
        border: 1px solid #CBD5E1 !important;
        border-radius: 6px !important;
        padding: 4px !important;
        background: #ffffff !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: visible !important;
        height: auto !important;
        min-height: 0 !important;
        box-shadow: none !important;
        min-width: 0 !important; /* Critical: remove all min-width constraints */
        max-width: 100% !important;
    }

    .sp-day-column.weekend {
        background: #F8FAFC !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sp-day-col-header {
        border-bottom: 2px solid #E2E8F0 !important;
        padding-bottom: 2px !important;
        margin-bottom: 4px !important;
        text-align: center !important;
        background: transparent !important;
    }

    .sp-day-col-header .day-name {
        color: #343275 !important;
        font-weight: 700 !important;
        font-size: 0.72rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .sp-day-badge {
        display: none !important;
    }

    /* Meal Blocks inside columns */
    .sp-meal-block {
        margin-bottom: 3px !important;
        padding: 3px 4px !important;
        border-radius: 4px !important;
        border: 1px solid #E2E8F0 !important;
        background: #F8FAFC !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        font-size: 0.65rem !important;
        line-height: 1.1 !important;
        min-height: 0 !important;
    }

    .sp-meal-block.daycare-meal {
        background: #EFF6FF !important;
        border-left: 4px solid #3B4FD4 !important;
        padding: 0 0 3px 0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .school-meal-header {
        background: #3B4FD4 !important;
        color: white !important;
        font-size: 0.52rem !important;
        padding: 2px 5px !important;
        margin-bottom: 3px !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .school-meal-body {
        padding: 0 4px !important;
    }

    .school-meal-source {
        display: none !important;
    }

    .sp-meal-block.generated-meal {
        background: #F0FDF4 !important;
        border-left: 3px solid #10B981 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .meal-label {
        font-weight: 700 !important;
        font-size: 0.55rem !important;
        color: #475569 !important;
        margin-bottom: 0px !important;
        text-transform: uppercase !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .meal-emoji {
        font-size: 0.7rem !important;
        margin-right: 2px !important;
    }

    .meal-name {
        font-weight: 700 !important;
        color: #0F172A !important;
        font-size: 0.65rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .meal-desc {
        font-size: 0.58rem !important;
        color: #475569 !important;
        margin-top: 1px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .sp-week-summary {
        background: #343275 !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 6px 10px !important;
        border-radius: 8px !important;
        margin-bottom: 8px !important;
    }
    
    .sp-week-summary h3 {
        color: #ffffff !important;
        margin-top: 0 !important;
        margin-bottom: 1px !important;
        font-size: 0.85rem !important;
    }
    
    .sp-week-summary div {
        color: rgba(255,255,255,0.9) !important;
        font-size: 0.72rem !important;
        line-height: 1.2 !important;
    }
}

/* ═══════════════ MODAL BUTTONS BRAND REDESIGN ═══════════════ */
.sp-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.sp-modal-actions .sp-btn-primary,
.sp-confirm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    background: var(--color-primary, #343275);
    color: #ffffff !important;
    font-family: var(--font-display, 'Nunito', sans-serif);
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(52, 50, 117, 0.25);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 46px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

.sp-modal-actions .sp-btn-primary:hover,
.sp-confirm-btn:hover {
    background: #282660 !important;
    box-shadow: 0 6px 18px rgba(52, 50, 117, 0.35);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.sp-modal-actions .sp-btn-primary:active,
.sp-confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(52, 50, 117, 0.2);
}

.sp-modal-actions .sp-btn-back,
.sp-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    background: var(--color-bg-soft, #f8fafc);
    color: var(--color-text-secondary, #64748b) !important;
    border: 1.5px solid #cbd5e1;
    border-radius: 50px;
    font-family: var(--font-display, 'Nunito', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    min-height: 46px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

.sp-modal-actions .sp-btn-back:hover,
.sp-cancel-btn:hover {
    background: #f1f5f9 !important;
    color: var(--color-primary, #343275) !important;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.sp-modal-actions .sp-btn-back:active,
.sp-cancel-btn:active {
    transform: translateY(0);
}

.sp-btn-secondary-blue {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    background: #EFF6FF;
    color: #1E40AF !important;
    border: 1.5px solid #BFDBFE;
    border-radius: 50px;
    font-family: var(--font-display, 'Nunito', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    min-height: 46px;
    text-decoration: none;
}

.sp-btn-secondary-blue:hover {
    background: #DBEAFE !important;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .sp-modal-actions {
        flex-direction: column-reverse;
        width: 100%;
    }
    .sp-modal-actions button,
    .sp-modal-actions a {
        width: 100%;
    }
}

/* Empty Week Container & Magic Generate Week Button */
.sp-empty-week {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 24px;
    background: #ffffff;
    border-radius: 24px;
    border: 2px dashed #E2E8F0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
}

.sp-empty-week .sp-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.sp-empty-week h3 {
    font-size: 1.4rem;
    font-family: var(--font-display, 'Nunito', sans-serif);
    font-weight: 700;
    color: var(--color-primary, #343275);
    margin-bottom: 10px;
}

.sp-empty-week p {
    margin: 0 auto 24px;
    color: #64748B;
    max-width: 440px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.sp-btn-magic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--color-primary, #343275);
    color: #ffffff !important;
    font-family: var(--font-display, 'Nunito', sans-serif);
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(52, 50, 117, 0.3);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 50px;
    min-width: 220px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

.sp-btn-magic:hover:not(:disabled) {
    background: #282660 !important;
    box-shadow: 0 8px 24px rgba(52, 50, 117, 0.4);
    transform: translateY(-2px);
    color: #ffffff !important;
}

.sp-btn-magic:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(52, 50, 117, 0.2);
}

.sp-btn-magic:disabled {
    opacity: 0.7;
    cursor: wait;
}
