:root {
    --main-color: #734a2f;
    --bg-color: #FFFFFF;
    --accent-color: #28527a;
    --text-color: #734A2F;
}

.pizza-calculator {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}
/* Контейнер для векторної картинки продукту та підпису */
.pizza {
    display: flex;
    flex-direction: column; /* Картинка та підпис будуть один під одним */
    align-items: center;    /* Центрування вмісту по горизонталі */
    justify-content: center;
    width: 100%;            
    padding: 10px;          
    box-sizing: border-box;
}

.calculator-inputs, .calculator-results {
    flex: 1 1 300px;
	
}

.calculator-inputs label {
    display: block;
    margin: 1rem 0 0.5rem 0;
    font-size: 16px !important;
    font-weight: 500;
}

input:not([type="checkbox"]), select {
    width: 90%;
    box-sizing: border-box;
    border: 1px solid #d0c9c0 !important;
    border-radius: 6px !important;
    background: #fffdf9 !important;
    transition: 0.3s;
    height: 48px !important; 
    padding: 10px 15px;
    font-size: 16px !important;  
}

input:not([type="checkbox"]):focus, select:focus {
    outline: none;
    border: 1px solid #734A2F !important;
    box-shadow: 0 0 0 2px rgba(197, 157, 95, 0.2);
}

.calculator-results {
    background-color: #fffdf9;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    margin-top: 25px;
	border: 1px solid #e0dcd7; 
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 15px 15px 0 0;
    table-layout: fixed !important; 
}

.calculator-results th, .calculator-results td {
    padding: 0.75rem;
    border: 1px solid #e0dcd7;
    vertical-align: middle;
}

.calculator-results th:first-child, 
.calculator-results td:first-child {
    width: 65% !important;
}

.calculator-results th:last-child, 
.calculator-results td:last-child {
    width: 35% !important;
    white-space: nowrap !important;
    text-align: center !important;
}

.calculator-results td {
    padding: 0.75rem 0.5rem;
    text-align: left;
}

.calculator-results th {
    background: var(--main-color);
    color: #fcf7ef;
    text-align: center;
	font-style: italic;
	font-weight: normal;
}

tr:nth-child(even) {
    background-color: #FFFFFF;
}

.calculator-results table td[colspan], 
.calculator-results table th[colspan] {
    width: 100% !important;             
    white-space: normal !important;       
    word-break: break-word !important;    
    overflow-wrap: break-word !important;
    line-height: 1.4 !important;         
    padding: 12px 15px !important;       
}

/* --- СТИЛІ ДЛЯ ЧЕКБОКСІВ У ТАБЛИЦЯХ --- */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px; 
    cursor: pointer;
    width: 100%;
    font-weight: normal;
    line-height: 1 !important; 
}

.checkbox-container input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    flex-shrink: 0 !important;   
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    accent-color: var(--main-color); 
    box-shadow: none !important;
}

.ingredient-name {
    white-space: normal !important;
    word-break: break-word !important;
    display: inline-block;
    vertical-align: middle;
    line-height: 20px !important; 
    padding-left: 8px;
    text-align: left !important;
}

.ingredient-row.checked-item {
    background-color: #f0ede9 !important; 
    color: #a09990; 
}

.ingredient-row.checked-item .ingredient-name {
    text-decoration: line-through;
}

@media (max-width: 768px) {
    .pizza-calculator {
        width: 100%;
        max-width: 700px; 
        margin: 0 auto;
        flex-direction: column;
        margin-top: 20px;
        gap: 1.5rem !important; /* Можна збільшити до 1.5rem (24px), якщо хочеться більшого проміжку */
    }
    .calculator-results {
        margin-top: 0 !important; /* Скидаємо маржин, щоб працював лише gap */
        padding: 10px !important; 
    }
    .calculator-results td:first-child, 
    .calculator-results th:first-child {
        width: 75% !important;
    }
    .calculator-results td:last-child, 
    .calculator-results th:last-child {
        width: 25% !important;
    }
}

/* --- КНОПКИ ТА ДОДАТКОВІ ФОРМИ --- */
.switch {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; 
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 10px; 
}

.switch span {
    display: inline;
    width: 100%; 
    text-align: center; 
    margin-bottom: 8px;
    font-weight: 500;
}

.switch-btn {
    padding: 8px 16px; 
    background: #fffdf9;
    border: 1px solid #d0c9c0;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
    height: auto !important; 
}

.switch-btn.active {
    background: var(--main-color) !important;
    color: white !important;
    border-color: var(--main-color) !important;
}

.reset-btn {
    display: block;
    margin: 25px auto 0 auto !important; 
    width: 85% !important;
    height: 44px;
    background: #e0dcd7;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.calculator-inputs label:not(.checkbox-container) {
    text-align: center !important;
}
.calculator-inputs input:not([type="checkbox"]), 
.calculator-inputs select {
    display: block !important;
    margin: 0 auto !important;
}

.form-calculator {
    margin-top: 25px;
    padding: 15px;
    border: 1px dashed var(--main-color, #734A2F);
    border-radius: 8px;
    background-color: #fffaf7;
    box-sizing: border-box;
}
.form-calculator h3 {
    font-size: 16px;
    color: var(--main-color, #734A2F);
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
}

.shape-select-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    width: 100%;
}
.shape-select-group label {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}
.pizza-select-field {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    height: 34px !important; 
    width: 50%;
    max-width: 250px;
    box-sizing: border-box;
    margin: 0 auto !important;
}

.pizza-dimensions-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 15px !important;
    align-items: flex-end !important;
    justify-content: center !important;
    margin-bottom: 15px !important;
    width: 100% !important;
}
.dimension-block {
    width: 100% !important;
    max-width: 150px !important;
    box-sizing: border-box !important;
}
.dimension-block label,
.rect-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 5px;
}
.dimension-block input:not([type="checkbox"]),
.rect-field input:not([type="checkbox"]) {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    height: 34px !important;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto !important;
}

.rect-fields-group {
    display: none; 
    max-width: 315px !important;
    gap: 15px !important;
    flex-direction: row !important;
    justify-content: center !important;
    margin: 0 auto !important;
}
.rect-field {
    flex: 1 !important;
}

#form-result {
    font-size: 14px;
    color: #734A2F;
    margin-bottom: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e8dcd3;
    text-align: center;
}
#apply-pizza-size {
    display: block !important;
    background-color: var(--main-color, #734A2F);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    width: 100%;
    max-width: 200px;
    margin: 20px auto 0 auto !important;
    transition: background 0.2s;
    height: auto !important;
}

@media (max-width: 400px) {
    .pizza-select-field,
    .dimension-block,
    #apply-pizza-size {
        max-width: 100% !important;
    }
    .pizza-dimensions-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .rect-fields-group {
        flex-direction: column !important;
        max-width: 100% !important;
        gap: 10px !important;
    }
}

/* ========================================================
   Опис під рецептом
   ======================================================== */

.recipe-meta span {
	margin-top: 30px; 
	font-size: 14px; 
	color:#734A2F;
	font-style: italic;
}
/* ========================================================
   Pop-up Вікно "Як приготувати" (З урахуванням верхнього меню)
   ======================================================== */

/* Кнопка виклику */
.open-btn {
    margin-top: 10px;
    padding: 4px 10px;
    font-size: 15px;
    font-weight: normal;
    color: #F7F3E9;
    background-color: #734A2F;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    font-style: italic;
	border: solid 1px #734A2F;
}

.open-btn:hover {
    background-color: #F7F3E9;
    color: #734A2F;
	border: solid 1px #734A2F;
}

/* Затемнений фон (оверлей) */
.popup-overlay {
    position: fixed;
    inset: 0;

    display: flex;
    justify-content: center;
    align-items: center;
    
    /* ВРАХОВУЄМО МЕНЮ: додаємо відступ зверху, що дорівнює висоті вашого меню */
    padding-top: 60px; /* Змініть 60px на вашу висоту меню, якщо вона інша */
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.3);

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;

    z-index: 1000;
}

/* Активний стан поп-апу */
.popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Заголовок */
.popup-content h3 {
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Контентне вікно */
.popup-content {
    background: #F7F3E9;
    font-size: 14px;
	color: #734A2F;
    width: min(90%, 450px);
    
    /* Обмежуємо висоту вікна відносно чистого екрана без меню */
    max-height: 75vh; 

    padding: 30px 15px; 
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);

    position: relative;
    text-align: left;

    overflow-y: auto; /* Внутрішня прокрутка */

    transform: translateY(-20px);
    transition: transform 0.3s ease;

    box-sizing: border-box;
}

/* Анімація появи */
.popup-overlay.active .popup-content {
    transform: translateY(0);
}

/* Кнопка закриття (хрестик) */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;

    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
}

.close-btn:hover {
    color: #333;
}

/* Адаптивність для великих екранів */
@media (min-width: 768px) {
    .popup-content {
        padding: 30px;
        max-height: 75vh; 
    }
}