/* MIP Alert — toasts plats (couleurs vectorielles, sans effets) */

.mip-alert-toast-stack {
    position: fixed;
    inset-inline-end: 16px;
    bottom: 16px;
    z-index: 10050;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: min(480px, calc(100vw - 32px));
    pointer-events: none;
}

.mip-alert-toast {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    border-inline-start-width: 4px;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mip-alert-toast--in {
    opacity: 1;
    transform: translateY(0);
}

.mip-alert-toast--out {
    opacity: 0;
    transform: translateY(6px);
}

.mip-alert-toast--success {
    background: #ecfdf5;
    border-color: #86efac;
    border-inline-start-color: #16a34a;
}

.mip-alert-toast--error {
    background: #fef2f2;
    border-color: #fecaca;
    border-inline-start-color: #dc2626;
}

.mip-alert-toast--warning {
    background: #fff7ed;
    border-color: #fed7aa;
    border-inline-start-color: #ea580c;
}

.mip-alert-toast--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-inline-start-color: #2563eb;
}

.mip-alert-toast__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mip-alert-toast--success .mip-alert-toast__icon { color: #16a34a; }
.mip-alert-toast--error .mip-alert-toast__icon { color: #dc2626; }
.mip-alert-toast--warning .mip-alert-toast__icon { color: #ea580c; }
.mip-alert-toast--info .mip-alert-toast__icon { color: #2563eb; }

.mip-alert-toast__body {
    min-width: 0;
}

.mip-alert-toast__msg {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.mip-alert-toast--success .mip-alert-toast__msg { color: #166534; }
.mip-alert-toast--error .mip-alert-toast__msg { color: #991b1b; }
.mip-alert-toast--warning .mip-alert-toast__msg { color: #9a3412; }
.mip-alert-toast--info .mip-alert-toast__msg { color: #1e40af; }

.mip-alert-toast__close {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}

.mip-alert-toast__close:hover {
    color: #334155;
    background: rgba(15, 23, 42, 0.06);
}

html[data-theme='dark'] .mip-alert-toast,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast {
    border-color: #334155;
}

html[data-theme='dark'] .mip-alert-toast--success,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast--success {
    background: #052e16;
    border-inline-start-color: #22c55e;
}

html[data-theme='dark'] .mip-alert-toast--error,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast--error {
    background: #450a0a;
    border-inline-start-color: #ef4444;
}

html[data-theme='dark'] .mip-alert-toast--warning,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast--warning {
    background: #431407;
    border-inline-start-color: #f97316;
}

html[data-theme='dark'] .mip-alert-toast--success .mip-alert-toast__msg,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast--success .mip-alert-toast__msg { color: #bbf7d0; }

html[data-theme='dark'] .mip-alert-toast--error .mip-alert-toast__msg,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast--error .mip-alert-toast__msg { color: #fecaca; }

html[data-theme='dark'] .mip-alert-toast--warning .mip-alert-toast__msg,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-toast--warning .mip-alert-toast__msg { color: #fed7aa; }

/* Overlay modales */
.mip-alert-overlay {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.mip-alert-overlay.is-open {
    opacity: 1;
}

.mip-alert-overlay[hidden] {
    display: none !important;
}

body.mip-alert-scroll-lock {
    overflow: hidden;
}

.mip-alert-dialog {
    width: min(540px, 100%);
    animation: mipAlertDialogIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes mipAlertDialogIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mip-alert-dialog__card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px 26px;
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 24px 64px rgba(15, 23, 42, 0.18);
    border: 2px solid rgba(15, 23, 42, 0.06);
    text-align: center;
}

.mip-alert-dialog__card--success {
    border-color: rgba(16, 185, 129, 0.45);
    border-top: 4px solid #10b981;
}

.mip-alert-dialog__card--error {
    border-color: rgba(239, 68, 68, 0.45);
    border-top: 4px solid #ef4444;
}

.mip-alert-dialog__card--warning {
    border-color: rgba(245, 158, 11, 0.5);
    border-top: 4px solid #f59e0b;
}

.mip-alert-dialog__card--info {
    border-color: rgba(59, 130, 246, 0.4);
    border-top: 4px solid #3b82f6;
}

html[data-theme='dark'] .mip-alert-dialog__card,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

html[data-theme='dark'] .mip-alert-dialog__card--success,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card--success {
    border-color: rgba(52, 211, 153, 0.4);
    border-top-color: #34d399;
}

html[data-theme='dark'] .mip-alert-dialog__card--error,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card--error {
    border-color: rgba(248, 113, 113, 0.4);
    border-top-color: #f87171;
}

html[data-theme='dark'] .mip-alert-dialog__card--warning,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card--warning {
    border-color: rgba(251, 191, 36, 0.42);
    border-top-color: #fbbf24;
}

.mip-alert-dialog__icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.mip-alert-dialog__icon svg {
    width: 34px;
    height: 34px;
}

.mip-alert-dialog__icon--success { background: rgba(16, 185, 129, 0.2); color: #059669; }
.mip-alert-dialog__icon--error { background: rgba(239, 68, 68, 0.2); color: #dc2626; }
.mip-alert-dialog__icon--warning { background: rgba(245, 158, 11, 0.24); color: #d97706; }
.mip-alert-dialog__icon--info { background: rgba(59, 130, 246, 0.18); color: #2563eb; }

.mip-alert-dialog__title {
    margin: 0 0 10px;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.35;
}

.mip-alert-dialog__title--empty {
    display: none;
}

.mip-alert-dialog__message {
    margin: 0 0 26px;
    font-size: 1.2rem;
    line-height: 1.6;
    font-weight: 600;
    word-break: break-word;
}

.mip-alert-dialog__card--success .mip-alert-dialog__message { color: #047857; }
.mip-alert-dialog__card--error .mip-alert-dialog__message { color: #b91c1c; }
.mip-alert-dialog__card--warning .mip-alert-dialog__message { color: #b45309; }
.mip-alert-dialog__card--info .mip-alert-dialog__message { color: #1e40af; }

html[data-theme='dark'] .mip-alert-dialog__message,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__message {
    color: #cbd5e1;
}

html[data-theme='dark'] .mip-alert-dialog__card--success .mip-alert-dialog__message,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card--success .mip-alert-dialog__message { color: #6ee7b7; }

html[data-theme='dark'] .mip-alert-dialog__card--error .mip-alert-dialog__message,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card--error .mip-alert-dialog__message { color: #fca5a5; }

html[data-theme='dark'] .mip-alert-dialog__card--warning .mip-alert-dialog__message,
body.mip-pharm-theme:not([data-theme='light']) .mip-alert-dialog__card--warning .mip-alert-dialog__message { color: #fcd34d; }

.mip-alert-dialog__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.mip-alert-btn {
    min-width: 120px;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.mip-alert-btn:active {
    transform: scale(0.98);
}

.mip-alert-btn--ghost {
    background: transparent;
    border-color: rgba(15, 23, 42, 0.12);
    color: inherit;
}

.mip-alert-btn--ghost:hover {
    background: rgba(15, 23, 42, 0.04);
}

.mip-alert-btn--primary {
    color: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.mip-alert-btn--success {
    background: #10b981;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.mip-alert-btn--success:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.mip-alert-btn--error {
    background: #ef4444;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.mip-alert-btn--error:hover {
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
}

.mip-alert-btn--warning {
    background: #f59e0b;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

.mip-alert-btn--warning:hover {
    background: #d97706;
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.45);
}

.mip-alert-btn--info {
    background: #3b82f6;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.mip-alert-btn--info:hover {
    background: #2563eb;
}

/* rétrocompat : primary sans variante = vert succès */
.mip-alert-btn--primary:not(.mip-alert-btn--success):not(.mip-alert-btn--error):not(.mip-alert-btn--warning):not(.mip-alert-btn--info) {
    background: #10b981;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.mip-alert-btn--primary:not(.mip-alert-btn--success):not(.mip-alert-btn--error):not(.mip-alert-btn--warning):not(.mip-alert-btn--info):hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.mip-alert-btn--full {
    min-width: 140px;
}

/* Zone drag-and-drop logo */
.mip-logo-dropzone {
    position: relative;
    border: 2px dashed #94a3b8;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.mip-logo-dropzone:hover,
.mip-logo-dropzone.is-dragover {
    border-color: #0d9488;
    background: #ecfdf5;
}

.mip-logo-dropzone.is-uploading {
    pointer-events: none;
    opacity: 0.92;
}

.mip-logo-dropzone__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.mip-logo-dropzone--compact {
    padding: 12px 10px;
    border-radius: 10px;
    min-height: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.mip-logo-dropzone--inline {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    min-height: 0;
    border-radius: 8px;
    text-align: start;
    background: #f8fafc;
}

.mip-logo-dropzone--inline .mip-logo-dropzone__icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    margin: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.12);
}

.mip-logo-dropzone--inline .mip-logo-dropzone__copy {
    flex: 1 1 auto;
    min-width: 0;
}

.mip-logo-dropzone--inline .mip-logo-dropzone__text {
    margin: 0 0 2px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
}

.mip-logo-dropzone--inline .mip-logo-dropzone__sub {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-muted, #64748b);
}

.mip-logo-dropzone__status {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0d9488;
}

.mip-logo-dropzone__status[hidden] {
    display: none !important;
}

.mip-logo-dropzone__status:not([hidden]) {
    display: flex;
}

.mip-logo-dropzone--inline .mip-logo-dropzone__status {
    position: absolute;
    inset: 0;
    margin: 0;
    gap: 8px;
    background: #ecfdf5;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.mip-logo-dropzone.is-uploading .mip-logo-dropzone__status:not([hidden]) {
    display: flex !important;
}

.mip-logo-dropzone.is-uploading .mip-logo-dropzone__copy,
.mip-logo-dropzone.is-uploading .mip-logo-dropzone__icon {
    visibility: hidden;
}

.mip-logo-dropzone--inline {
    position: relative;
}

.mip-logo-dropzone--compact .mip-logo-dropzone__icon {
    font-size: 1.35rem;
    margin-bottom: 6px;
}

.mip-logo-dropzone--compact .mip-logo-dropzone__text {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
}

.mip-logo-dropzone--compact .mip-logo-dropzone__status {
    margin-top: 8px;
    font-size: 0.8125rem;
}

.mip-logo-dropzone__icon {
    font-size: 2rem;
    color: #0d9488;
    margin-bottom: 10px;
    line-height: 1;
}

.mip-logo-dropzone__text {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.975rem;
    color: inherit;
}

.mip-logo-dropzone__sub {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted, #64748b);
    line-height: 1.45;
}

.mip-logo-dropzone__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(13, 148, 136, 0.25);
    border-top-color: #0d9488;
    border-radius: 50%;
    animation: mipLogoSpin 0.7s linear infinite;
}

@keyframes mipLogoSpin {
    to { transform: rotate(360deg); }
}

.mip-logo-dropzone.is-done {
    border-color: #16a34a;
    background: #ecfdf5;
}

.mip-logo-dropzone.is-error {
    border-color: #dc2626;
    background: #fef2f2;
}
