/* =====================================================================
   Confirm dialog — assets/js/confirm-dialog.js
   Small sheet: question title with a small icon, one short sentence,
   Keep (secondary) + action (solid red). No big circle, no white box
   in dark mode. Colours: cacaoflow-light.css (--cfl-*) / cacaoflow-dark.css (--cf-*).
   ===================================================================== */

.cf-confirm-backdrop {
    --cfc-surface: var(--cfl-surface, #FFFDF8);
    --cfc-line: var(--cfl-border-strong, #E0D4C0);
    --cfc-hover: var(--cfl-surface-3, #F4EEE2);
    --cfc-text: #3D1C02;
    --cfc-muted: #6F5A49;
    --cfc-red: #DC2626;
    --cfc-red-hover: #B91C1C;
    --cfc-gold: #C8861A;
    --cfc-shadow: 0 24px 60px -16px rgba(61, 28, 2, 0.35);

    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 12, 4, 0.45);
    animation: cf-confirm-fade 0.14s ease;
}

html[data-theme="dark"] .cf-confirm-backdrop {
    --cfc-surface: var(--cf-surface, #1A1A1C);
    --cfc-line: var(--cf-border, #2E2E33);
    --cfc-hover: rgba(255, 255, 255, 0.06);
    --cfc-text: var(--cf-text, #F2F0EC);
    --cfc-muted: #B9B4AC;
    --cfc-red: #DC2626;
    --cfc-red-hover: #EF4444;
    --cfc-gold: var(--cf-gold, #D9962C);
    --cfc-shadow: 0 24px 60px -14px rgba(0, 0, 0, 0.75);

    background: rgba(0, 0, 0, 0.6);
}

.cf-confirm {
    width: 100%;
    max-width: 440px;
    padding: 22px 22px 18px;
    background: var(--cfc-surface);
    border: 1px solid var(--cfc-line);
    border-radius: 14px;
    box-shadow: var(--cfc-shadow);
    color: var(--cfc-text);
    font-family: var(--cf-font, "Plus Jakarta Sans", system-ui, sans-serif);
    text-align: left;
    animation: cf-confirm-pop 0.16s ease;
}

.cf-confirm-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cf-confirm-icon {
    flex: 0 0 auto;
    margin-top: 4px;
    font-size: 15px;
    color: var(--cfc-gold);
}

.cf-confirm-icon.danger {
    color: var(--cfc-red);
}

html[data-theme="dark"] .cf-confirm-icon.danger {
    color: #F87171;
}

.cf-confirm-title {
    margin: 0;
    font-family: var(--cf-font, "Plus Jakarta Sans", system-ui, sans-serif);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--cfc-text);
    overflow-wrap: anywhere;
}

.cf-confirm-text {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cfc-muted);
}

.cf-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.cf-confirm-btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cf-confirm-keep {
    border: 1px solid var(--cfc-line);
    background: transparent;
    color: var(--cfc-text);
}

.cf-confirm-keep:hover {
    background: var(--cfc-hover);
}

.cf-confirm-action {
    border: 1px solid var(--cfc-gold);
    background: var(--cfc-gold);
    color: #FFFFFF;
}

.cf-confirm-action.danger {
    border-color: var(--cfc-red);
    background: var(--cfc-red);
    color: #FFFFFF;
}

.cf-confirm-action.danger:hover {
    border-color: var(--cfc-red-hover);
    background: var(--cfc-red-hover);
}

.cf-confirm-btn:focus-visible {
    outline: 2px solid var(--cfc-gold);
    outline-offset: 2px;
}

.cf-confirm-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Optional fields under the text (e.g. the reasons to discard a batch). */
.cf-confirm-content {
    margin-top: 14px;
}

.cf-confirm-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.cf-confirm-legend {
    margin-bottom: 8px;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--cfc-text);
}

.cf-confirm-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    margin-bottom: 6px;
    border: 1px solid var(--cfc-line);
    border-radius: 10px;
    font-size: 14px;
    color: var(--cfc-text);
    cursor: pointer;
}

.cf-confirm-choice:hover {
    background: var(--cfc-hover);
}

.cf-confirm-choice input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--cfc-gold);
}

.cf-confirm-choice:has(input:checked) {
    border-color: var(--cfc-gold);
}

.cf-confirm-choice:has(input:focus-visible) {
    outline: 2px solid var(--cfc-gold);
    outline-offset: 2px;
}

.cf-confirm-input {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid var(--cfc-line);
    border-radius: 10px;
    background: transparent;
    color: var(--cfc-text);
    font: inherit;
    font-size: 14px;
}

.cf-confirm-input:focus {
    outline: 2px solid var(--cfc-gold);
    outline-offset: 1px;
}

.cf-confirm-input[hidden] {
    display: none;
}

.cf-confirm-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--cfc-muted);
}

.cf-confirm-hint[hidden] {
    display: none;
}

/* The pages' old logout modal is only a hook now (confirm-dialog.js). */
#logout-modal[data-cf-bridged] {
    display: none !important;
}

@media (max-width: 480px) {
    .cf-confirm-actions {
        flex-direction: column-reverse;
    }

    .cf-confirm-btn {
        width: 100%;
        min-height: 44px;
    }
}

@keyframes cf-confirm-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cf-confirm-pop {
    from { transform: translateY(6px) scale(0.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .cf-confirm-backdrop,
    .cf-confirm {
        animation: none;
    }
}
