/* ════════════════════════════════════════════════════════════
   STRATOS MODAL – stile Material Design 3 coerente con la home
   Uso: <div class="modal fade stratos-modal sec-attivita|sec-assistenza|sec-vendite|sec-anagrafiche|sec-utility">
   (senza sec-* usa il blu di default)
   ════════════════════════════════════════════════════════════ */

.stratos-modal {
    --sec-color: #1A73E8;
    --sec-soft: rgba(26, 115, 232, .10);
    --sec-grad: linear-gradient(145deg, #174EA6 0%, #1A73E8 100%);
}
.stratos-modal.sec-vendite    { --sec-color: #1A73E8; --sec-soft: rgba(26,115,232,.10); --sec-grad: linear-gradient(145deg, #174EA6 0%, #1A73E8 100%); }
.stratos-modal.sec-attivita   { --sec-color: #E37400; --sec-soft: rgba(249,171,0,.14);  --sec-grad: linear-gradient(145deg, #E37400 0%, #F9AB00 100%); }
.stratos-modal.sec-assistenza { --sec-color: #007B83; --sec-soft: rgba(18,181,203,.12); --sec-grad: linear-gradient(145deg, #007B83 0%, #12B5CB 100%); }
.stratos-modal.sec-anagrafiche{ --sec-color: #188038; --sec-soft: rgba(52,168,83,.12); --sec-grad: linear-gradient(145deg, #188038 0%, #34A853 100%); }
.stratos-modal.sec-utility    { --sec-color: #455A64; --sec-soft: rgba(96,125,139,.14); --sec-grad: linear-gradient(145deg, #37474F 0%, #607D8B 100%); }

/* ── Backdrop sfocato ── */
body:has(.stratos-modal.show) .modal-backdrop.show {
    background-color: #0f172a;
    opacity: .45;
    backdrop-filter: blur(4px);
}

/* ── Ingresso in fade + lieve risalita ── */
.stratos-modal.fade .modal-dialog {
    transform: translateY(18px) scale(.97);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
.stratos-modal.show .modal-dialog { transform: none; }
.stratos-modal.fade { transition: opacity .3s cubic-bezier(.4, 0, .2, 1); }

/* ── Contenitore ── */
.stratos-modal .modal-content,
.stratos-modal .modal-content.bg-light {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    background: #fff !important;
    box-shadow: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);
}

/* ── Header con gradiente di sezione ── */
.stratos-modal .modal-header {
    position: relative;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border: none;
    color: #fff;
    background: var(--sec-grad);
}
.stratos-modal .modal-header .modal-title,
.stratos-modal .modal-header .modal-title.text-dark {
    color: #fff !important;
    font-weight: 700;
    letter-spacing: .3px;
    line-height: 1.35;
}
.stratos-modal .modal-header .text-muted,
.stratos-modal .modal-header small {
    color: rgba(255, 255, 255, .75) !important;
    font-weight: 400;
    letter-spacing: 0;
}
.stratos-modal .modal-header .modal-title > .las:first-child,
.stratos-modal .modal-header .modal-title > .la:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 6px;
    border-radius: 12px;
    vertical-align: middle;
    font-size: 1.5rem !important;
    background: rgba(255, 255, 255, .18);
}
.stratos-modal .modal-header .modal-title svg { color: #fff; }

/* Pulsante chiudi circolare */
.stratos-modal .modal-header [data-bs-dismiss="modal"] {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    margin-left: auto;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 1.3rem;
    background: rgba(255, 255, 255, .18) !important;
    box-shadow: none !important;
    transition: background .2s ease, transform .2s ease;
}
.stratos-modal .modal-header [data-bs-dismiss="modal"]:hover,
.stratos-modal .modal-header [data-bs-dismiss="modal"]:focus {
    background: rgba(255, 255, 255, .32) !important;
    transform: rotate(90deg);
}
/* Variante Bootstrap .btn-close: mantiene l'icona X (SVG in background) resa bianca */
.stratos-modal .modal-header .btn-close[data-bs-dismiss="modal"],
.stratos-modal .modal-header .btn-close[data-bs-dismiss="modal"]:hover,
.stratos-modal .modal-header .btn-close[data-bs-dismiss="modal"]:focus {
    background: rgba(255, 255, 255, .18) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center / 14px auto no-repeat !important;
    opacity: 1;
    filter: none;
}
.stratos-modal .modal-header .btn-close[data-bs-dismiss="modal"]:hover {
    background-color: rgba(255, 255, 255, .32) !important;
}

/* ── Body: contenuti che entrano in sequenza ── */
.stratos-modal .modal-body { padding: 20px 24px; }

.stratos-modal.show .modal-body > * {
    /* fill "backwards": nessun transform residuo che rompa dropdown/z-index */
    animation: stratosModalItemIn .38s cubic-bezier(.4, 0, .2, 1) backwards;
    animation-delay: 90ms;
}
.stratos-modal.show .modal-body > *:nth-child(2) { animation-delay: 135ms; }
.stratos-modal.show .modal-body > *:nth-child(3) { animation-delay: 180ms; }
.stratos-modal.show .modal-body > *:nth-child(4) { animation-delay: 225ms; }
.stratos-modal.show .modal-body > *:nth-child(5) { animation-delay: 270ms; }
.stratos-modal.show .modal-body > *:nth-child(n+6) { animation-delay: 315ms; }

@keyframes stratosModalItemIn {
    from { opacity: 0; transform: translateY(10px); }
}

/* Campi del form con accento di sezione */
.stratos-modal .modal-body label { font-weight: 500; color: #3c4043; }
.stratos-modal .modal-body label > .las,
.stratos-modal .modal-body label > .la { color: var(--sec-color); }
.stratos-modal .form-control,
.stratos-modal .form-select { border-radius: 12px; }
.stratos-modal .form-control:focus,
.stratos-modal .form-select:focus {
    border-color: var(--sec-color);
    box-shadow: 0 0 0 3px var(--sec-soft);
}
.stratos-modal .list-group { border-radius: 16px; }
.stratos-modal .card { border-radius: 16px; }

/* ── Footer ── */
.stratos-modal .modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e8eaed;
    background: #f8f9fa;
}
.stratos-modal .modal-footer .btn,
.stratos-modal .modal-body .btn {
    border-radius: 12px;
    transition: transform .2s ease, box-shadow .2s ease;
}
.stratos-modal .modal-footer .btn:hover,
.stratos-modal .modal-body .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}

/* ── Tema scuro ── */
body.dark .stratos-modal .modal-content,
body.dark .stratos-modal .modal-content.bg-light { background: #0e1726 !important; }
body.dark .stratos-modal .modal-footer { background: #0b1220; border-top-color: #1b2e4b; }
body.dark .stratos-modal .modal-body label { color: #bfc9d4; }

@media (prefers-reduced-motion: reduce) {
    .stratos-modal.fade .modal-dialog,
    .stratos-modal.fade { transition: none; }
    .stratos-modal.show .modal-body > * { animation: none; }
}
