/* SwebFlow — App CSS (styles personnalisés, tailwind.css chargé séparément) */
@import url('/assets/css/inter.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Inter', system-ui, sans-serif; max-width: 100vw; overflow-x: hidden; }


input.iti__tel-input { padding-right: 0 !important; }

.nav-link        { color: #6b7280; transition: color .15s; }
.nav-link:hover  { color: #111827; }
.nav-link.active { color: #111827; font-weight: 500; }

.mobile-nav-link        { display: block; padding: .625rem 0; font-size: .875rem; color: #4b5563; transition: color .15s; }
.mobile-nav-link:hover  { color: #111827; }
.mobile-nav-link.active { color: #111827; font-weight: 500; }
.iti:has(.iti__tel-input) { width: 100%; }

@media (max-width: 640px) {
    form .grid.grid-cols-2 { grid-template-columns: 1fr !important; }
}

/* ── Toggle switch ──────────────────────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .875rem 1rem;
    border-radius: .75rem;
    border: 1px solid #e5e7eb;
    transition: background .15s;
}
.toggle-row:not(.toggle-row--locked):hover { background: #f9fafb; }
.toggle-switch { display: inline-flex; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 9999px;
    background: #d1d5db;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
    transition: background .2s ease;
}
.toggle-switch input:checked ~ .toggle-track { background: #2563eb; }
.toggle-switch input:focus-visible ~ .toggle-track { outline: 2px solid #93c5fd; outline-offset: 2px; }

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.22);
    transition: transform .2s ease;
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { transform: translateX(20px); }

/* Toggle always-on (obligatoire) */
.toggle-track--forced {
    background: #2563eb;
    opacity: .5;
    cursor: not-allowed;
}
.toggle-track--forced .toggle-thumb { transform: translateX(20px); }

/* Complète .truncate du build Tailwind (white-space manquant) */
.truncate { white-space: nowrap; }

/* ── Quill editor ───────────────────────────────────────────────────────────── */
.ql-toolbar.ql-snow,
.ql-container.ql-snow { margin-top: 0 !important; }

.ql-toolbar.ql-snow {
    margin-top: 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem 0.5rem 0 0 !important;
    background: #f9fafb !important;
    padding: 6px 8px !important;
}

.ql-container.ql-snow {
    border: 1px solid #e5e7eb !important;
    border-top: none !important;
    border-radius: 0 0 0.5rem 0.5rem !important;
    background: #fff !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 0.875rem !important;
}

.ql-editor { min-height: 120px !important; padding: 10px 12px !important; }

.ql-toolbar.ql-snow .ql-formats { margin-right: 8px !important; }

.ql-snow .ql-stroke { stroke: #6b7280 !important; }
.ql-snow .ql-fill  { fill:   #6b7280 !important; }
.ql-snow .ql-picker { color: #6b7280 !important; }

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke { stroke: #2563eb !important; }

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill { fill: #2563eb !important; }

.ql-snow.ql-toolbar button:hover,
.ql-snow .ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active,
.ql-snow .ql-toolbar button.ql-active {
    background: #eff6ff !important;
    border-radius: 0.25rem !important;
}

.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-label.ql-active { color: #2563eb !important; }

/* ── Search bar ───────────────────────────────────────────────────────────── */
.search-bar {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid #d1d5db;
    border-radius: .5rem;
    padding: .5rem .75rem;
    background: #fff;
    width: 16rem;
    transition: box-shadow .15s, border-color .15s;
}
.search-bar:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.search-bar svg { flex-shrink: 0; color: #9ca3af; }
.search-bar input { border: none; outline: none; background: transparent; font-size: .875rem; width: 100%; color: #111827; }
.search-bar input::placeholder { color: #9ca3af; }

/* ── Clickable rows ───────────────────────────────────────────────────────── */
tr[data-href] { cursor: pointer; }

/* ── Data tables ──────────────────────────────────────────────────────────── */
table thead th { padding-top: .875rem !important; padding-bottom: .875rem !important; }
table tbody td { padding-top: 1rem !important; padding-bottom: 1rem !important; }

/* ── Confirm modal ────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal-box { background: #fff; border-radius: .875rem; padding: 1.5rem; width: 100%; max-width: 22rem; box-shadow: 0 20px 40px rgba(0,0,0,.15); }
.modal-title { font-size: 1rem; font-weight: 600; color: #111827; margin-bottom: .375rem; }
.modal-msg { font-size: .875rem; color: #6b7280; margin-bottom: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .625rem; }
.modal-btn-cancel { padding: .5rem 1rem; border-radius: .5rem; font-size: .875rem; border: 1px solid #e5e7eb; background: #fff; color: #374151; cursor: pointer; transition: background .15s; }
.modal-btn-cancel:hover { background: #f9fafb; }
.modal-btn-ok { padding: .5rem 1rem; border-radius: .5rem; font-size: .875rem; font-weight: 500; background: #dc2626; color: #fff; border: none; cursor: pointer; transition: background .15s; }
.modal-btn-ok:hover { background: #b91c1c; }
.modal-btn-ok.modal-btn-blue { background: #2563eb; }
.modal-btn-ok.modal-btn-blue:hover { background: #1d4ed8; }

/* ── Bulk table select ────────────────────────────────────────────────────── */
.bulk-th, .bulk-cell { width: 2.5rem; min-width: 2.5rem; cursor: pointer; user-select: none; }
.bulk-check { display: flex; align-items: center; justify-content: center; }
.bulk-check-inner {
    width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #d1d5db; background: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, background .15s, opacity .15s; opacity: 0; flex-shrink: 0;
}
tr:hover .bulk-check-inner       { opacity: 1; border-color: #9ca3af; }
.bulk-th .bulk-check-inner        { opacity: 1; }
tr.is-bulk-selected .bulk-check-inner { opacity: 1; background: #2563eb; border-color: #2563eb; }
.bulk-th.bulk-th--all .bulk-check-inner  { background: #2563eb; border-color: #2563eb; }
.bulk-th.bulk-th--some .bulk-check-inner { background: #bfdbfe; border-color: #93c5fd; }
.bulk-check-mark, .bulk-dash-mark { display: none; color: #fff; width: 10px; height: 10px; flex-shrink: 0; }
tr.is-bulk-selected .bulk-check-mark    { display: block; }
.bulk-th.bulk-th--all  .bulk-check-mark { display: block; }
.bulk-th.bulk-th--some .bulk-dash-mark  { display: block; color: #2563eb; }

/* ── Table action bar (bulk) ──────────────────────────────────────────────── */
.table-action-bar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 10;
    display: flex; align-items: center; padding: 0 1.25rem 0 0;
    background: #eff6ff; border-bottom: 1px solid #bfdbfe;
}
.table-action-bar.hidden { display: none; }
.table-action-bar .bulk-check-inner { opacity: 1; background: #fff; }
.table-action-bar [data-bulk-action="deselect-all"] { background: none; border: none; padding: 0; }
.is-bulk-selected { background-color: #eff6ff !important; }
.is-bulk-selected:hover { background-color: #dbeafe !important; }

/* ── Inline field editor (detail pages) ──────────────────────────────────── */
.field-edit-btn { opacity: 0; transition: opacity .15s ease; display: inline-flex; align-items: center; align-self: center; }
.field-edit-btn.hidden { display: none; }
[data-field]:hover .field-edit-btn { opacity: 1; }
.field-display { display: inline-block; border-bottom: 3px solid transparent; padding: 4px 0 4px; }
.field-display.hidden { display: none; }
.field-editor input, .field-editor select, .field-editor textarea { background: transparent; border: none; outline: none; font-size: .875rem; color: #111827; padding: 4px 0 4px; min-width: 0; flex: 1; }
.field-editor input:focus, .field-editor select:focus, .field-editor textarea:focus { border-bottom: 2px solid #3b82f6; }
.field-editor select { cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; background-size: 1rem; padding-right: 1.5rem; }
.field-editor textarea { resize: vertical; width: 100%; }

/* ── Global select styling ──────────────────────────────────────────────── */
select:not(.field-editor select) {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem;
    padding-right: 2.5rem;
}
