﻿/* ============================================================
   LoreForm — Apple-inspired premium contact popup
   ============================================================ */

/* ── Reset (scoped) ───────────────────────────────────────── */
.loreform-overlay *,
.loreform-overlay *::before,
.loreform-overlay *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Overlay ──────────────────────────────────────────────── */
.loreform-overlay {
    position: fixed;
    inset: 0;
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.loreform-overlay.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* ── Modal card ───────────────────────────────────────────── */
.loreform-modal {
    background: #ffffff;
    border-radius: 22px;
    padding: 38px 34px 34px;
    width: 100%;
    max-width: 490px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.22),
        0 8px 24px  rgba(0, 0, 0, 0.10),
        0 2px 6px   rgba(0, 0, 0, 0.06);
    transform: scale(0.96);
    opacity: 0;
    transition:
        transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        opacity   0.22s ease-out;
    font-family:
        -apple-system, BlinkMacSystemFont, "SF Pro Display",
        "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    scrollbar-width: thin;
    scrollbar-color: #e5e5ea transparent;
}

.loreform-modal::-webkit-scrollbar        { width: 4px; }
.loreform-modal::-webkit-scrollbar-track  { background: transparent; }
.loreform-modal::-webkit-scrollbar-thumb  { background: #e5e5ea; border-radius: 2px; }

.loreform-overlay.is-open .loreform-modal {
    transform: scale(1);
    opacity: 1;
}

/* ── Close button ─────────────────────────────────────────── */
.loreform-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #f2f2f7;
    color: #8e8e93;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.loreform-close:hover {
    background: #e5e5ea;
    color: #1d1d1f;
    transform: scale(1.1) rotate(90deg);
}

/* ── Header ───────────────────────────────────────────────── */
.loreform-header {
    margin-bottom: 30px;
}

.loreform-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.6px;
    line-height: 1.2;
    margin-bottom: 6px;
}

.loreform-header p {
    font-size: 15px;
    color: #8e8e93;
    font-weight: 400;
    line-height: 1.45;
}

/* ── Field wrapper ────────────────────────────────────────── */
.loreform-field {
    margin-bottom: 22px;
}

.loreform-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #3a3a3c;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 10px;
    user-select: none;
}

/* ── Segment control (iOS-style) ──────────────────────────── */
.loreform-segment {
    display: flex;
    background: #f2f2f7;
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}

.loreform-seg-btn {
    flex: 1;
    padding: 9px 6px;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 500;
    color: #3a3a3c;
    cursor: pointer;
    transition: background 0.22s, color 0.18s, box-shadow 0.22s;
    font-family: inherit;
    text-align: center;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
}

.loreform-seg-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.55);
}

.loreform-seg-btn.active {
    background: #ffffff;
    color: #1d1d1f;
    font-weight: 600;
    box-shadow:
        0 1px 4px  rgba(0, 0, 0, 0.12),
        0 0   0 0.5px rgba(0, 0, 0, 0.04);
}

/* ── Textarea + text input ────────────────────────────────── */
.loreform-modal textarea,
.loreform-modal input[type="text"] {
    width: 100%;
    border: 1.5px solid #e5e5ea;
    border-radius: 12px;
    padding: 13px 15px;
    font-size: 15px;
    font-family: inherit;
    color: #1d1d1f;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.55;
    -webkit-appearance: none;
    -webkit-font-smoothing: antialiased;
}

.loreform-modal textarea {
    resize: none;
    min-height: 110px;
    max-height: 200px;
    overflow-y: auto;
    display: block;
}

.loreform-modal textarea::placeholder,
.loreform-modal input[type="text"]::placeholder {
    color: #c7c7cc;
}

.loreform-modal textarea:focus,
.loreform-modal input[type="text"]:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.13);
}

.loreform-modal textarea.has-error,
.loreform-modal input[type="text"].has-error {
    border-color: #ff3b30;
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.10);
}

/* ── Inline error ─────────────────────────────────────────── */
.loreform-error {
    display: block;
    font-size: 12.5px;
    color: #ff3b30;
    margin-top: 6px;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    min-height: 1px;  /* prevent layout shift */
}

.loreform-error.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Contact type tabs ────────────────────────────────────── */
.loreform-contact-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.loreform-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1.5px solid #e5e5ea;
    background: #fff;
    border-radius: 100px;
    font-size: 13.5px;
    font-weight: 500;
    color: #3a3a3c;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
    font-family: inherit;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
}

.loreform-contact-btn svg {
    flex-shrink: 0;
    stroke: currentColor;
    transition: stroke 0.2s;
}

.loreform-contact-btn:hover:not(.active) {
    border-color: #c7c7cc;
    transform: translateY(-1px);
}

.loreform-contact-btn.active {
    border-color: #1d1d1f;
    background: #1d1d1f;
    color: #ffffff;
}

.loreform-contact-btn.active svg {
    stroke: #ffffff;
}

/* ── Submit button ────────────────────────────────────────── */
.loreform-submit {
    width: 100%;
    padding: 15px 24px;
    background: linear-gradient(175deg, #2c2c2e 0%, #1c1c1e 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(29, 29, 31, 0.28);
    letter-spacing: -0.1px;
    -webkit-font-smoothing: antialiased;
    margin-top: 4px;
}

.loreform-submit:hover:not(:disabled) {
    background: linear-gradient(175deg, #3a3a3c 0%, #2c2c2e 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(29, 29, 31, 0.32);
}

.loreform-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(29, 29, 31, 0.20);
}

.loreform-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.loreform-btn-text {
    transition: opacity 0.2s;
}

.loreform-btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: lf-spin 0.72s linear infinite;
    display: none;
    flex-shrink: 0;
}

.loreform-submit.is-loading .loreform-btn-text {
    opacity: 0.6;
}

.loreform-submit.is-loading .loreform-btn-loader {
    display: block;
}

@keyframes lf-spin {
    to { transform: rotate(360deg); }
}

/* ── Toast notification ───────────────────────────────────── */
.loreform-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1d1d1f;
    color: #fff;
    padding: 12px 18px 12px 12px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    font-family:
        -apple-system, BlinkMacSystemFont, "SF Pro Display",
        "Segoe UI", system-ui, sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999999;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.22),
        0 2px 8px  rgba(0, 0, 0, 0.10);
    opacity: 0;
    transition:
        transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity   0.32s ease;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    pointer-events: none;
    -webkit-font-smoothing: antialiased;
}

.loreform-toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.loreform-toast--error {
    background: #ff3b30;
}

.loreform-toast-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}

/* ── Navbar trigger item ──────────────────────────────────── */
.loreform-nav-item > a {
    cursor: pointer;
}

/* ── Body scroll lock ─────────────────────────────────────── */
body.loreform-lock {
    overflow: hidden;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 520px) {
    .loreform-modal {
        padding: 28px 20px 24px;
        border-radius: 18px;
        max-height: 94vh;
    }

    .loreform-header h2 {
        font-size: 22px;
    }

    .loreform-seg-btn {
        font-size: 12.5px;
        padding: 8px 4px;
    }

    .loreform-contact-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .loreform-toast {
        white-space: normal;
        text-align: center;
        bottom: 16px;
    }
}
