/* =========================================
   МОДАЛЬНОЕ ОКНО И ТОСТЫ
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 61, 38, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 28px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 44px;
    position: relative;
    box-shadow: 0 40px 100px rgba(0,0,0,0.3);
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: var(--cream);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.1rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all .25s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.modal-close:hover {
    background: #f0e8d8;
    color: var(--primary);
    transform: rotate(90deg) scale(1.05);
}

.modal h2 {
    font-size: 1.6rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
    font-weight: 700;
}

.modal-subtitle {
    color: var(--text-light);
    margin-bottom: 28px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.modal-form .form-group {
    margin-bottom: 20px;
}

.modal-form .form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.modal-form .form-group {
    position: relative;
}

.modal-form .form-group input,
.modal-form .form-group select,
.modal-form .form-group textarea {
    width: 100%;
    padding: 15px 18px 15px 44px;
    border: 2px solid var(--light-gray);
    border-radius: 14px;
    background: var(--cream);
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color .25s, background .25s, box-shadow .25s;
    box-sizing: border-box;
}

.modal-form .form-group input::placeholder {
    color: #aaa;
    font-weight: 400;
}

.modal-form .form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.modal-form .form-group input:focus,
.modal-form .form-group select:focus,
.modal-form .form-group textarea:focus {
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.1);
}

.modal-form .form-group input:hover,
.modal-form .form-group select:hover {
    border-color: var(--accent);
    opacity: 0.8;
}

/* Иконки внутри полей */
.modal-form .form-group .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #999);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}
.modal-form .form-group textarea ~ .input-icon {
    top: 22px;
    transform: none;
}

/* Убираем зелёный фон в select option (браузерный стиль) */
.modal-form .form-group select option {
    background: var(--white);
    color: var(--text);
}
.modal-form .form-group select option:hover,
.modal-form .form-group select option:checked {
    background: var(--cream);
}

.modal-form .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-form .form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.modal-image {
    border-radius: 16px;
    width: 100%;
    height: 240px;
    min-height: 160px;
    object-fit: cover;
}

.modal-content-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
}
@media (max-width: 640px) {
    .modal-content-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .modal {
        padding: 28px 20px;
        border-radius: 20px;
        max-width: 100%;
    }
    .modal-image {
        height: 160px;
    }
    .modal-form .form-row {
        grid-template-columns: 1fr;
    }
    .modal-form .form-row-3 {
        grid-template-columns: 1fr 1fr;
    }
    .modal h2 {
        font-size: 1.3rem;
    }
    .messenger-option {
        padding: 10px 14px;
        font-size: 0.82rem;
    }
}

.modal-content-layout .form-group:last-child {
    margin-bottom: 0;
}

.modal-extras-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.modal-extra-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--cream);
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.modal-extra-item:hover {
    border-color: var(--light-gray);
    background: #f5f0e5;
}
.modal-extra-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.modal-extra-item .extra-name {
    flex: 1;
    color: var(--text);
}
.modal-extra-item .extra-price {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}
.modal-extras-total {
    margin-top: 10px;
    font-weight: 700;
    text-align: right;
    color: var(--primary);
}

.messenger-select {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.messenger-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 12px;
    border: 2px solid var(--light-gray);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.messenger-option.active {
    border-color: var(--primary);
    background: rgba(26, 92, 58, 0.05);
    color: var(--primary);
    font-weight: 600;
}

.toast {
    background: var(--white);
    color: var(--text);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 400px;
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.3s;
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast i {
    font-size: 1.8rem;
    color: var(--primary);
}

.toast strong {
    display: block;
    font-size: 1.05rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.toast span {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Modal image */
.modal-image-wrap {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16/10;
    background: var(--cream);
}
.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.modal-image-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
@media(max-width: 600px) {
    .modal-content-layout {
        grid-template-columns: 1fr !important;
    }
    .modal-image-wrap {
        aspect-ratio: 16/9;
        max-height: 200px;
    }
}
