/* =========================================
   AI 4 Green - Custom Confirmation Dialog System
   Professional Modal/Dialog CSS
   ========================================= */

/* =========================
   1. DIALOG OVERLAY
   ========================= */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.dialog-overlay.closing {
    animation: fadeOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* =========================
   2. DIALOG CONTAINER
   ========================= */
.dialog-container {
    background: white;
    border-radius: 24px;
    box-shadow:
        0 25px 60px rgba(15, 23, 42, 0.25),
        0 10px 30px rgba(15, 23, 42, 0.15),
        0 0 0 1px rgba(15, 23, 42, 0.05);
    max-width: 480px;
    width: 100%;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    animation: dialogSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    font-family: "Baloo 2", system-ui, sans-serif;
}

@keyframes dialogSlideIn {
    to {
        transform: scale(1) translateY(0);
    }
}

.dialog-overlay.closing .dialog-container {
    animation: dialogSlideOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes dialogSlideOut {
    to {
        transform: scale(0.95) translateY(10px);
        opacity: 0;
    }
}

@media (max-width: 640px) {
    .dialog-container {
        max-width: 100%;
        margin: 0 16px;
        border-radius: 20px;
    }
}

/* =========================
   3. DIALOG HEADER
   ========================= */
.dialog-header {
    padding: 28px 28px 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(52, 211, 153, 0.05) 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.dialog-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.dialog-icon i {
    line-height: 1;
}

.dialog-header-text {
    flex: 1;
    padding-top: 4px;
}

.dialog-title {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.dialog-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* =========================
   4. DIALOG BODY
   ========================= */
.dialog-body {
    padding: 24px 28px;
}

.dialog-message {
    font-size: 15px;
    font-weight: 500;
    color: #475569;
    line-height: 1.65;
    margin: 0;
}

.dialog-message strong {
    font-weight: 700;
    color: #1e293b;
}

/* =========================
   5. DIALOG FOOTER (BUTTONS)
   ========================= */
.dialog-footer {
    padding: 20px 28px 28px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@media (max-width: 480px) {
    .dialog-footer {
        flex-direction: column-reverse;
    }
}

.dialog-btn {
    flex: 1;
    max-width: 160px;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

@media (max-width: 480px) {
    .dialog-btn {
        max-width: none;
    }
}

.dialog-btn i {
    font-size: 18px;
    line-height: 1;
}

.dialog-btn:active {
    transform: scale(0.97);
}

.dialog-btn:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.4);
    outline-offset: 2px;
}

/* Cancel Button */
.dialog-btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.dialog-btn-cancel:hover {
    background: #e2e8f0;
    color: #334155;
    border-color: #cbd5e1;
}

/* Confirm Button */
.dialog-btn-confirm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.dialog-btn-confirm:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.dialog-btn-confirm:active {
    transform: translateY(0) scale(0.98);
}

/* =========================
   6. DIALOG VARIANTS
   ========================= */

/* Warning Dialog */
.dialog-warning .dialog-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(251, 191, 36, 0.05) 100%);
}

.dialog-warning .dialog-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.dialog-warning .dialog-btn-confirm {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.dialog-warning .dialog-btn-confirm:hover {
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

/* Error/Danger Dialog */
.dialog-danger .dialog-header {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(220, 38, 38, 0.05) 100%);
}

.dialog-danger .dialog-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.dialog-danger .dialog-btn-confirm {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.dialog-danger .dialog-btn-confirm:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

/* Info Dialog */
.dialog-info .dialog-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.05) 100%);
}

.dialog-info .dialog-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.dialog-info .dialog-btn-confirm {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.dialog-info .dialog-btn-confirm:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

/* =========================
   7. ACCESSIBILITY
   ========================= */
@media (prefers-reduced-motion: reduce) {

    .dialog-overlay,
    .dialog-container {
        animation: none;
    }

    .dialog-overlay {
        opacity: 1;
    }

    .dialog-container {
        transform: none;
    }
}

/* =========================
   8. DARK MODE SUPPORT
   ========================= */
@media (prefers-color-scheme: dark) {
    .dialog-container {
        background: #1e293b;
        box-shadow:
            0 25px 60px rgba(0, 0, 0, 0.4),
            0 10px 30px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    .dialog-header {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(52, 211, 153, 0.08) 100%);
        border-bottom-color: rgba(71, 85, 105, 0.4);
    }

    .dialog-title {
        color: #f1f5f9;
    }

    .dialog-subtitle {
        color: #94a3b8;
    }

    .dialog-message {
        color: #cbd5e1;
    }

    .dialog-message strong {
        color: #e2e8f0;
    }

    .dialog-btn-cancel {
        background: #334155;
        color: #cbd5e1;
        border-color: #475569;
    }

    .dialog-btn-cancel:hover {
        background: #475569;
        color: #e2e8f0;
        border-color: #64748b;
    }
}

/* =========================
   9. LOADING STATE
   ========================= */
.dialog-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.dialog-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =========================
   10. UTILITY CLASSES
   ========================= */
.dialog-hidden {
    display: none !important;
}

/* Prevent body scroll when dialog is open */
body.dialog-open {
    overflow: hidden;
}