/* ─── Form wrapper ───────────────────────────────────────────────────────────── */

.ml-form-wrap {
    max-width: 680px;
}

.ml-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ─── Layout ──────────────────────────────────────────────────────────────────── */

.ml-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 560px) {
    .ml-form-row {
        grid-template-columns: 1fr;
    }
}

/* ─── Groups ──────────────────────────────────────────────────────────────────── */

.ml-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ml-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.ml-required {
    color: var(--color-accent);
    margin-left: 2px;
}

/* ─── Inputs ──────────────────────────────────────────────────────────────────── */

.ml-form input[type="text"],
.ml-form input[type="email"],
.ml-form input[type="tel"],
.ml-form input[type="number"],
.ml-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color 0.15s;
    outline: none;
}

.ml-form input:focus,
.ml-form textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.1);
}

.ml-form input.is-invalid,
.ml-form textarea.is-invalid {
    border-color: #ef4444;
}

.ml-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* ─── Honeypot ────────────────────────────────────────────────────────────────── */

.ml-hp {
    position: absolute;
    left: -9999px;
    visibility: hidden;
    pointer-events: none;
}

/* ─── Error messages ──────────────────────────────────────────────────────────── */

.ml-field-error {
    font-size: 12px;
    color: #ef4444;
    min-height: 16px;
    display: block;
}

/* ─── Phone field ─────────────────────────────────────────────────────────────── */

.ml-phone-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.ml-phone-wrap label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.ml-phone-field {
    display: flex;
    gap: 0;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow: hidden;
    background: var(--color-white);
    transition: border-color 0.15s;
}

.ml-phone-field:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.1);
}

.ml-phone-field.is-invalid {
    border-color: #ef4444;
}

.ml-phone-dial-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    background: var(--color-light);
    border: none;
    border-right: 1px solid #d1d5db;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    color: var(--color-text);
    flex-shrink: 0;
}

.ml-phone-dial-btn:hover {
    background: #e5e7eb;
}

.ml-phone-flag {
    font-size: 18px;
    line-height: 1;
}

.ml-phone-dial-code {
    font-size: 13px;
    font-weight: 600;
}

.ml-phone-chevron {
    opacity: 0.5;
    transition: transform 0.15s;
}

.ml-phone-dial-btn[aria-expanded="true"] .ml-phone-chevron {
    transform: rotate(180deg);
}

.ml-phone-number {
    flex: 1;
    padding: 10px 12px;
    border: none;
    font: inherit;
    font-size: 15px;
    color: var(--color-text);
    background: transparent;
    outline: none;
    min-width: 0;
}

/* ─── Phone dropdown ──────────────────────────────────────────────────────────── */

.ml-phone-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    width: 300px;
    background: var(--color-white);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.ml-phone-search-wrap {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.ml-phone-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.ml-phone-search:focus {
    border-color: var(--color-accent);
}

.ml-phone-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ml-phone-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.ml-phone-option:hover,
.ml-phone-option.is-highlighted {
    background: var(--color-light);
}

.ml-phone-option.is-selected {
    background: rgba(215, 25, 32, 0.06);
    font-weight: 600;
}

.ml-phone-option-flag {
    font-size: 16px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.ml-phone-option-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ml-phone-option-dial {
    color: var(--color-muted);
    font-size: 12px;
    flex-shrink: 0;
}

/* ─── Checkbox ────────────────────────────────────────────────────────────────── */

.ml-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
}

.ml-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.ml-form-consent {
    padding-top: 4px;
}

.ml-form-consent a {
    color: var(--color-accent);
}

/* ─── Newsletter specific ─────────────────────────────────────────────────────── */

.ml-newsletter-mobile-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: var(--color-light);
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.ml-newsletter-channels .ml-channels-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.ml-channels-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ml-channel-option {
    flex-direction: row;
    align-items: center;
}

.ml-channel-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

/* ─── Product badge ───────────────────────────────────────────────────────────── */

.ml-form-product-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--color-light);
    border-radius: 4px;
    border-left: 3px solid var(--color-accent);
    font-size: 14px;
}

.ml-form-product-label {
    color: var(--color-muted);
}

/* ─── Submit button ───────────────────────────────────────────────────────────── */

.ml-form-actions {
    padding-top: 4px;
}

.ml-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 4px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}

.ml-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ml-btn-primary {
    background: var(--color-accent);
    color: var(--color-white);
}

.ml-btn-primary:hover:not(:disabled) {
    opacity: 0.88;
}

/* ─── Spinner ─────────────────────────────────────────────────────────────────── */

.ml-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ml-spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes ml-spin {
    to { transform: rotate(360deg); }
}

/* ─── Form messages ───────────────────────────────────────────────────────────── */

.ml-form-message {
    padding: 14px 16px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.ml-form-message--success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.ml-form-message--error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
