/*
 * Modern skin for the personal (Individual) side's dialogs:
 *   - Bootstrap 3 modals (.modal), used by include/modal, include/user_modal and page modals
 *   - SweetAlert 2.1 (swal) alerts and confirms
 * Loaded from include/html after Bootstrap, so it restyles every existing dialog in place
 * without changing any markup or script.
 */

:root {
    --ps-m-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --ps-m-text: #0f172a;
    --ps-m-text-2: #334155;
    --ps-m-muted: #64748b;
    --ps-m-border: #e6eaf2;
    --ps-m-border-strong: #d7dde8;
    --ps-m-primary: #2563eb;
    --ps-m-primary-600: #1d4ed8;
    --ps-m-danger: #dc2626;
    --ps-m-scrim: rgba(15, 23, 42, .45);
    --ps-m-ease-out: cubic-bezier(.23, 1, .32, 1);
}

/* ───────────── Bootstrap 3 modals ───────────── */

.modal-backdrop { background-color: #0f172a; }
.modal-backdrop.in { opacity: .45; }
.modal-open .modal { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

.modal.fade .modal-dialog {
    opacity: 0;
    -webkit-transform: translateY(10px) scale(.97);
    transform: translateY(10px) scale(.97);
    transition: opacity .2s ease-out, transform .26s var(--ps-m-ease-out);
}
.modal.in .modal-dialog { opacity: 1; -webkit-transform: none; transform: none; }

/* Bootstrap 3 has no centred dialog; several modals already ask for one */
.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 20px); }
.modal-dialog-centered > .modal-content { width: 100%; }
@media (min-width: 768px) { .modal-dialog-centered { min-height: calc(100% - 60px); } }

.modal-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .06);
    font-family: var(--ps-m-font);
    color: var(--ps-m-text-2);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
.modal-header { padding: 22px 24px 12px; border-bottom: 0; }
.modal-header:empty { padding: 10px 24px 0; }
.modal-title,
.modal-content h1, .modal-content h2, .modal-content h3, .modal-content h4, .modal-content h5 {
    font-family: var(--ps-m-font);
    color: var(--ps-m-text);
}
.modal-title { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.modal-content h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.modal-header .close {
    float: right;
    width: 32px; height: 32px;
    margin: -4px -8px 0 12px;
    border-radius: 9px;
    background: #f1f5f9;
    color: var(--ps-m-muted);
    font-size: 20px; font-weight: 400; line-height: 32px;
    text-shadow: none;
    opacity: 1;
    transition: background .15s, color .15s, transform .16s ease-out;
}
.modal-header .close:hover { background: #e2e8f0; color: var(--ps-m-text); opacity: 1; }
.modal-header .close:active { transform: scale(.94); }
.modal-body { padding: 8px 24px 22px; font-size: 14px; line-height: 1.55; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--ps-m-border);
    background: #fafbfd;
}
.modal-footer .btn + .btn { margin-left: 8px; }

.modal .btn {
    min-height: 40px;
    padding: 9px 18px;
    border-radius: 10px;
    font-family: var(--ps-m-font);
    font-size: 14px; font-weight: 600;
    box-shadow: none;
    transition: background-color .15s, border-color .15s, color .15s, transform .16s ease-out;
}
.modal .btn:active { transform: scale(.97); box-shadow: none; }
.modal .btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.modal .btn-primary { background: var(--ps-m-primary); border-color: var(--ps-m-primary); color: #fff; }
.modal .btn-primary:hover, .modal .btn-primary:focus { background: var(--ps-m-primary-600); border-color: var(--ps-m-primary-600); }
.modal .btn-default, .modal .btn-secondary { background: #fff; border: 1px solid var(--ps-m-border-strong); color: var(--ps-m-text-2); }
.modal .btn-default:hover, .modal .btn-secondary:hover { background: #f3f5f9; color: var(--ps-m-text); }
.modal .btn-danger { background: #fee2e2; border-color: #fee2e2; color: var(--ps-m-danger); }
.modal .btn-danger:hover { background: #fecaca; border-color: #fecaca; color: #b91c1c; }
.modal .btn-success { background: #15803d; border-color: #15803d; }

.modal label { font-size: 13px; font-weight: 600; color: var(--ps-m-text-2); margin-bottom: 6px; }
.modal .form-control {
    height: 42px;
    border: 1px solid var(--ps-m-border-strong);
    border-radius: 10px;
    box-shadow: none;
    font-family: var(--ps-m-font);
    font-size: 14px;
    color: var(--ps-m-text);
    transition: border-color .15s, box-shadow .15s;
}
.modal textarea.form-control { height: auto; min-height: 96px; }
.modal .form-control:focus { border-color: var(--ps-m-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.modal hr { border-top-color: var(--ps-m-border); }

/* Pieces used by the redesigned dialogs */
.ps-modal__sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ps-m-muted); }
.ps-modal__list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.ps-modal__list li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ps-m-text-2); }
.ps-modal__list i { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: #dcfce7; color: #15803d; }

.ps-choice { display: grid; gap: 10px; }
.ps-choice__item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--ps-m-border);
    border-radius: 14px;
    background: #fff;
    color: var(--ps-m-text-2) !important;
    text-decoration: none !important;
    transition: border-color .15s, background .15s, transform .16s ease-out;
}
.ps-choice__item:hover { border-color: #bfdbfe; background: #f8fbff; }
.ps-choice__item:active { transform: scale(.99); }
.ps-choice__icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    background: #eff6ff; color: var(--ps-m-primary);
}
.ps-choice__icon--violet { background: #ede9fe; color: #6d28d9; }
.ps-choice__text { flex: 1; min-width: 0; }
.ps-choice__text strong { display: block; font-size: 14.5px; font-weight: 650; color: var(--ps-m-text); }
.ps-choice__text span { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ps-m-muted); }
.ps-choice__chev { font-size: 12px; color: #94a3b8; transition: transform .16s ease-out; }
.ps-choice__item:hover .ps-choice__chev { transform: translateX(2px); color: var(--ps-m-primary); }

@media (max-width: 767px) {
    .modal-dialog { margin: 10px; }
    .modal-header { padding: 18px 18px 10px; }
    .modal-body { padding: 6px 18px 18px; }
    .modal-footer { padding: 12px 18px; }
}

/* ───────────── SweetAlert 2.1 ───────────── */

.swal-overlay { background-color: var(--ps-m-scrim); }
.swal-overlay--show-modal { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.swal-modal {
    width: 420px;
    max-width: calc(100% - 32px);
    padding-top: 6px;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .22);
    font-family: var(--ps-m-font);
    -webkit-font-smoothing: antialiased;
}
.swal-overlay--show-modal .swal-modal { animation: ps-swal-in .26s var(--ps-m-ease-out); }
@keyframes ps-swal-in {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to { opacity: 1; transform: none; }
}
.swal-icon { margin: 22px auto 6px; transform: scale(.8); }
.swal-icon:first-child { margin-top: 22px; }
.swal-title {
    padding: 8px 24px 0;
    font-size: 20px; font-weight: 650; letter-spacing: -.01em;
    color: var(--ps-m-text);
}
.swal-title:not(:last-child) { margin-bottom: 6px; }
.swal-text {
    display: block;
    padding: 0 24px;
    margin: 0 auto;
    text-align: center;
    font-size: 14.5px; line-height: 1.55;
    color: #475569;
}
.swal-footer {
    display: flex;
    flex-wrap: wrap-reverse;
    gap: 8px;
    margin-top: 18px;
    padding: 16px 24px 22px;
    border-top: 0;
    text-align: center;
}
.swal-button-container { flex: 1; margin: 0; }
.swal-button {
    width: 100%;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    background-color: var(--ps-m-primary);
    font-family: var(--ps-m-font);
    font-size: 14px; font-weight: 600;
    transition: background-color .15s, transform .16s ease-out;
}
.swal-button:not([disabled]):hover { background-color: var(--ps-m-primary-600); }
.swal-button:active { transform: scale(.97); background-color: var(--ps-m-primary-600); }
.swal-button:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, .3); }
.swal-button--cancel { background-color: #f1f5f9; color: var(--ps-m-text-2); }
.swal-button--cancel:not([disabled]):hover { background-color: #e2e8f0; }
.swal-button--cancel:focus { box-shadow: 0 0 0 3px rgba(100, 116, 139, .25); }
.swal-button--danger { background-color: var(--ps-m-danger); }
.swal-button--danger:not([disabled]):hover { background-color: #b91c1c; }
.swal-button--danger:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .25); }
.swal-content { padding: 0 24px; }
.swal-content__input, .swal-content__textarea {
    border: 1px solid var(--ps-m-border-strong);
    border-radius: 10px;
    font-family: var(--ps-m-font);
}
.swal-content__input:focus, .swal-content__textarea:focus { border-color: var(--ps-m-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

@media (prefers-reduced-motion: reduce) {
    .modal.fade .modal-dialog { transform: none; transition: opacity .15s linear; }
    .swal-overlay--show-modal .swal-modal { animation: none; }
}
