/*
 * contact-form-modal.css
 * ─────────────────────────────────────────────────────────────
 * Self-contained styles for the contact form modal.
 * Fully resets browser defaults on all form elements —
 * no dependency on Bootstrap, jQuery UI, or any other framework.
 *
 * Load this after your main stylesheet so these rules take
 * precedence where needed.
 * ─────────────────────────────────────────────────────────────
 */


/* ── Prevent body scroll when modal is open ──────────────────*/
body.modal-open {
    overflow: hidden;
}


/* ── Modal root — hidden by default ─────────────────────────*/
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.modal--open {
    display: flex;
    align-items: center;
    justify-content: center;
}
/*.modal--open {
    display: flex;
}*/


/* ── Overlay ─────────────────────────────────────────────────*/
.modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
    animation: modal-overlay-in 0.2s ease forwards;
}

@keyframes modal-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* .modal__container {
    padding: 2rem;
    width: 90%;
    max-width: 560px;
} */
/* ── Container ───────────────────────────────────────────────*/
.modal__container {
    position: relative;
    z-index: 1001;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18) !important;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem; /* 2rem 2.5rem;*/
    box-sizing: border-box;
    animation: modal-container-in 0.22s ease forwards;
}

@keyframes modal-container-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal__container::-webkit-scrollbar {
    width: 6px;
}
.modal__container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.modal__container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}


/* ── Header ──────────────────────────────────────────────────*/
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal__title {
    all: unset;
    display: block;
    font-size: 1.35rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}


/* ── Close button ────────────────────────────────────────────*/
.modal__close {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1rem;
    color: #666;
    background: #f0f0f0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.modal__close:hover,
.modal__close:focus-visible {
    background: #e0e0e0;
    color: #1a1a1a;
}

.modal__close:focus-visible {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}


/* ── Feedback area ───────────────────────────────────────────*/
.modal__feedback {
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal__feedback--success {
    background: #f0faf3;
    border: 1px solid #b2dfca;
    color: #1a6637;
    /*margin: 50% auto;*/
}

.modal__feedback--error {
    background: #fff5f5;
    border: 1px solid #f5c0c0;
    color: #b91c1c;
}


/* ── Form ────────────────────────────────────────────────────*/
.modal__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}


/* ── Form group ──────────────────────────────────────────────*/
.form__group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form__group label {
    all: unset;
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.01em;
}

.form__group label span[aria-hidden] {
    color: #c0392b;
    margin-left: 2px;
}

.form__optional {
    font-weight: 400;
    color: #888;
    font-size: 0.8rem;
}


/* ── Inputs and textarea — full browser reset ────────────────*/
.modal__form input[type="text"],
.modal__form input[type="email"],
.modal__form input[type="tel"],
.modal__form textarea {
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;

    display: block;
    width: 100%;
    box-sizing: border-box;

    font-family: inherit;
    font-size: 0.95rem;
    color: #1a1a1a;
    line-height: 1.5;

    padding: 0.6rem 1rem;

    border-radius: 999px;
    border: 1.5px solid #d0d0d0 !important;
    background: #fafafa;

    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

/* Textarea — softer rounding, full pill looks odd on multiline */
.modal__form textarea {
    border-radius: 1rem;
    resize: vertical;
    min-height: 120px;
}

/* Focus — replaces browser blue outline entirely */
.modal__form input[type="text"]:focus,
.modal__form input[type="email"]:focus,
.modal__form input[type="tel"]:focus,
.modal__form textarea:focus {
    outline: none;
    border-color: #717074 !important; /*#4a90e2 !important;*/
    background: #fff;
    /*box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.18);*/
    box-shadow: 0 0 0 3px rgba(113, 112, 116, 0.18) !important;

}

/* Hover */
.modal__form input[type="text"]:hover,
.modal__form input[type="email"]:hover,
.modal__form input[type="tel"]:hover,
.modal__form textarea:hover {
    border-color: #aaa;
}

/* Invalid state — only shown after the user has typed something */
.modal__form input:not(:placeholder-shown):invalid,
.modal__form textarea:not(:placeholder-shown):invalid {
    border-color: #e05252;
    box-shadow: 0 0 0 3px rgba(224, 82, 82, 0.12);
}

/* Placeholder */
.modal__form input::placeholder,
.modal__form textarea::placeholder {
    color: #bbb;
    opacity: 1; /* Firefox reduces opacity by default */
}

/* Disabled */
.modal__form input:disabled,
.modal__form textarea:disabled {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

/* Autofill — override browser yellow/blue background injection */
.modal__form input:-webkit-autofill,
.modal__form input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: #1a1a1a;
    transition: background-color 9999s ease-in-out 0s;
}


/* ── Phone field layout ───────────────────────────────────────
   Sits inside a .form__group so it inherits the full-width
   column behaviour. Flex row internally: country dropdown
   (narrower) beside phone number input (wider).
   ──────────────────────────────────────────────────────────── */
.phone-field {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.phone-field__country {
    flex: 1 1 200px;
}

.phone-field__number {
    flex: 2 1 200px;
}

.phone-field select,
.phone-field input {
    width: 100%;
}


/* ── Select — cross-browser, matches pill inputs ─────────────
   -webkit-appearance: none removes Safari/iOS native chrome.
   The custom arrow is drawn via background-image SVG so it
   works on every browser without a wrapper element.
   ──────────────────────────────────────────────────────────── */
.modal__form select {
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;

    display: block;
    width: 100%;
    box-sizing: border-box;

    font-family: inherit;
    font-size: 0.95rem;
    color: #1a1a1a;
    line-height: 1.5;

    /* Right padding makes room for the custom arrow */
    padding: 0.6rem 2.5rem 0.6rem 1rem;

    border-radius: 999px;
    border: 1.5px solid #d0d0d0;
    background-color: #fafafa;

    /* Custom chevron arrow — inline SVG, colour matches #666 */
    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='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;

    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.modal__form select:focus {
    outline: none;
    border-color: #717074;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(113, 112, 116, 0.18);
}

.modal__form select:hover {
    border-color: #aaa;
}

.modal__form select:disabled {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

/* IE 11 — hide its native arrow (IE ignores appearance:none on select) */
.modal__form select::-ms-expand {
    display: none;
}


/* ── Form actions ────────────────────────────────────────────*/
.form__actions {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-end;
}


/* ── Submit button ───────────────────────────────────────────*/
.btn--primary {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;

    border-radius: 999px;
    padding: 0.65rem 2.25rem; /* increased from 1.75*/

    background: #a31e22; /*#717074;*/ /*#4a90e2;*/
    color: #fff;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;

    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn--primary:hover {
    background: #717074; /*#a31e22;*/ /*#3a7bd5;*/
    color: #dad8da;
    box-shadow: 0 4px 14px rgba(74, 144, 226, 0.35);
}

.btn--primary:active {
    transform: scale(0.98);
    box-shadow: none;
}

.btn--primary:focus-visible {
    outline: 2px solid #4a90e2;
    outline-offset: 3px;
}

.btn--primary:disabled {
    background: #a0bfe8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.field--error {
    border-color: #c0392b;
    outline-color: #c0392b;
}

#completion-errors {
    margin-bottom: 0;
}

.completion-error__item {
    color: #c0392b;
    font-size: 14px;
    margin: 4px 0;
    font-weight: 700;
}

/* ── Responsive ──────────────────────────────────────────────*/
@media (max-width: 480px) {
    .modal__container {
        padding: 1.5rem 1.25rem 2rem;
        border-radius: 0.75rem;
        max-height: 95vh;
    }

    .modal__form input[type="text"],
    .modal__form input[type="email"],
    .modal__form input[type="tel"],
    .modal__form textarea {
        border-radius: 0.6rem;
    }

    /* Select matches input border-radius on small screens */
    .modal__form select {
        border-radius: 0.6rem;
    }

    .btn--primary {
        width: 100%;
        border-radius: 0.6rem;
    }

    .form__actions {
        justify-content: stretch;
    }

    /* Phone field stacks vertically on small screens */
    .phone-field__country,
    .phone-field__number {
        flex: 1 1 100%;
    }
}
