/* Pizza Planner - Styles */

/* Base Design System & CSS Variables */
:root {
    /* Light Theme (Warm Italian Menu Style) */
    --bg-primary: #faf7f2;      /* Warm garlic cream */
    --bg-secondary: #ffffff;    /* White cards */
    --bg-tertiary: #f3ede2;     /* Darker cream for inputs */
    --text-primary: #242120;    /* Charcoal text */
    --text-secondary: #635c57;  /* Muted warm grey */
    --border-color: #e3d9c8;    /* Soft beige border */
    
    /* Accents */
    --accent-red: #b72f20;      /* Rich tomato red */
    --accent-red-hover: #9e2417;
    --accent-green: #2e6b43;    /* Basil green */
    --accent-green-hover: #225232;
    --accent-gold: #d99126;     /* Golden crust */
    --accent-gold-light: #fef4e8;
    
    /* Shadows & Transitions */
    --shadow-sm: 0 2px 4px rgba(36, 33, 32, 0.05);
    --shadow-md: 0 8px 16px rgba(36, 33, 32, 0.08);
    --shadow-lg: 0 16px 32px rgba(36, 33, 32, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-primary: #181615;      /* Deep dark charcoal */
    --bg-secondary: #221f1e;    /* Warm dark charcoal cards */
    --bg-tertiary: #2e2927;     /* Darker input backgrounds */
    --text-primary: #f5f0eb;    /* Warm white text */
    --text-secondary: #a39991;  /* Soft warm grey */
    --border-color: #38322f;    /* Dark border */
    
    /* Darker accents for better contrast */
    --accent-red: #d94636;
    --accent-red-hover: #b72f20;
    --accent-green: #3b8754;
    --accent-green-hover: #2e6b43;
    --accent-gold: #e5a43b;
    --accent-gold-light: #2c251e;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.4);
}

/* General Resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styling */
.app-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    animation: rotateLogo 20s linear infinite;
}

@keyframes rotateLogo {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.title-group h1 {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-red);
    line-height: 1.2;
}

.title-group .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

/* Main Content Layout */
.main-content {
    padding-top: 32px;
    padding-bottom: 64px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    flex-grow: 1;
}

@media (min-width: 900px) {
    .main-content {
        grid-template-columns: 420px 1fr;
    }
}

/* Cards standard styling */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Input Form Styling */
.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    color: var(--accent-red);
    margin-bottom: 20px;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Counter Input (+ / - Buttons) */
.counter-input {
    display: flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 42px;
}

.counter-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: bold;
    width: 42px;
    height: 100%;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.counter-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .counter-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.counter-input input {
    flex-grow: 1;
    width: 40px;
    border: none;
    background: none;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    -moz-appearance: textfield;
}

.counter-input input::-webkit-outer-spin-button,
.counter-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.suggestion-tag {
    display: inline-block;
    font-size: 11px;
    color: var(--accent-green);
    background-color: rgba(46, 107, 67, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 6px;
    font-weight: 600;
    transition: opacity var(--transition-fast);
}

/* Input Icon Wrapper */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-with-icon input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    height: 42px;
    outline: none;
    transition: all var(--transition-fast);
}

.input-with-icon input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(183, 47, 32, 0.15);
}

/* Range Inputs */
.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-with-value label {
    margin-bottom: 0;
}

.value-display {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-red);
    background-color: rgba(183, 47, 32, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
}

.range-container input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
}

.range-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-red);
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease;
}

.range-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Select wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 10px;
    color: var(--text-secondary);
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.select-wrapper select {
    width: 100%;
    padding: 10px 30px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    height: 42px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.select-wrapper select:focus {
    border-color: var(--accent-red);
}

.help-text {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Buttons and Actions */
.favorite-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    outline: none;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-green);
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: var(--accent-green-hover);
    box-shadow: 0 4px 12px rgba(46, 107, 67, 0.2);
}

.btn-secondary {
    background-color: var(--accent-red);
    color: white;
    border: none;
}

.btn-secondary:hover {
    background-color: var(--accent-red-hover);
    box-shadow: 0 4px 12px rgba(183, 47, 32, 0.2);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--accent-red);
}

.btn-block {
    width: 100%;
}

/* Results Column Layout */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Dough Summary Card */
.dough-summary {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-left: 5px solid var(--accent-red);
}

.dough-summary-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.summary-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.summary-value {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-red);
}

.pizza-badge {
    background-color: var(--accent-gold-light);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 16px;
}

/* Dough Balls Visualizer Grid */
.dough-visualizer-container {
    border-top: 1px dashed var(--border-color);
    padding-top: 16px;
}

.visualizer-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.dough-balls-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 50px;
    align-items: center;
}

/* Dough ball component styling with CSS gradient & shadows */
.dough-ball {
    width: 50px;
    height: 44px;
    background: radial-gradient(circle at 35% 35%, #f7f2e6, #ded7c6);
    border-radius: 50% 50% 46% 46%;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08), inset 0 -3px 6px rgba(0, 0, 0, 0.12);
    animation: floatDough 3.5s ease-in-out infinite alternate;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    cursor: default;
}

[data-theme="dark"] .dough-ball {
    background: radial-gradient(circle at 35% 35%, #e0d7c3, #a19a89);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 -3px 6px rgba(0, 0, 0, 0.25);
}

.dough-ball:nth-child(even) {
    animation-delay: 0.6s;
    animation-duration: 4s;
}

.dough-ball:nth-child(3n) {
    animation-delay: 1.2s;
    animation-duration: 3s;
}

.dough-ball::after {
    content: "🍕";
    font-size: 10px;
    position: absolute;
    bottom: 2px;
    right: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dough-ball:hover {
    transform: translateY(-8px) scale(1.1);
}

.dough-ball:hover::after {
    opacity: 0.8;
}

@keyframes floatDough {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-5px) rotate(3deg); }
}

/* Recipe Cards Grid (Output layouts) */
.recipe-cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1000px) {
    .recipe-cards-container {
        grid-template-columns: 1fr 1fr;
    }
    .recipe-cards-container > #printSectionTimeline {
        grid-column: span 2;
    }
}

.recipe-card {
    display: flex;
    flex-direction: column;
}

.card-header {
    margin-bottom: 16px;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-title-group h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
}

.card-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: white;
}

.bg-red { background-color: var(--accent-red); }
.bg-green { background-color: var(--accent-green); }
.bg-gold { background-color: var(--accent-gold); }

.card-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 48px;
    display: block;
}

.card-body {
    flex-grow: 1;
}

/* Ingredients List */
.ingredient-list {
    list-style: none;
}

.ingredient-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.ingredient-list li:last-child {
    border-bottom: none;
}

.ingredient-name {
    font-size: 14px;
    font-weight: 500;
}

.ingredient-qty {
    font-family: monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-red);
}

.ingredient-name-group {
    display: flex;
    flex-direction: column;
}

.ingredient-subtext {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.alternative-yeast {
    background-color: var(--bg-tertiary);
    padding: 8px 12px !important;
    border-radius: var(--radius-sm);
    margin-top: 4px;
    border-bottom: none !important;
}

.alternative-yeast .ingredient-qty {
    color: var(--text-secondary);
}

/* Interactive Timeline Checklist */
.timeline {
    position: relative;
    padding-left: 20px;
    margin-left: 10px;
    border-left: 2px dashed var(--border-color);
}

.timeline-step {
    position: relative;
    display: flex;
    align-items: flex-start;
    padding-bottom: 24px;
    cursor: pointer;
}

.timeline-step:last-child {
    padding-bottom: 0;
}

/* Invisible default input, overlaying a custom checkbox */
.timeline-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.timeline-text {
    display: flex;
    flex-direction: column;
    margin-left: 16px;
    transition: opacity var(--transition-fast);
}

.timeline-time {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 4px;
}

.timeline-desc {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Custom indicator (dot / check) */
.timeline-step::before {
    content: "";
    position: absolute;
    left: -28px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
    z-index: 1;
}

/* Connect line indicator */
.timeline-step:hover::before {
    border-color: var(--accent-green);
    transform: scale(1.1);
}

/* Active / Checked states */
.timeline-checkbox:checked ~ .timeline-text {
    opacity: 0.5;
}

.timeline-checkbox:checked ~ .timeline-text .timeline-desc {
    text-decoration: line-through;
}

.timeline-checkbox:checked ~ .timeline-text .timeline-time {
    color: var(--text-secondary);
}

.timeline-checkbox:checked + .timeline-text::before {
    background-color: var(--accent-green);
}

/* Using a class for checklist completion triggers since ::before doesn't support sibling selector backwards */
.timeline-step.checked::before {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Shopping List */
.shopping-list {
    list-style: none;
    margin-bottom: 20px;
}

.shopping-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.shopping-item:last-child {
    border-bottom: none;
}

.shopping-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-green);
    cursor: pointer;
}

.shopping-item-text {
    font-size: 14px;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.shopping-item.checked .shopping-item-text {
    text-decoration: line-through;
    opacity: 0.5;
}

.shopping-actions {
    margin-top: 16px;
}

/* Footer style */
.app-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: auto;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.app-footer p {
    margin-bottom: 8px;
}

.footer-hint {
    opacity: 0.7;
}

/* Print Stylesheet (isolated inside styles.css) */
@media print {
    /* Hide everything that is NOT the recipe */
    body {
        background-color: white !important;
        color: black !important;
        font-size: 12px !important;
    }
    
    .app-header,
    .form-section,
    .favorite-actions,
    .dough-visualizer-container,
    .pizza-badge,
    .shopping-actions,
    .btn-icon,
    #themeToggle,
    .app-footer {
        display: none !important;
    }
    
    .main-content {
        display: block !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .results-section {
        display: block !important;
        width: 100% !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        background-color: white !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
        padding: 15px !important;
        border-radius: 0 !important;
    }
    
    .dough-summary {
        border-left: 5px solid #000 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .summary-value {
        color: black !important;
        font-size: 26px !important;
    }
    
    .card-icon-wrapper {
        display: none !important;
    }
    
    .card-subtitle {
        margin-left: 0 !important;
    }
    
    .ingredient-qty {
        color: black !important;
    }
    
    .timeline {
        border-left: 1px solid #000 !important;
    }
    
    .timeline-checkbox {
        display: none !important;
    }
    
    .timeline-step::before {
        border: 1px solid #000 !important;
        background-color: white !important;
    }
    
    .shopping-item input[type="checkbox"] {
        border: 1px solid #000 !important;
    }
    
    .recipe-cards-container {
        display: block !important;
    }
}
