/* order-form.css */

/* --- Модальне вікно --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100dvw;
    height: 100dvh;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, .5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, visibility .3s;
    z-index: 1000;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Мобільний: форма на всю ширину, мінімальні відступи */
.modal-content {
    background: #fff;
    width: 100%;
    padding: 6px 8px 10px;
    border-radius: 0;
    position: relative;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 100dvh;
}

@media (min-width: 600px) {
    .modal-overlay { align-items: center; }
    .modal-content {
        max-width: 500px;
        border-radius: 12px;
        padding: 28px;
        max-height: 90dvh;
    }
}

/* --- Десктопний режим: плаваюча панель без затемнення --- */
.modal-overlay.desktop {
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
}

.modal-overlay.desktop .modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .25);
    max-height: 90dvh;
    border-radius: 12px;
    padding: 0;
    width: 460px;
    max-width: 95vw;
    overflow-y: hidden;     /* скрол керується через modal-form-body */
    display: flex;
    flex-direction: column; /* drag-handle + body ростуть разом */
}

.modal-overlay.active.desktop .modal-content {
    transform: translate(-50%, -50%);
}

/* Смуга для перетягування */
.modal-drag-handle {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #e0e0e0;
    border-radius: 12px 12px 0 0;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;         /* не стискується при рості body */
}
.modal-drag-handle:active { cursor: grabbing; }
.modal-drag-handle .drag-title {
    font-size: 17px;
    font-weight: bold;
    color: #222;
}
.modal-overlay.desktop .modal-drag-handle { display: flex; }

/* Вміст форми (десктоп): займає решту висоти, скролиться */
.modal-form-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    flex: 1;                /* розтягується до max-height modal-content */
}

/* Заголовок (мобільний) */
.modal-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: bold;
    color: #222;
}

/* Кнопка закриття */
.close-btn {
    font-size: 24px;
    cursor: pointer;
    color: #555;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
}
.close-btn:hover { color: #000; }

.close-btn-mobile {
    position: absolute;
    right: 16px;
    top: 12px;
}

/* На десктопі мобільні елементи приховані */
.modal-overlay.desktop .close-btn-mobile { display: none; }
.modal-overlay.desktop .modal-title      { display: none; }

/* Відображення товару і ціни (тільки читання) */
.product-display {
    margin-bottom: 18px;
}
.product-display-inner {
    padding: 10px 12px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.4;
}

/* Honeypot */
.hp-field { display: none !important; }

/* --- Обов'язкові поля --- */
.req-mark { color: #d90000; font-weight: bold; }

.req-note {
    font-size: 12px;
    color: #888;
    margin: 0 0 14px;
    padding: 0;
}

/* Необов'язкові поля — лейбл світліший */
.form-group.floating label { color: #aaa; }

/* Обов'язкові — лейбл темніший + смужка зліва */
.form-group.floating input[required] ~ label { color: #666; }
.form-group.floating input[required] {
    border-left: 3px solid #d90000;
    padding-left: 10px;
}
.form-group.floating input[required]:focus {
    border-color: #d90000;
    box-shadow: 0 0 0 2px rgba(217,0,0,.15);
}

/* --- Floating labels --- */
.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-group.floating input,
.form-group.floating select,
.form-group.floating textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 12px 6px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: #000;
    transition: border-color .2s;
    outline: none;
    appearance: auto;
}

.form-group.floating textarea {
    resize: vertical;
    min-height: 80px;   /* ~3 рядки */
}

.form-group.floating input:focus,
.form-group.floating select:focus,
.form-group.floating textarea:focus {
    border-color: #d90000;
    box-shadow: 0 0 0 2px rgba(217,0,0,.15);
}

.form-group.floating label {
    position: absolute;
    left: 13px;
    top: 13px;
    font-size: 15px;
    pointer-events: none;
    transition: top .2s, font-size .2s, color .2s;
}

.form-group.floating input[required] ~ label { left: 11px; }

.form-group.floating input:focus      ~ label,
.form-group.floating input:not(:placeholder-shown) ~ label,
.form-group.floating textarea:focus   ~ label,
.form-group.floating textarea:not(:placeholder-shown) ~ label {
    top: 4px;
    font-size: 11px;
    color: #d90000;
}

.select-group label.select-label { top: 4px; font-size: 11px; color: #aaa; }
.form-group.floating select:focus ~ label.select-label { color: #d90000; }

.phone-group label.phone-label { top: 4px; font-size: 11px; color: #666; }
.form-group.floating input#phone:focus ~ label.phone-label { color: #d90000; }

/* --- Кнопка відправки --- */
.submit-btn {
    width: 100%;
    padding: 14px;
    background: #d90000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    transition: background .3s, opacity .3s, max-height .3s, padding .3s;
    margin-top: 5px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
}
.submit-btn.visible { opacity: 1; max-height: 60px; padding-top: 14px; padding-bottom: 14px; }
.submit-btn:hover    { background: #b50000; }
.submit-btn:disabled { background: #aaa; cursor: not-allowed; }

/* --- Сповіщення --- */
.notify {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    color: #fff;
    opacity: 1;
    transition: .5s;
    z-index: 9999;
    font-size: 15px;
}
.notify.success { background: #2ecc71; }
.notify.error   { background: #e74c3c; }
.notify.hide    { opacity: 0; transform: translateY(-10px); }
