/**
 * Unified confirmation / alert dialogs (owner, admin, super admin).
 * Matches the dark "Unsaved Changes" panel style.
 */
.modal-overlay,
.appd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 12000;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    overflow-y: auto;
    box-sizing: border-box;
}

.modal-overlay.active,
.appd-overlay.appd-open {
    opacity: 1;
    visibility: visible;
}

.confirm-modal,
.appd-sheet,
.modal-overlay > .modal-content.app-confirm-panel,
#confirmModal > .modal-content.app-confirm-panel,
#addConfirmModal > .modal-content.app-confirm-panel {
    background: var(--bg-card, #1a1d23);
    border: 1px solid var(--border, #2d3748);
    padding: 1.75rem 2rem;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    transform: scale(0.96);
    transition: transform 0.25s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    text-align: left;
}

.modal-overlay.active .confirm-modal,
.modal-overlay.active .app-confirm-panel,
.appd-overlay.appd-open .appd-sheet {
    transform: scale(1);
}

.confirm-modal h2,
.confirm-modal h3,
.appd-sheet h3,
.app-confirm-panel h2,
.app-confirm-panel h3,
#confirmModal .modal-content h2,
#addConfirmModal .modal-content h2 {
    margin: 0 0 0.85rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-title-color, var(--text-main, #ffffff));
    line-height: 1.3;
}

.confirm-modal p,
.appd-sheet p,
.app-confirm-panel p,
#confirmModal .modal-content > p,
#addConfirmModal .modal-content > p {
    color: var(--text-muted, #9ca3af);
    margin: 0 0 1.5rem;
    line-height: 1.5;
    font-size: 1rem;
}

.modal-buttons,
.appd-actions,
.modal-footer.app-confirm-footer,
.modal-actions.app-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.modal-buttons .btn,
.appd-actions .appd-btn,
.modal-footer.app-confirm-footer .btn,
.modal-actions.app-confirm-actions .btn {
    min-width: 7rem;
    padding: 0.65rem 1.35rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.modal-buttons .btn-outline,
.appd-btn-ghost,
.modal-footer .btn-outline {
    background: transparent;
    border: 1px solid var(--border, #374151);
    color: var(--text-main, #ffffff);
}

.modal-buttons .btn-outline:hover,
.appd-btn-ghost:hover {
    background: color-mix(in srgb, var(--text-main, #ffffff) 8%, transparent);
}

.modal-buttons .btn-primary,
.appd-btn-primary {
    background: var(--primary-color, #C62828);
    border: 1px solid var(--primary-color, #C62828);
    color: #0b0e14;
}

.modal-buttons .btn-primary:hover,
.appd-btn-primary:hover {
    background: var(--primary-hover, #e8c547);
    border-color: var(--primary-hover, #e8c547);
}

.modal-buttons .btn-danger,
.appd-btn-danger {
    background: #4c1d1d;
    border: 1px solid #4c1d1d;
    color: #f87171;
}

.modal-buttons .btn-danger:hover,
.appd-btn-danger:hover {
    background: #5c2424;
    border-color: #5c2424;
}

/* Legacy centered confirm blocks — align with unified panel */
#confirmModal .modal-content:not(.app-confirm-panel),
#addConfirmModal .modal-content:not(.app-confirm-panel) {
    text-align: left;
}

#confirmModal .modal-content h2,
#addConfirmModal .modal-content h2 {
    color: #ffffff;
}

#confirmModal .modal-footer,
#addConfirmModal .modal-footer {
    justify-content: flex-end;
    border-top: none;
    padding: 0;
}

@media (max-width: 480px) {
    .confirm-modal,
    .appd-sheet,
    .app-confirm-panel {
        padding: 1.35rem 1.25rem;
        border-radius: 16px;
    }

    .modal-buttons,
    .appd-actions,
    .modal-footer.app-confirm-footer,
    .modal-actions.app-confirm-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .modal-buttons .btn,
    .appd-actions .appd-btn {
        width: 100%;
        min-width: 0;
    }
}

/* Empty table rows on mobile card layouts */
@media (max-width: 768px) {
    tr.table-empty-row td {
        display: block !important;
        width: 100% !important;
        padding: 1.25rem 1rem !important;
        text-align: center !important;
        color: var(--text-muted, #a0a0a0) !important;
        border-bottom: none !important;
        min-height: 0 !important;
    }

    tr.table-empty-row td::before {
        display: none !important;
        content: none !important;
    }
}
