/* ==========================================
   MODAL DE CONFIRMAÇÃO MODERNO
   Design inspirado em: Linear, Notion, Vercel
   ========================================== */

/* Overlay com backdrop blur */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Modal container */
.modal-confirm {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px var(--border-color);
    max-width: 420px;
    width: calc(100% - 2rem);
    padding: 0;
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.05s forwards;
}

@keyframes modalIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal header */
.modal-confirm-header {
    padding: 1.75rem 1.75rem 1.25rem;
    text-align: center;
}

.modal-confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-confirm-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.1;
}

.modal-confirm-icon i {
    font-size: 1.75rem;
    color: #f59e0b;
}

.modal-confirm-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.modal-confirm-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Entity name highlight */
.modal-entity-name {
    color: var(--text-primary);
    font-weight: 600;
}

/* Modal body - info adicional */
.modal-confirm-body {
    padding: 0 1.75rem 1.5rem;
}

.modal-confirm-warning {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.modal-confirm-warning i {
    font-size: 1.125rem;
    color: #ef4444;
    flex-shrink: 0;
    margin-top: 2px;
}

.modal-confirm-warning-text {
    font-size: 0.875rem;
    color: #dc2626;
    line-height: 1.5;
    font-weight: 500;
}

/* Modal footer - actions */
.modal-confirm-footer {
    padding: 1.25rem 1.75rem 1.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.6875rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.modal-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Botão cancelar */
.modal-btn-cancel {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-btn-cancel:hover {
    background: var(--bg-surface-secondary);
    border-color: var(--border-color-light);
}

.modal-btn-cancel:active {
    transform: scale(0.98);
}

/* Botão confirmar (delete) */
.modal-btn-confirm {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow:
        0 2px 8px rgba(239, 68, 68, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

.modal-btn-confirm:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow:
        0 4px 12px rgba(239, 68, 68, 0.35),
        0 0 0 1px rgba(0, 0, 0, 0.1) inset;
    transform: translateY(-1px);
}

.modal-btn-confirm:active {
    transform: translateY(0);
}

.modal-btn-confirm i {
    font-size: 1rem;
}

/* Loading state */
.modal-btn.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.modal-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark mode adjustments */
body.dark-mode .modal-confirm {
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

body.dark-mode .modal-confirm-icon {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
}

body.dark-mode .modal-confirm-icon::before {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    opacity: 0.2;
}

body.dark-mode .modal-confirm-warning {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

/* Responsive */
@media (max-width: 576px) {
    .modal-confirm {
        max-width: calc(100% - 1rem);
        border-radius: 14px;
    }

    .modal-confirm-header {
        padding: 1.5rem 1.25rem 1rem;
    }

    .modal-confirm-body {
        padding: 0 1.25rem 1.25rem;
    }

    .modal-confirm-footer {
        padding: 1rem 1.25rem 1.5rem;
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-confirm-title {
        font-size: 1.125rem;
    }

    .modal-confirm-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }

    .modal-confirm-icon i {
        font-size: 1.5rem;
    }
}

/* Accessibility - prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-confirm {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .modal-btn {
        transition: none;
    }
}
