@charset "UTF-8";

/* ==========================================================================
   COMPONENTE — DIALOG MODAL (.ps-modal) ȘI NOTIFICĂRI (.ps-toast)
   --------------------------------------------------------------------------
   Sursă:  docs/design/DESIGN-SYSTEM.md §10.20  [PROPUS — construit din tokeni]
   Randate de: Views/Shared/_ConfirmDialog.cshtml
   Controlate de: wwwroot/js/components/dialog.js  (psDialog / psToast)

   Butoanele sunt stilizate local (.ps-modal__btn) ca să nu depindă de
   components/buttons.css; când acela există, clasele .ps-btn se pot adăuga
   peste, fără conflict.
   ========================================================================== */

/* ==========================================================================
   1. DIALOG
   ========================================================================== */

.ps-modal {
    width: min(600px, calc(100vw - var(--ps-space-40)));
    max-width: 600px;
    padding: 0;
    border: 0;
    border-radius: var(--ps-radius-panel);
    background: var(--ps-surface);
    color: var(--ps-text);
    box-shadow: var(--ps-shadow-modal);
    font-family: var(--ps-font-sans);
    z-index: var(--ps-z-modal);
}

.ps-modal::backdrop {
    background: rgb(var(--ps-rgb-umbra) / .38);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* varianta fără <dialog>.showModal() (motoare vechi): dialogul rămâne centrat */
.ps-modal:not([open]) { display: none; }

/* deschidere și închidere animate, unde browserul știe să tranziteze `display` */
@supports (transition-behavior: allow-discrete) {
    dialog.ps-modal {
        transition: opacity .2s var(--ps-ease), transform .28s var(--ps-ease-out),
                    display .28s allow-discrete, overlay .28s allow-discrete;
    }
    dialog.ps-modal:not([open]) { opacity: 0; transform: translateY(12px) scale(.98); }
    @starting-style {
        dialog.ps-modal[open] { opacity: 0; transform: translateY(12px) scale(.98); }
    }

    /* modalul deschis de pagină la încărcare apare direct, opac: cât scripturile paginii țin
       browserul ocupat, animația s-ar opri la jumătate și pagina s-ar vedea prin el */
    dialog.ps-modal[data-ps-modal-deschis] { transition: none; }
}

.ps-modal__form {
    display: flex;
    flex-direction: column;
    max-height: min(85vh, 720px);
}

/* --- antet --------------------------------------------------------------- */

.ps-modal__antet {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ps-space-15);
    padding: var(--ps-space-20) var(--ps-space-30);
    border-bottom: var(--ps-border-width) solid var(--ps-border-panel);
}

.ps-modal__titlu {
    margin: 0;
    font: var(--ps-type-h3);
    color: var(--ps-text);
}

.ps-modal__inchide {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: calc(var(--ps-space-10) * -1) calc(var(--ps-space-10) * -1) 0 0;
    border-radius: var(--ps-radius-control);
    color: var(--ps-icon-nav);
    background: transparent;
    cursor: pointer;
    transition: var(--ps-transition-color);
}

/* hover-ul roșu desenat în Figma pentru butonul de închidere */
.ps-modal__inchide:hover {
    background: var(--ps-c-red-600);
    color: var(--ps-text-inverse);
}
.ps-modal__inchide:active { background: var(--ps-c-red-400); }

/* --- corp ---------------------------------------------------------------- */

.ps-modal__corp {
    flex: 1 1 auto;
    padding: var(--ps-space-20) var(--ps-space-30);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ps-modal__mesaj {
    margin: 0;
    font: var(--ps-type-body);
    line-height: var(--ps-lh-body);
    color: var(--ps-text-ui);
    overflow-wrap: anywhere;
}

/* --- subsol -------------------------------------------------------------- */

.ps-modal__subsol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ps-space-20);
    padding: var(--ps-space-20) var(--ps-space-30);
    border-top: var(--ps-border-width) solid var(--ps-border-panel);
}

/* fără mesaj (doar titlul): corpul gol dispare și rămâne o singură linie, cea de sub titlu */
.ps-modal__corp:empty,
.ps-modal__corp:has(> .ps-modal__mesaj:empty:only-child) { display: none; }

.ps-modal__corp:empty + .ps-modal__subsol,
.ps-modal__corp:has(> .ps-modal__mesaj:empty:only-child) + .ps-modal__subsol { border-top: 0; }

.ps-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    min-height: var(--ps-control-h);
    padding: var(--ps-space-10) var(--ps-space-25);
    border: var(--ps-border-width) solid transparent;
    border-radius: var(--ps-radius-btn);
    font: var(--ps-type-btn-lg);
    cursor: pointer;
    transition: var(--ps-transition-color), var(--ps-transition-shadow);
}

.ps-modal__btn--principal {
    background: var(--ps-primary);
    color: var(--ps-primary-contrast);
}
.ps-modal__btn--principal:hover { background: var(--ps-primary-hover); }
.ps-modal__btn--principal:active { background: var(--ps-primary-active); }

.ps-modal__btn--secundar {
    background: var(--ps-surface);
    border-color: var(--ps-green-stroke);
    color: var(--ps-green-dark);
}
.ps-modal__btn--secundar:hover { background: var(--ps-primary-soft); }
.ps-modal__btn--secundar:active { background: var(--ps-primary-soft-hover); }

.ps-modal__btn[hidden] { display: none; }

/* acțiune distructivă: butonul principal devine roșu */
.ps-modal--distructiv .ps-modal__btn--principal { background: var(--ps-danger); }
.ps-modal--distructiv .ps-modal__btn--principal:hover { background: var(--ps-c-red-400); }

/* accente pe variante */
.ps-modal--succes  .ps-modal__titlu { color: var(--ps-success); }
.ps-modal--atentie .ps-modal__titlu { color: var(--ps-warning); }
.ps-modal--eroare  .ps-modal__titlu { color: var(--ps-danger); }

@media (max-width: 575.98px) {
    .ps-modal { width: calc(100vw - var(--ps-space-20)); }
    .ps-modal__antet,
    .ps-modal__corp,
    .ps-modal__subsol { padding-inline: var(--ps-space-20); }
    .ps-modal__subsol { flex-direction: column-reverse; align-items: stretch; gap: var(--ps-space-10); }
    .ps-modal__btn { width: 100%; }
}

/* ==========================================================================
   2. NOTIFICĂRI EFEMERE
   ========================================================================== */

.ps-toast-host {
    position: fixed;
    top: var(--ps-space-20);
    right: var(--ps-space-20);
    z-index: var(--ps-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--ps-space-10);
    width: min(380px, calc(100vw - var(--ps-space-40)));
    pointer-events: none;
}

.ps-toast-host__zona {
    display: flex;
    flex-direction: column;
    gap: var(--ps-space-10);
}

.ps-toast-host__zona:empty { display: none; }

.ps-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--ps-space-13);
    padding: var(--ps-space-13) var(--ps-space-15);
    border-left: 4px solid var(--ps-info);
    border-radius: var(--ps-radius-control);
    background: var(--ps-surface);
    box-shadow: var(--ps-shadow-float);
    font: var(--ps-type-body);
    color: var(--ps-text);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(calc(var(--ps-space-10) * -1));
    transition: opacity var(--ps-duration-slow) var(--ps-ease),
                transform var(--ps-duration-slow) var(--ps-ease);
}

.ps-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ps-toast__icon {
    flex: 0 0 var(--ps-icon-24);
    color: var(--ps-info);
}

.ps-toast__mesaj {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    line-height: var(--ps-lh-body);
    overflow-wrap: anywhere;
}

.ps-toast__inchide {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ps-icon-24);
    height: var(--ps-icon-24);
    border-radius: var(--ps-radius-3);
    color: var(--ps-text-faint-aa);
    background: transparent;
    cursor: pointer;
    transition: var(--ps-transition-color);
}

.ps-toast__inchide:hover {
    background: var(--ps-c-red-600);
    color: var(--ps-text-inverse);
}

.ps-toast--succes  { border-left-color: var(--ps-success); }
.ps-toast--succes  .ps-toast__icon { color: var(--ps-success); }
.ps-toast--info    { border-left-color: var(--ps-info); }
.ps-toast--info    .ps-toast__icon { color: var(--ps-info); }
.ps-toast--atentie { border-left-color: var(--ps-warning); }
.ps-toast--atentie .ps-toast__icon { color: var(--ps-warning); }
.ps-toast--eroare  { border-left-color: var(--ps-danger); }
.ps-toast--eroare  .ps-toast__icon { color: var(--ps-danger); }

@media (max-width: 575.98px) {
    .ps-toast-host {
        top: auto;
        bottom: var(--ps-space-10);
        left: var(--ps-space-10);
        right: var(--ps-space-10);
        width: auto;
    }
    .ps-toast { transform: translateY(var(--ps-space-10)); }
}

@media (prefers-reduced-motion: reduce) {
    .ps-toast { transform: none; }
}
