/* ==========================================================================
   CUSTOM ALERT / CONFIRMATION MODAL COMPONENT
   Theme-aware (Supports Light Mode & Dark Mode)
   ========================================================================== */

:root {
    --alert-overlay-bg: rgba(13, 27, 42, 0.45);
    --alert-card-bg: var(--surface, #ffffff);
    --alert-border: var(--border, #e4e7f0);
    --alert-title-color: var(--text, var(--ink, #1a1d2e));
    --alert-message-color: var(--text-sub, var(--ink-muted, #64748b));
    --alert-cancel-bg: var(--surface2, #f1f4f9);
    --alert-cancel-text: var(--text, #334155);
    --alert-cancel-border: var(--border, #e2e8f0);
    --alert-cancel-hover-bg: #e2e8f0;
    --alert-danger-bg: var(--danger, #ef4444);
    --alert-danger-hover: #dc2626;
    --alert-danger-shadow: rgba(239, 68, 68, 0.35);
    --alert-danger-shadow-hover: rgba(239, 68, 68, 0.48);
    --alert-warning-bg: var(--warning, #f59e0b);
    --alert-warning-hover: #d97706;
    --alert-warning-shadow: rgba(245, 158, 11, 0.35);
    --alert-warning-shadow-hover: rgba(245, 158, 11, 0.48);
    --alert-success-bg: var(--success, #10b981);
    --alert-success-hover: #059669;
    --alert-success-shadow: rgba(16, 185, 129, 0.35);
    --alert-success-shadow-hover: rgba(16, 185, 129, 0.48);
    --alert-primary-bg: var(--accent, #4f46e5);
    --alert-primary-hover: #4338ca;
    --alert-primary-shadow: rgba(79, 70, 229, 0.35);
    --alert-primary-shadow-hover: rgba(79, 70, 229, 0.48);
    --alert-info-bg: var(--accent3, #0ea5e9);
    --alert-info-hover: #0284c7;
    --alert-info-shadow: rgba(14, 165, 233, 0.35);
    --alert-info-shadow-hover: rgba(14, 165, 233, 0.48);
    --alert-card-shadow: 0 20px 48px -10px rgba(13, 27, 42, 0.16), 0 10px 24px -5px rgba(13, 27, 42, 0.08);
}

/* Dark Mode Overrides */
[data-theme="dark"],
body.dark-mode,
html.dark {
    --alert-overlay-bg: rgba(2, 6, 23, 0.72);
    --alert-card-bg: var(--surface, #181c27);
    --alert-border: var(--border, #2a2f45);
    --alert-title-color: var(--text, #f1f5f9);
    --alert-message-color: var(--text-sub, #94a3b8);
    --alert-cancel-bg: var(--surface2, #222838);
    --alert-cancel-text: #e2e8f0;
    --alert-cancel-border: var(--border, #2e364c);
    --alert-cancel-hover-bg: #2d364b;
    --alert-card-shadow: 0 24px 56px -12px rgba(0, 0, 0, 0.65), 0 8px 24px -4px rgba(0, 0, 0, 0.4);
}

/* Backdrop Overlay */
.custom-alert-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--alert-overlay-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-alert-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Modal Card */
.custom-alert-card {
    position: relative;
    background: var(--alert-card-bg);
    border: 1px solid var(--alert-border);
    border-radius: 26px;
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    box-shadow: var(--alert-card-shadow);
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.24s ease,
                background-color 0.25s ease,
                border-color 0.25s ease;
}

.custom-alert-overlay.is-open .custom-alert-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Icon Area */
.custom-alert-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.custom-alert-icon-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
}

.custom-alert-icon-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Icon Type Colors */
.custom-alert-icon-wrapper[data-alert-type="danger"] .custom-alert-icon-svg,
.custom-alert-icon-wrapper[data-alert-type="logout"] .custom-alert-icon-svg {
    color: var(--alert-danger-bg);
    filter: drop-shadow(0 8px 18px var(--alert-danger-shadow));
}

.custom-alert-icon-wrapper[data-alert-type="warning"] .custom-alert-icon-svg {
    color: var(--alert-warning-bg);
    filter: drop-shadow(0 8px 18px var(--alert-warning-shadow));
}

.custom-alert-icon-wrapper[data-alert-type="success"] .custom-alert-icon-svg {
    color: var(--alert-success-bg);
    filter: drop-shadow(0 8px 18px var(--alert-success-shadow));
}

.custom-alert-icon-wrapper[data-alert-type="primary"] .custom-alert-icon-svg {
    color: var(--alert-primary-bg);
    filter: drop-shadow(0 8px 18px var(--alert-primary-shadow));
}

.custom-alert-icon-wrapper[data-alert-type="info"] .custom-alert-icon-svg {
    color: var(--alert-info-bg);
    filter: drop-shadow(0 8px 18px var(--alert-info-shadow));
}

/* Typography */
.custom-alert-content {
    margin-bottom: 26px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

.custom-alert-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--alert-title-color);
    line-height: 1.35;
    margin: 0 0 10px 0;
    letter-spacing: -0.015em;
    font-family: inherit;
    transition: color 0.25s ease;
}

.custom-alert-message {
    font-size: 14.5px;
    font-weight: 400;
    color: var(--alert-message-color);
    line-height: 1.65;
    margin: 0;
    font-family: inherit;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    transition: color 0.25s ease;
}

/* Lighting / Glowing Highlight Badge */
.custom-alert-highlight {
    font-weight: 700;
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.22);
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    letter-spacing: -0.01em;
    transition: all 0.25s ease;
}

[data-theme="dark"] .custom-alert-highlight,
body.dark-mode .custom-alert-highlight,
html.dark .custom-alert-highlight {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
}

/* Primary / Blue Glowing Highlight */
.custom-alert-highlight-primary,
.custom-alert-card:has([data-alert-type="primary"]) .custom-alert-highlight {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.25);
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.28);
}

[data-theme="dark"] .custom-alert-highlight-primary,
[data-theme="dark"] .custom-alert-card:has([data-alert-type="primary"]) .custom-alert-highlight,
body.dark-mode .custom-alert-highlight-primary,
html.dark .custom-alert-highlight-primary {
    color: #a5b4fc;
    background: rgba(79, 70, 229, 0.22);
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 0 16px rgba(79, 70, 229, 0.5);
}

/* Success Glowing Highlight */
.custom-alert-highlight-success,
.custom-alert-card:has([data-alert-type="success"]) .custom-alert-highlight {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.28);
}

[data-theme="dark"] .custom-alert-highlight-success,
[data-theme="dark"] .custom-alert-card:has([data-alert-type="success"]) .custom-alert-highlight,
body.dark-mode .custom-alert-highlight-success,
html.dark .custom-alert-highlight-success {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}

/* Buttons Container */
.custom-alert-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.custom-alert-form {
    flex: 1;
    margin: 0;
    display: flex;
}

/* Base Button Style */
.custom-alert-btn {
    flex: 1;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}

.custom-alert-btn:active {
    transform: scale(0.97);
}

.custom-alert-btn:focus-visible {
    outline: 2px solid var(--alert-primary-bg);
    outline-offset: 2px;
}

/* Cancel / Secondary Button */
.custom-alert-btn-cancel {
    background: var(--alert-cancel-bg);
    color: var(--alert-cancel-text);
    border-color: var(--alert-cancel-border);
}

.custom-alert-btn-cancel:hover {
    background: var(--alert-cancel-hover-bg);
    transform: translateY(-1px);
}

/* Confirm Danger Button */
.custom-alert-btn-danger {
    background: var(--alert-danger-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--alert-danger-shadow);
}

.custom-alert-btn-danger:hover {
    background: var(--alert-danger-hover);
    box-shadow: 0 6px 20px var(--alert-danger-shadow-hover);
    transform: translateY(-1.5px);
}

/* Confirm Warning Button */
.custom-alert-btn-warning {
    background: var(--alert-warning-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--alert-warning-shadow);
}

.custom-alert-btn-warning:hover {
    background: var(--alert-warning-hover);
    box-shadow: 0 6px 20px var(--alert-warning-shadow-hover);
    transform: translateY(-1.5px);
}

/* Confirm Success Button */
.custom-alert-btn-success {
    background: var(--alert-success-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--alert-success-shadow);
}

.custom-alert-btn-success:hover {
    background: var(--alert-success-hover);
    box-shadow: 0 6px 20px var(--alert-success-shadow-hover);
    transform: translateY(-1.5px);
}

/* Confirm Primary Button */
.custom-alert-btn-primary {
    background: var(--alert-primary-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--alert-primary-shadow);
}

.custom-alert-btn-primary:hover {
    background: var(--alert-primary-hover);
    box-shadow: 0 6px 20px var(--alert-primary-shadow-hover);
    transform: translateY(-1.5px);
}

/* Confirm Info Button */
.custom-alert-btn-info {
    background: var(--alert-info-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--alert-info-shadow);
}

.custom-alert-btn-info:hover {
    background: var(--alert-info-hover);
    box-shadow: 0 6px 20px var(--alert-info-shadow-hover);
    transform: translateY(-1.5px);
}

/* Responsive adjustment for small screens */
@media (max-width: 480px) {
    .custom-alert-card {
        padding: 26px 20px 22px;
        border-radius: 22px;
    }
    .custom-alert-title {
        font-size: 19px;
    }
    .custom-alert-message {
        font-size: 13.5px;
    }
    .custom-alert-btn {
        min-height: 44px;
        font-size: 14px;
        border-radius: 12px;
    }
}

/* ==========================================================================
   TOAST & BANNER NOTIFICATION (Sesuai Desain Referensi)
   ========================================================================== */

.custom-toast-container {
    position: fixed;
    top: calc(var(--nav-h, 0px) + 20px);
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: calc(100vw - 32px);
}

.custom-toast-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 18px;
    width: 360px;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 10px 30px -5px rgba(13, 27, 42, 0.08), 0 4px 12px -2px rgba(13, 27, 42, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid transparent;
    pointer-events: auto;
    position: relative;
    animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: all 0.25s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.custom-toast-card.is-hiding {
    opacity: 0;
    transform: translateY(-12px) scale(0.92);
}

/* 1. Success (Berhasil) */
.custom-toast-card.custom-toast-success {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-color: rgba(16, 185, 129, 0.25);
}

/* 2. Information / Info */
.custom-toast-card.custom-toast-info,
.custom-toast-card.custom-toast-information,
.custom-toast-card.custom-toast-primary {
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-color: rgba(14, 165, 233, 0.25);
}

/* 3. Warning */
.custom-toast-card.custom-toast-warning {
    background: linear-gradient(135deg, rgba(254, 252, 232, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-color: rgba(245, 158, 11, 0.25);
}

/* 4. Error / Danger */
.custom-toast-card.custom-toast-danger,
.custom-toast-card.custom-toast-error,
.custom-toast-card.custom-toast-logout {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-color: rgba(239, 68, 68, 0.25);
}

/* Dark Mode Toast Overrides */
[data-theme="dark"] .custom-toast-card.custom-toast-success,
body.dark-mode .custom-toast-card.custom-toast-success,
html.dark .custom-toast-card.custom-toast-success {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.4) 0%, rgba(24, 28, 39, 0.96) 100%);
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .custom-toast-card.custom-toast-info,
[data-theme="dark"] .custom-toast-card.custom-toast-information,
[data-theme="dark"] .custom-toast-card.custom-toast-primary,
body.dark-mode .custom-toast-card.custom-toast-info,
html.dark .custom-toast-card.custom-toast-info {
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.4) 0%, rgba(24, 28, 39, 0.96) 100%);
    border-color: rgba(14, 165, 233, 0.35);
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .custom-toast-card.custom-toast-warning,
body.dark-mode .custom-toast-card.custom-toast-warning,
html.dark .custom-toast-card.custom-toast-warning {
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.4) 0%, rgba(24, 28, 39, 0.96) 100%);
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .custom-toast-card.custom-toast-danger,
[data-theme="dark"] .custom-toast-card.custom-toast-error,
body.dark-mode .custom-toast-card.custom-toast-danger,
html.dark .custom-toast-card.custom-toast-danger {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.4) 0%, rgba(24, 28, 39, 0.96) 100%);
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.55);
}

/* Icon Squircle Box */
.custom-toast-icon-box {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .custom-toast-icon-box,
body.dark-mode .custom-toast-icon-box,
html.dark .custom-toast-icon-box {
    background: #1e2333;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.custom-toast-icon {
    width: 22px;
    height: 22px;
    display: block;
}

/* Toast Body */
.custom-toast-body {
    flex: 1;
    min-width: 0;
}

.custom-toast-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--alert-title-color);
    margin: 0 0 2px 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.custom-toast-desc {
    font-size: 13px;
    font-weight: 400;
    color: var(--alert-message-color);
    margin: 0;
    line-height: 1.45;
    word-break: break-word;
}

/* Toast Close Button */
.custom-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    align-self: flex-start;
    margin-top: -2px;
    margin-right: -4px;
}

.custom-toast-close:hover {
    color: var(--alert-title-color);
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .custom-toast-close:hover,
body.dark-mode .custom-toast-close:hover,
html.dark .custom-toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
}
