/* modal.css - Стили для модальных окон */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-content {
    background: var(--modal-bg-color, #ffffff);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color, #f0f0f0);
}

.modal-title {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--modal-title-text-color, #2c3e50);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--hover-light, #f0f0f0);
    color: var(--text-primary, #333);
}

.order-items {
    margin-bottom: 20px;
}

.order-item {
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color, #f0f0f0);
    display: block;
}

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

/* Заголовок товара - в одной строке */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
    width: 100%;
}

.item-title-section {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--modal-title-text-color, #2c3e50);
    font-size: 1.3em;
    margin: 0 0 5px 0;
}

.item-unit-info {
    font-weight: bold;
    color: var(--accent-color, #4CAF50);
    font-size: 1.1em;
}

.item-total-price {
    font-weight: bold;
    color: var(--accent-color, #4CAF50);
    font-size: 1.4em;
    text-align: right;
    white-space: nowrap;
    margin-left: 15px;
}

/* Блок модификаторов - ОТДЕЛЬНЫЙ блок на новой строке */
.modifiers-section {
    background: var(--order-fields-bg-color, #f8f9fa);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0 0 0;
    border: 1px solid var(--border-light, #e9ecef);
    width: 100%;
    box-sizing: border-box;
    display: block;
}

/* Строки модификаторов - БЕЗ ГРАНИЦ */
.modifier-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    width: 100%;
    border-bottom: none;
}

.modifier-label {
    color: var(--text-primary, #555);
    flex: 1;
}

.modifier-value {
    font-weight: 500;
    white-space: nowrap;
    margin-left: 15px;
}

.modifier-value.positive {
    color: var(--success-color, #28a745);
}

.modifier-value.negative {
    color: var(--error-color, #dc3545);
}

.modifier-value.base-price {
    color: var(--text-secondary, #666);
}

.modifier-value.total-price {
    color: var(--accent-color, #4CAF50);
    font-weight: 600;
}

/* Убираем ВСЕ разделители */
.modifiers-divider {
    display: none;
}

/* ТОЛЬКО ОДНА ТОНКАЯ ЛИНИЯ - над итоговой ценой */
.position-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light, #dee2e6);
}

.position-total .modifier-label {
    font-weight: 600;
    color: var(--modal-title-text-color, #2c3e50);
}

.order-total {
    background: var(--order-fields-bg-color, #f8f9fa);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    border: 2px solid var(--border-light, #e9ecef);
}

.total-amount {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--modal-title-text-color, #2c3e50);
}

/* Стиль для информации о столике в модальном окне */
.table-info-small {
    background: var(--table-info-bg, #eef2f7);
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    color: var(--modal-title-text-color, #2c3e50);
    font-weight: 500;
    border: 1px solid var(--border-light, #dbe2e8);
}

/* Сообщение подтверждения */
.confirmation-message {
    padding: 20px 0;
    text-align: center;
    font-size: 1.1em;
    color: var(--modal-title-text-color, #2c3e50);
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.confirm-btn {
    flex: 1;
    background: var(--confirm-btn-bg-color, #4CAF50);
    color: var(--confirm-btn-text-color, #ffffff);
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.confirm-btn:hover {
    background: var(--success-hover, #45a049);
}

.delete-btn {
    background: var(--error-color, #dc3545);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: var(--error-hover, #c82333);
}

.cancel-btn {
    flex: 1;
    background: var(--cancel-btn-bg-color, #6c757d);
    color: var(--cancel-btn-text-color, #ffffff);
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cancel-btn:hover {
    background: var(--cancel-hover, #5a6268);
}

/* Стили для полей заказа */
.order-fields-section {
    margin: 20px 0;
    padding: 20px;
    background: var(--order-fields-bg-color, #f8f9fa);
    border-radius: 10px;
    border: 1px solid var(--border-light, #e9ecef);
}

.order-fields-section h3 {
    margin: 0 0 15px 0;
    color: var(--modal-title-text-color, #2c3e50);
    font-size: 1.3em;
}

.order-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-field-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.order-field-label {
    font-weight: 500;
    color: var(--text-primary, #333);
    font-size: 1em;
}

.order-field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.order-field-input:focus {
    outline: none;
    border-color: var(--accent-color, #4CAF50);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.order-field-input[required]:invalid {
    border-color: var(--error-color, #f44336);
}

/* Стили для уведомления об успешном заказе */
.order-success-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--success-color, #4CAF50), var(--success-hover, #45a049));
    color: white;
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(76, 175, 80, 0.3);
    z-index: 10001;
    text-align: center;
    min-width: 300px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.order-success-notification.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.order-success-notification .success-icon {
    font-size: 3em;
    margin-bottom: 15px;
    display: block;
}

.order-success-notification .success-title {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.order-success-notification .success-message {
    font-size: 1em;
    opacity: 0.9;
    line-height: 1.4;
}

/* Анимации */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 10px;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .order-success-notification {
        min-width: 250px;
        padding: 20px 25px;
        margin: 0 20px;
    }

    .order-fields-section {
        padding: 15px;
        margin: 15px 0;
    }

    .modifier-item {
        padding-left: 15px;
    }
}

/* Стили для HTML-версии заказа (почта/сохранение) - БОЛЕЕ СПЕЦИФИЧНЫЕ */
.email-order .modifier-row,
.saved-order .modifier-row,
.order-html .modifier-row,
.order-receipt .modifier-row {
    border-bottom: none !important;
    border-top: none !important;
}

.email-order .modifiers-divider,
.saved-order .modifiers-divider,
.order-html .modifiers-divider,
.order-receipt .modifiers-divider {
    display: none !important;
}

.email-order .modifier-row:last-child,
.saved-order .modifier-row:last-child,
.order-html .modifier-row:last-child,
.order-receipt .modifier-row:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.email-order .position-total,
.saved-order .position-total,
.order-html .position-total,
.order-receipt .position-total {
    border-top: 1px solid #dee2e6 !important;
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-bottom: none !important;
}

/* Убираем ВСЕ возможные границы в модификаторах для HTML-версий */
.email-order .modifiers-section .modifier-row,
.saved-order .modifiers-section .modifier-row,
.order-html .modifiers-section .modifier-row,
.order-receipt .modifiers-section .modifier-row {
    border: none !important;
}

/* Стили для модального окна товара */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    padding: 20px;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.product-modal-content {
    background: var(--modal-bg-color, #ffffff);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.product-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color, #f0f0f0);
    grid-column: 1 / -1;
}

.product-modal-title {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--modal-title-text-color, #2c3e50);
    margin: 0;
    line-height: 1.2;
}

.product-modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.product-modal-close:hover {
    background: var(--hover-light, #f0f0f0);
    color: var(--text-primary, #333);
}

/* ЛЕВАЯ КОЛОНКА: Изображение и описание */
.product-modal-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-modal-image-container {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: var(--product-bg-color, #ffffff);
    border: 1px solid var(--product-image-border-color, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.product-modal-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
}

.product-modal-description {
    font-size: 1.1em;
    color: var(--product-text-color, #666666);
    line-height: 1.5;
    margin: 0;
    padding: 15px;
    background: var(--order-fields-bg-color, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border-light, #e9ecef);
}

/* ПРАВАЯ КОЛОНКА: Подробности, цена и кнопки */
.product-modal-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-modal-details {
    background: var(--order-fields-bg-color, #f8f9fa);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-light, #e9ecef);
    flex: 1;
}

.product-modal-details h4 {
    margin: 0 0 10px 0;
    color: var(--modal-title-text-color, #2c3e50);
    font-size: 1.2em;
}

.product-modal-details-content {
    white-space: pre-line;
    line-height: 1.6;
    color: var(--text-primary, #555);
    margin: 0;
}

.product-modal-price {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--price-color, #ff6b35);
    margin: 10px 0;
    text-align: center;
}

.product-modal-actions {
    display: flex;
    gap: 15px;
    margin-top: auto;
}

.product-modal-add-btn {
    background: var(--confirm-btn-bg-color, #4CAF50);
    color: var(--confirm-btn-text-color, #ffffff);
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    flex: 1;
}

.product-modal-add-btn:hover {
    background: var(--success-hover, #45a049);
}

.product-modal-close-btn {
    background: var(--cancel-btn-bg-color, #6c757d);
    color: var(--cancel-btn-text-color, #ffffff);
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    flex: 1;
}

.product-modal-close-btn:hover {
    background: var(--cancel-hover, #5a6268);
}

/* Стили для контейнеров без изображения в модальном окне */
.product-modal-image-container.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--order-fields-bg-color, #f8f9fa);
}

.no-image-placeholder-modal {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary, #6c757d);
    font-size: 16px;
    font-weight: 500;
}

/* Адаптивность для модального окна товара */
@media (max-width: 768px) {
    .product-modal-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .product-modal-title {
        font-size: 1.5em;
    }

    .product-modal-image-container {
        min-height: 250px;
    }

    .product-modal-actions {
        flex-direction: column;
    }

    /* На мобильных объединяем левую и правую колонки */
    .product-modal-left,
    .product-modal-right {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .product-modal-overlay {
        padding: 10px;
    }

    .product-modal-content {
        padding: 15px;
        margin: 10px;
    }

    .product-modal-title {
        font-size: 1.3em;
    }

    .product-modal-price {
        font-size: 1.5em;
    }

    .product-modal-actions {
        gap: 10px;
    }

    .product-modal-add-btn,
    .product-modal-close-btn {
        padding: 12px 20px;
        font-size: 1em;
    }

    .product-modal-description {
        padding: 12px;
        font-size: 1em;
    }

    .product-modal-details {
        padding: 15px;
    }

    .no-image-placeholder-modal {
        padding: 30px;
        font-size: 14px;
    }
}

/* Стили для состава комбо-блюд в модальном окне подтверждения заказа */
.combo-details-section {
    margin: 12px 0;
    padding: 12px;
    background: var(--combo-bg-color, #f8fff8);
    border-radius: 6px;
    border: 1px solid var(--combo-border-color, #e0f0e0);
}

.combo-element {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.combo-modifier {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    font-size: 0.85em;
    color: var(--text-secondary, #888);
    font-style: italic;
}

.combo-element-name {
    font-weight: 500;
}

.combo-element-price {
    font-weight: 500;
    color: var(--success-color, #28a745);
}

.combo-modifier-name {
    margin-left: 10px;
}

.combo-modifier-price {
    color: var(--success-color, #28a745);
}

/* СТАТИЧНЫЕ стили для состава комбо-блюд в модальном окне подтверждения заказа */
.combo-details-section-static {
    margin: 12px 0;
    padding: 12px;
    background: var(--combo-bg-color, #f8fff8);
    border-radius: 6px;
    border: 1px solid var(--combo-border-color, #e0f0e0);
}

.combo-element-static {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.95em;
    padding: 4px 0;
    border: none !important;
    background: none !important;
    cursor: default !important;
}

.combo-modifier-static {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    font-size: 0.85em;
    color: var(--text-secondary, #888);
    font-style: italic;
    padding: 2px 0;
    border: none !important;
    background: none !important;
    cursor: default !important;
}

.combo-element-name-static {
    font-weight: 500;
}

.combo-element-price-static {
    font-weight: 500;
    color: var(--success-color, #28a745);
}

.combo-modifier-name-static {
    margin-left: 10px;
}

.combo-modifier-price-static {
    color: var(--success-color, #28a745);
}

.position-total-static {
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
    margin-top: 8px;
}

/* Убираем все интерактивные эффекты */
.combo-element-static:hover,
.combo-modifier-static:hover {
    background: none !important;
    border-color: transparent !important;
    transform: none !important;
    box-shadow: none !important;
}

.customer-email-section {
    background: var(--order-fields-bg-color, #f8f9fa);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid var(--border-light, #e9ecef);
}

.customer-email-section h3 {
    color: var(--modal-title-text-color, #2c3e50);
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.customer-email-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.customer-email-label {
    font-weight: 500;
    color: var(--text-primary, #333);
    font-size: 0.95em;
}

.customer-email-input {
    padding: 12px 15px;
    border: 1px solid var(--input-border-color, #ddd);
    border-radius: 8px;
    font-size: 1em;
    background: var(--input-bg-color, #fff);
    color: var(--input-text-color, #333);
    transition: border-color 0.3s ease;
}

.customer-email-input:focus {
    outline: none;
    border-color: var(--accent-color, #4CAF50);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.customer-email-input:invalid {
    border-color: var(--error-color, #f44336);
}

/* modal.css - добавьте в конец файла: */

/* === СТИЛИ ДЛЯ ПОЛЕЙ С URL-ЗНАЧЕНИЯМИ === */

/* Контейнер для поля с иконкой */
.input-with-icon-container {
    position: relative;
}

.field-has-url-value .field-url-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #6c757d);
    font-size: 1em;
    pointer-events: none;
}

/* Поля с URL-значениями */
.field-from-url {
    background-color: var(--order-fields-bg-color, #f8f9fa);
    border: 1px solid var(--border-color, #ddd);
    color: var(--text-secondary, #495057);
    cursor: not-allowed;
    padding-right: 40px;
    opacity: 0.8;
}

.field-from-url:focus {
    outline: none;
    box-shadow: none;
    border-color: var(--border-color, #ddd);
}

/* Информационная подсказка под полем */
.field-source-hint {
    font-size: 0.85em;
    color: var(--text-secondary, #6c757d);
    font-style: italic;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

/* Состояния полей */
input:disabled,
textarea:disabled,
select:disabled,
input[readonly] {
    cursor: not-allowed;
}

/* Стили для ошибок валидации */
.order-field-input:invalid:not(:focus):not(.field-from-url) {
    border-color: var(--error-color, #dc3545);
}

.email-validation-message {
    color: var(--error-color, #dc3545);
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

/* Адаптивность для полей с URL-значениями */
@media (max-width: 768px) {
    .field-source-hint {
        font-size: 0.8em;
        padding: 3px 6px;
    }
    
    .field-has-url-value .field-url-icon {
        right: 10px;
        font-size: 0.9em;
    }
    
    .field-from-url {
        padding-right: 35px;
    }
}

/* === СТИЛИ ДЛЯ ПОЛЯ EMAIL ПОКУПАТЕЛЯ С URL-ЗНАЧЕНИЕМ === */

.customer-email-row.has-url-value .field-url-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #6c757d);
    font-size: 1em;
}

.customer-email-input.field-from-url {
    background-color: var(--order-fields-bg-color, #f8f9fa);
    border: 1px solid var(--border-color, #ddd);
    color: var(--text-secondary, #495057);
    cursor: not-allowed;
    padding-right: 40px;
    opacity: 0.8;
}

.customer-email-input.field-from-url:focus {
    border-color: var(--border-color, #ddd);
    box-shadow: none;
}