/*
 * Website modals and form fields (components/website/modal, complain-modal, contact-modal).
 * Colours come from the active theme: --ws-primary / --ws-accent (Organization → website colours),
 * so every template gets its own accent. A modal with data-square uses sharp corners (civic, corporate).
 */

/* ── Modal shell ─────────────────────────────────────────────────────── */
#ws-root .wsx-backdrop {
    position: fixed; inset: 0; z-index: 60;
    background: rgb(15 23 42 / 0.45);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#ws-root .wsx-modal {
    position: fixed; inset: 0; z-index: 70;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
#ws-root .wsx-modal__box {
    --wsx-radius: 1.1rem;
    width: 100%; max-width: 780px; max-height: min(92vh, 960px);
    display: flex; flex-direction: column;
    background: #fff; color: #1f2937;
    border-radius: var(--wsx-radius);
    box-shadow: 0 30px 80px -20px rgb(15 23 42 / 0.45), 0 0 0 1px rgb(15 23 42 / 0.04);
    overflow: hidden;
}
#ws-root .wsx-modal__box--lg { max-width: 900px; }
#ws-root .wsx-modal__box[data-square] { --wsx-radius: 2px; }
#ws-root .wsx-modal__head {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid #eef0f4;
    flex-shrink: 0;
}
/* accent stripe along the top: primary → accent */
#ws-root .wsx-modal__head::before {
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px;
    background: linear-gradient(90deg, var(--ws-primary), var(--ws-accent));
}
#ws-root .wsx-modal__brand { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
#ws-root .wsx-modal__icon {
    width: 2.6rem; height: 2.6rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px; color: #fff;
    background: linear-gradient(135deg, var(--ws-primary), var(--ws-accent));
    box-shadow: 0 8px 18px -8px var(--ws-primary);
}
#ws-root .wsx-modal__box[data-square] .wsx-modal__icon { border-radius: 2px; }
#ws-root .wsx-modal__icon svg { width: 1.2rem; height: 1.2rem; }
#ws-root .wsx-modal__title { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.25; color: #111827; }
#ws-root .wsx-modal__sub { margin: 0.1rem 0 0; font-size: 0.8rem; color: #6b7280; }
#ws-root .wsx-modal__close {
    width: 2.25rem; height: 2.25rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 999px; background: transparent; color: #9ca3af; cursor: pointer;
    transition: background-color .15s, color .15s;
}
#ws-root .wsx-modal__close:hover { background: #f3f4f6; color: #374151; }
#ws-root .wsx-modal__body { flex: 1; overflow-y: auto; padding: 1.4rem 1.5rem 1.5rem; }
#ws-root .wsx-section + .wsx-section { margin-top: 1.4rem; padding-top: 1.4rem; border-top: 1px solid #eef0f4; }
#ws-root .wsx-section__title {
    margin: 0 0 1rem; font-size: 0.72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ws-primary);
}

/* ── Fields ──────────────────────────────────────────────────────────── */
#ws-root .wsx-grid { display: grid; gap: 1rem 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#ws-root .wsx-grid > .wsx-span { grid-column: 1 / -1; }
@media (max-width: 600px) { #ws-root .wsx-grid { grid-template-columns: minmax(0, 1fr); } }
#ws-root .wsx-field { display: grid; align-content: start; gap: 0.35rem; min-width: 0; }
#ws-root .wsx-label { font-size: 0.8rem; font-weight: 600; color: #374151; }
#ws-root .wsx-label em { color: #dc2626; font-style: normal; margin-left: 2px; }
#ws-root .wsx-input,
#ws-root .wsx-field select,
#ws-root .wsx-field trix-editor {
    width: 100%; min-height: 2.75rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.92rem; color: #1f2937;
    background: #fff;
    border: 1px solid #dfe3ea; border-radius: min(var(--wsx-radius, 10px), 10px);
    transition: border-color .15s, box-shadow .15s;
}
#ws-root .wsx-input::placeholder { color: #9ca3af; }
#ws-root .wsx-input:focus,
#ws-root .wsx-field select:focus,
#ws-root .wsx-field trix-editor:focus {
    outline: none; border-color: var(--ws-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ws-primary) 22%, transparent);
}
#ws-root .wsx-field trix-editor { min-height: 9rem; }
#ws-root .wsx-field trix-toolbar { margin-bottom: 0.4rem; }
#ws-root .wsx-field trix-toolbar .trix-button-group--file-tools { display: none; }
#ws-root .wsx-field input[type=file].wsx-input { padding: 0.4rem; cursor: pointer; }
#ws-root .wsx-field input[type=file].wsx-input::file-selector-button {
    margin-right: 0.75rem; padding: 0.4rem 0.8rem; border: 0; border-radius: 6px; cursor: pointer;
    font-size: 0.78rem; font-weight: 600;
    color: var(--ws-primary);
    background: color-mix(in srgb, var(--ws-primary) 12%, #fff);
}
#ws-root .wsx-hint { font-size: 0.72rem; color: #9ca3af; }

/* invalid field + its message */
#ws-root .wsx-field [aria-invalid="true"],
#ws-root .wsx-field [aria-invalid="true"] + .select2 .select2-selection { border-color: #dc2626 !important; }
#ws-root .wsx-field [aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgb(220 38 38 / 0.18); }
#ws-root .wsx-field.is-invalid trix-editor { border-color: #dc2626; }
#ws-root .wsx-err {
    display: flex; align-items: center; gap: 0.3rem; margin: 0;
    font-size: 0.75rem; font-weight: 500; color: #dc2626;
}
#ws-root .wsx-err::before { content: '!'; display: inline-grid; place-items: center; width: 0.95rem; height: 0.95rem; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.62rem; font-weight: 800; flex-shrink: 0; }

/* ── Buttons / alerts / done state ───────────────────────────────────── */
#ws-root .wsx-btn {
    width: 100%; min-height: 2.9rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    border: 0; border-radius: min(var(--wsx-radius, 10px), 10px); cursor: pointer;
    font-size: 0.95rem; font-weight: 700; color: #fff;
    background: linear-gradient(120deg, var(--ws-primary), var(--ws-accent));
    box-shadow: 0 10px 22px -12px var(--ws-primary);
    transition: filter .15s, transform .15s;
}
#ws-root .wsx-btn:hover { filter: brightness(1.06); }
#ws-root .wsx-btn:active { transform: translateY(1px); }
#ws-root .wsx-btn:disabled { opacity: .6; cursor: progress; }
#ws-root .wsx-spin { width: 1rem; height: 1rem; animation: wsx-spin .8s linear infinite; }
@keyframes wsx-spin { to { transform: rotate(360deg); } }
#ws-root .wsx-alert {
    margin-bottom: 1rem; padding: 0.7rem 0.9rem; border-radius: 8px;
    font-size: 0.82rem; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca;
}
#ws-root .wsx-done { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 2rem 0.5rem; }
#ws-root .wsx-done__icon {
    width: 3.5rem; height: 3.5rem; margin-bottom: 0.8rem;
    display: flex; align-items: center; justify-content: center; border-radius: 999px;
    color: #fff; background: linear-gradient(135deg, var(--ws-primary), var(--ws-accent));
}
#ws-root .wsx-done__title { margin: 0 0 0.25rem; font-weight: 700; color: #111827; }
#ws-root .wsx-done__text { margin: 0; font-size: 0.88rem; color: #6b7280; }
#ws-root .wsx-chip {
    margin-top: 0.75rem; padding: 0.35rem 0.8rem; border-radius: 999px;
    font-size: 0.78rem; font-weight: 700;
    color: var(--ws-primary); background: color-mix(in srgb, var(--ws-primary) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--ws-primary) 30%, #fff);
}
#ws-root .wsx-link { margin-top: 1rem; border: 0; background: none; cursor: pointer; font-size: 0.8rem; font-weight: 700; color: var(--ws-primary); text-decoration: underline; }

/* ── Contact details list ────────────────────────────────────────────── */
#ws-root .wsx-contacts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 2rem; }
@media (max-width: 600px) { #ws-root .wsx-contacts { grid-template-columns: minmax(0, 1fr); } }
#ws-root .wsx-contacts__col { display: grid; gap: 0.6rem; align-content: start; }
#ws-root .wsx-contact { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.88rem; color: #374151; word-break: break-word; }
#ws-root .wsx-contact svg { width: 1rem; height: 1rem; margin-top: 0.15rem; flex-shrink: 0; color: var(--ws-primary); }
#ws-root .wsx-contact a { color: inherit; text-decoration: none; }
#ws-root .wsx-contact a:hover { color: var(--ws-primary); }
#ws-root .wsx-contact small { color: #9ca3af; }
#ws-root .wsx-social { display: flex; gap: 0.5rem; padding-top: 0.2rem; }
#ws-root .wsx-social a { width: 1.9rem; height: 1.9rem; display: flex; align-items: center; justify-content: center; border-radius: 999px; color: #fff; }
#ws-root .wsx-social a:hover { opacity: .85; }

/* ── Dark theme ──────────────────────────────────────────────────────── */
#ws-root.ws-dark .wsx-modal__box { background: #111827; color: #e5e7eb; box-shadow: 0 30px 80px -20px #000, 0 0 0 1px #1f2937; }
#ws-root.ws-dark .wsx-modal__head,
#ws-root.ws-dark .wsx-section + .wsx-section { border-color: #1f2937; }
#ws-root.ws-dark .wsx-modal__title,
#ws-root.ws-dark .wsx-done__title { color: #f9fafb; }
#ws-root.ws-dark .wsx-modal__sub,
#ws-root.ws-dark .wsx-done__text { color: #9ca3af; }
#ws-root.ws-dark .wsx-modal__close:hover { background: #1f2937; color: #e5e7eb; }
#ws-root.ws-dark .wsx-label,
#ws-root.ws-dark .wsx-contact { color: #d1d5db; }
#ws-root.ws-dark .wsx-input,
#ws-root.ws-dark .wsx-field select,
#ws-root.ws-dark .wsx-field trix-editor { background: #0b1220; color: #e5e7eb; border-color: #334155; color-scheme: dark; }
/* dark toolbar: dark groups + inverted icons (layouts/app.blade.php "Trix dark"); the old light-grey buttons glared */
#ws-root.ws-dark .wsx-field trix-toolbar .trix-button:not(.trix-active):not(:hover) { background: transparent; }
#ws-root.ws-dark .wsx-alert { background: #3b0d0d; color: #fecaca; border-color: #7f1d1d; }
#ws-root.ws-dark .wsx-err { color: #f87171; }
