/**
 * UBK Dialog & Notification System - Modern, Fancy, Consistent JS Modal
 * Copyright (c) 2026 UPT TI Universitas Bung Karno
 */

/* Overlay / Backdrop */
.ubk-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.ubk-dialog-overlay.ubk-dialog-visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Window */
.ubk-dialog-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
    opacity: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1E293B;
    box-sizing: border-box;
}

.ubk-dialog-overlay.ubk-dialog-visible .ubk-dialog-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Header Banner / Accent Top */
.ubk-dialog-header-accent {
    height: 6px;
    width: 100%;
    background: linear-gradient(90deg, #7A1515, #D4AF37, #7A1515);
}

.ubk-dialog-box.ubk-type-error .ubk-dialog-header-accent {
    background: linear-gradient(90deg, #DC2626, #F87171, #B91C1C);
}
.ubk-dialog-box.ubk-type-success .ubk-dialog-header-accent {
    background: linear-gradient(90deg, #059669, #34D399, #047857);
}
.ubk-dialog-box.ubk-type-warning .ubk-dialog-header-accent {
    background: linear-gradient(90deg, #D97706, #FBBF24, #B45309);
}
.ubk-dialog-box.ubk-type-question .ubk-dialog-header-accent {
    background: linear-gradient(90deg, #7A1515, #D4AF37, #9B1C1C);
}

/* Content Container */
.ubk-dialog-body {
    padding: 32px 28px 24px;
    text-align: center;
    box-sizing: border-box;
}

/* Close Button (X) */
.ubk-dialog-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F1F5F9;
    color: #64748B;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 2;
}

.ubk-dialog-close-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
    transform: rotate(90deg);
}

/* Icon Wrap */
.ubk-dialog-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    position: relative;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    animation: ubkIconPulse 2s infinite ease-in-out;
}

@keyframes ubkIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* Icon Variations */
.ubk-type-info .ubk-dialog-icon-wrap {
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    color: #2563EB;
    border: 2px solid #BFDBFE;
}
.ubk-type-success .ubk-dialog-icon-wrap {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    color: #059669;
    border: 2px solid #A7F3D0;
}
.ubk-type-warning .ubk-dialog-icon-wrap {
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
    color: #D97706;
    border: 2px solid #FDE68A;
}
.ubk-type-error .ubk-dialog-icon-wrap {
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
    color: #DC2626;
    border: 2px solid #FECACA;
}
.ubk-type-question .ubk-dialog-icon-wrap {
    background: linear-gradient(135deg, #FFF1F1, #FFE4E6);
    color: #7A1515;
    border: 2px solid #FED7D7;
}

/* Typography */
.ubk-dialog-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 12px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.ubk-dialog-message {
    font-size: 0.98rem;
    line-height: 1.65;
    color: #475569;
    margin: 0 0 24px;
    word-break: break-word;
}

/* Error Specific Styling */
.ubk-type-error .ubk-dialog-title {
    color: #991B1B;
}

.ubk-type-error .ubk-dialog-message {
    color: #334155;
    font-weight: 600;
    font-size: 1rem;
    background: #FFF1F2;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px dashed #FECDD3;
}

/* Input for Prompt */
.ubk-dialog-input-wrap {
    margin-bottom: 24px;
    text-align: left;
}

.ubk-dialog-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #CBD5E1;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1E293B;
    background: #F8FAFC;
    box-sizing: border-box;
    transition: all 0.2s ease;
    outline: none;
}

.ubk-dialog-input:focus {
    border-color: #7A1515;
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(122, 21, 21, 0.12);
}

/* Action Buttons Footer */
.ubk-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ubk-btn-dialog {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    outline: none;
    min-width: 120px;
    text-decoration: none;
    box-sizing: border-box;
}

.ubk-btn-dialog:active {
    transform: scale(0.97);
}

/* Primary Button (UBK Maroon) */
.ubk-btn-dialog.ubk-btn-primary {
    background: linear-gradient(135deg, #7A1515, #560B0B);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(122, 21, 21, 0.35);
}

.ubk-btn-dialog.ubk-btn-primary:hover {
    background: linear-gradient(135deg, #8E1B1B, #6B0E0E);
    box-shadow: 0 6px 20px rgba(122, 21, 21, 0.45);
    transform: translateY(-1px);
}

/* Danger Button (For Destructive Confirmations) */
.ubk-btn-dialog.ubk-btn-danger {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.ubk-btn-dialog.ubk-btn-danger:hover {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
    transform: translateY(-1px);
}

/* Reload Button for Error dialog */
.ubk-btn-dialog.ubk-btn-reload {
    background: linear-gradient(135deg, #7A1515, #A31D1D);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(122, 21, 21, 0.35);
}

.ubk-btn-dialog.ubk-btn-reload:hover {
    background: linear-gradient(135deg, #8E1B1B, #B82222);
    box-shadow: 0 6px 20px rgba(122, 21, 21, 0.45);
    transform: translateY(-1px);
}

/* Secondary / Cancel Button */
.ubk-btn-dialog.ubk-btn-secondary {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #CBD5E1;
}

.ubk-btn-dialog.ubk-btn-secondary:hover {
    background: #E2E8F0;
    color: #0F172A;
}

/* Toast Notification Container */
.ubk-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999998;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
    width: calc(100% - 48px);
}

.ubk-toast-item {
    pointer-events: auto;
    background: #FFFFFF;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #1E293B;
    position: relative;
    overflow: hidden;
}

.ubk-toast-item.ubk-toast-show {
    transform: translateY(0);
    opacity: 1;
}

.ubk-toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.ubk-toast-content {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
}

.ubk-toast-close {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ubk-toast-close:hover {
    color: #0F172A;
}

.ubk-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #7A1515;
    width: 100%;
}

.ubk-toast-success .ubk-toast-icon { color: #059669; }
.ubk-toast-success .ubk-toast-progress { background: #059669; }
.ubk-toast-error .ubk-toast-icon { color: #DC2626; }
.ubk-toast-error .ubk-toast-progress { background: #DC2626; }
.ubk-toast-warning .ubk-toast-icon { color: #D97706; }
.ubk-toast-warning .ubk-toast-progress { background: #D97706; }
.ubk-toast-info .ubk-toast-icon { color: #2563EB; }
.ubk-toast-info .ubk-toast-progress { background: #2563EB; }

/* Responsive adjustments */
@media (max-width: 576px) {
    .ubk-dialog-box {
        max-width: 95%;
        border-radius: 20px;
    }
    .ubk-dialog-body {
        padding: 26px 20px 20px;
    }
    .ubk-dialog-title {
        font-size: 1.2rem;
    }
    .ubk-dialog-message {
        font-size: 0.92rem;
    }
    .ubk-dialog-actions {
        flex-direction: column-reverse;
        width: 100%;
    }
    .ubk-btn-dialog {
        width: 100%;
    }
    .ubk-toast-container {
        bottom: 16px;
        right: 16px;
        width: calc(100% - 32px);
    }
}
