/**
 * Custom Alert & Confirm Modal - Neo-Edu Style
 * Desain modern dengan glassmorphism dan efek glow
 */

/* Modal Overlay */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    animation: fadeInOverlay 0.3s ease forwards;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Container */
.custom-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 1rem;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(16, 185, 129, 0.1),
        0 0 40px rgba(16, 185, 129, 0.15);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    animation: slideUpModal 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    position: relative;
    overflow: hidden;
}

@keyframes slideUpModal {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Modal Top Border Gradient */
.custom-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981 0%, #3b82f6 50%, #10b981 100%);
    background-size: 200% 100%;
    animation: gradientShift 3s linear infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Modal Header */
.custom-modal-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
}

.custom-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Icon Types */
.custom-modal-icon.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.custom-modal-icon.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.custom-modal-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.custom-modal-icon.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.custom-modal-icon.question {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

/* Modal Title */
.custom-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    flex: 1;
    font-family: 'Poppins', sans-serif;
}

/* Modal Body */
.custom-modal-body {
    padding: 1.5rem;
    color: #4b5563;
    line-height: 1.6;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.custom-modal-message {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Modal Footer */
.custom-modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid rgba(16, 185, 129, 0.1);
}

/* Buttons */
.custom-modal-btn {
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.custom-modal-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.custom-modal-btn:active::before {
    width: 300px;
    height: 300px;
}

.custom-modal-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.custom-modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.custom-modal-btn-primary:active {
    transform: translateY(0);
}

.custom-modal-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.custom-modal-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-modal-btn-secondary:active {
    transform: translateY(0);
}

.custom-modal-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.custom-modal-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.custom-modal-btn-danger:active {
    transform: translateY(0);
}

/* Prompt Input */
.custom-modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    background: white;
    color: #1f2937;
    margin-top: 0.5rem;
}

.custom-modal-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Dark Theme Support */
body.theme-dark .custom-modal {
    background: rgba(44, 47, 63, 0.95);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

body.theme-dark .custom-modal-title {
    color: #e3e6f0;
}

body.theme-dark .custom-modal-body {
    color: #d1d5db;
}

body.theme-dark .custom-modal-header,
body.theme-dark .custom-modal-footer {
    border-color: rgba(16, 185, 129, 0.2);
}

body.theme-dark .custom-modal-btn-secondary {
    background: #374151;
    color: #e3e6f0;
    border-color: #4b5563;
}

body.theme-dark .custom-modal-btn-secondary:hover {
    background: #4b5563;
}

body.theme-dark .custom-modal-input {
    background: #374151;
    border-color: #4b5563;
    color: #e3e6f0;
}

body.theme-dark .custom-modal-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .custom-modal {
        max-width: 100%;
        margin: 0.5rem;
        border-radius: 0.75rem;
    }

    .custom-modal-header {
        padding: 1.25rem 1.25rem 0.75rem;
    }

    .custom-modal-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .custom-modal-title {
        font-size: 1.1rem;
    }

    .custom-modal-body {
        padding: 1.25rem;
        font-size: 0.9375rem;
    }

    .custom-modal-footer {
        padding: 0.75rem 1.25rem 1.25rem;
        flex-direction: column-reverse;
    }

    .custom-modal-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1.5rem;
    }
}

/* Loading State */
.custom-modal-loading {
    pointer-events: none;
    opacity: 0.7;
}

.custom-modal-loading .custom-modal-btn {
    position: relative;
    color: transparent;
}

.custom-modal-loading .custom-modal-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Close Animation */
.custom-modal-overlay.closing {
    animation: fadeOutOverlay 0.2s ease forwards;
}

@keyframes fadeOutOverlay {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.custom-modal.closing {
    animation: slideDownModal 0.2s ease forwards;
}

@keyframes slideDownModal {
    from {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    to {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
}
