/* ==========================================
   Confirm Modal — shared component
   Used wherever the site previously fell back
   to window.confirm(). Mirrors review-modal
   visuals so dialogs feel coherent.
   ========================================== */

.cm-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 14, 26, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: cmFadeIn 0.18s ease-out;
}
[data-theme="light"] .cm-modal { background: rgba(15, 23, 42, 0.45); }
.cm-modal.open { display: flex; }

@keyframes cmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cmSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cm-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-2xl);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), var(--glass-shadow);
    color: var(--text-primary);
    padding: 26px 24px 20px;
    text-align: center;
    animation: cmSlideIn 0.22s var(--ease-out);
}
[data-theme="light"] .cm-card {
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
}

.cm-icon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue-500, #3b82f6);
    margin: 0 auto 14px;
}
.cm-icon-slot .material-symbols-outlined {
    font-size: 30px;
    font-variation-settings: 'FILL' 1, 'wght' 600;
}
.cm-modal[data-tone="danger"] .cm-icon-slot {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.cm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
    line-height: 1.3;
}
.cm-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 20px;
}

.cm-actions {
    display: flex;
    gap: 10px;
    justify-content: stretch;
}
.cm-btn {
    flex: 1;
    appearance: none;
    border: none;
    border-radius: var(--radius-lg, 12px);
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}
.cm-btn:active { transform: scale(0.98); }
.cm-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cm-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.cm-btn-secondary:hover { background: var(--bg-quaternary, var(--bg-tertiary)); }

.cm-btn-primary {
    background: var(--blue-500, #3b82f6);
    color: #ffffff;
}
.cm-btn-primary:hover { background: var(--blue-600, #2563eb); }

.cm-modal[data-tone="danger"] .cm-btn-primary {
    background: #ef4444;
}
.cm-modal[data-tone="danger"] .cm-btn-primary:hover {
    background: #dc2626;
}

/* Toast (lightweight, lives at body root) */
.cm-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(8px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full, 999px);
    padding: 10px 18px;
    font-size: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: calc(100vw - 40px);
    text-align: center;
}
.cm-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.cm-toast.is-success {
    border-color: rgba(16, 185, 129, 0.45);
    color: var(--accent-green, #10b981);
}
.cm-toast.is-error {
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

/* Mobile sheet variant */
@media (max-width: 480px) {
    .cm-modal { padding: 0; align-items: flex-end; }
    .cm-card {
        max-width: none;
        border-radius: 1.25rem 1.25rem 0 0;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        animation: cmSlideUp 0.22s var(--ease-out);
    }
    @keyframes cmSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    .cm-actions { flex-direction: column-reverse; }
    .cm-btn { width: 100%; }
}
