/* Modal base (from original travel styles) */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
body.no-scroll { overflow: hidden; }

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    width: min(95vw, 900px);
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}
.modal-content::before {
    content: "";
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.15);
    margin: 8px auto 10px;
}
.modal-content img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
.modal-content form {
    display: grid;
    gap: 20px;
}
.modal-content > .modal-body,
#companyModal .modal-body,
#wishModal .modal-body {
    max-height: min(90vh, calc(100dvh - 120px));
    overflow: auto;
    padding: 16px 16px 22px;
    scrollbar-gutter: stable;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    gap: 0;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: inherit;
    font-weight: 600;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    z-index: 10;
    transition: transform 0.12s, background 0.12s;
}
.modal-close:hover,
.modal-close:focus {
    background: var(--brand, #046080);
    color: #fff;
    border-color: transparent;
    outline: none;
}
.modal-close:focus-visible {
    outline: 3px solid var(--brand, #046080);
    outline-offset: 2px;
}
.modal-content h3 {
    margin: 0 0 12px;
    text-align: center;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    font-weight: 800;
    color: #0f1b2a;
}

/* Compact padding variants */
#companyModal .modal-content,
#wishModal .modal-content {
    padding: 0;
}
#companyModal .modal-body,
#wishModal .modal-body {
    padding: 20px;
}

/* Scrollbars */
#companyModal .modal-body::-webkit-scrollbar,
#wishModal .modal-body::-webkit-scrollbar,
.modal-content > .modal-body::-webkit-scrollbar {
    width: 10px;
}
#companyModal .modal-body::-webkit-scrollbar-thumb,
#wishModal .modal-body::-webkit-scrollbar-thumb,
.modal-content > .modal-body::-webkit-scrollbar-thumb {
    background: #c9d6de;
    border-radius: 9999px;
    border: 2px solid #fff;
}
#companyModal .modal-body,
#wishModal .modal-body,
.modal-content > .modal-body {
    scrollbar-width: thin;
    scrollbar-color: #c9d6de transparent;
}

/* Form styles */
.modal-content {
    font-size: 16px;
    line-height: 1.45;
}
.modal-content form input:not([type="checkbox"]):not([type="range"]):not([type="file"]),
.modal-content form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--form-border, #c8d3da);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
}
.modal-content form input:focus:not([type="checkbox"]):not([type="range"]):not([type="file"]),
.modal-content form textarea:focus {
    border-color: var(--brand, #046080);
    outline: none;
    box-shadow: var(--form-focus-shadow, 0 0 0 2px rgba(4, 96, 128, 0.2));
}
.modal-content form textarea {
    resize: vertical;
}

/* Confirm modal */
.confirm-modal .modal-content {
    width: min(92vw, 520px);
    max-width: 520px;
    padding: 22px 22px 24px;
}

.confirm-modal .modal-content::before {
    display: none;
}

.confirm-modal .modal-body {
    padding: 0;
}

.confirm-modal .confirm-message {
    margin: 0 0 18px;
    color: #2f3c4c;
}

.confirm-modal .confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

/* Option grids */
#wishModal fieldset.field,
#companyModal fieldset.field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px 16px;
    align-items: start;
    border: 1px solid #e2e9ee;
    border-radius: 10px;
    padding: 12px 14px;
    background: #fbfdff;
}
#wishModal fieldset.field legend,
#companyModal fieldset.field legend {
    grid-column: 1 / -1;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin: 0 0 6px;
}
.option-grid {
    display: grid;
    gap: 10px 12px;
}
.option-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.option-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.option-wrap {
    position: relative;
    display: block;
}
.option-wrap input {
    position: fixed;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    border: 0;
    margin: 0;
    padding: 0;
}
.option-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid #dfe7ed;
    border-radius: 10px;
    background: #fff;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.option-title { font-weight: 600; }
.option-card:hover {
    border-color: var(--brand, #046080);
    box-shadow: 0 0 0 3px rgba(4, 96, 128, 0.12);
}
.option-wrap input:focus + .option-card {
    box-shadow: 0 0 0 3px rgba(4, 96, 128, 0.22);
    border-color: var(--brand, #046080);
}
.option-wrap:has(input:checked) .option-card {
    border-color: var(--brand, #046080);
    background: #f3fbff;
    box-shadow: 0 0 0 3px rgba(4, 96, 128, 0.18);
}

/* Consent box */
#wishModal .field.consent,
#companyModal .field.consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #f7fbfd;
    border: 1px solid #e2eef4;
    padding: 10px 12px;
    border-radius: 10px;
    line-height: 1.35;
}
#wishModal .field.consent a,
#companyModal .field.consent a { word-break: break-word; }

/* Image uploader tweaks inside modals */
.image-uploader .dropzone {
    border: 2px dashed #cfd9df;
    border-radius: 12px;
    padding: 16px 18px;
    background: #f8fbff;
    text-align: center;
    box-shadow: none;
}
.image-uploader .dropzone.dragover {
    border-color: var(--brand, #046080);
    background: #f3fbff;
    box-shadow: 0 0 0 3px rgba(4, 96, 128, 0.12);
}
.image-uploader .linklike {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--brand, #046080) !important;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}
.image-uploader .linklike:hover { color: var(--brand-hover, #0380a0) !important; }

/* Mobile bottom sheet */
@media (max-width: 700px) {
    .modal {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }
    .modal-content {
        width: 100vw;
        max-width: none;
        border-radius: 16px 16px 0 0;
        padding: 10px 12px 12px;
        transform: translateY(12px);
        animation: sheetIn 0.18s ease-out;
    }
    .modal-content h3 {
        position: static;
        top: auto;
        z-index: auto;
        padding: 10px 6px 12px;
        background: linear-gradient(#fff, rgba(255, 255, 255, .94) 85%);
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        margin-bottom: 10px;
    }
    #companyModal fieldset.field,
    #wishModal fieldset.field {
        padding: 10px 12px;
    }
}

/* Desktop centered */
@media (min-width: 700.01px) {
    .modal {
        align-items: center;
        justify-content: center;
        padding: 16px;
    }
    .modal-content {
        width: min(92vw, 760px);
        max-height: 90vh;
        padding: 18px 20px 20px;
        animation: dialogPop 0.16s ease-out;
    }
}

@keyframes sheetIn {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(12px); opacity: 1; }
}
@keyframes dialogPop {
    from { transform: scale(.98); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
