/* ============================================================
   SYSTEM UNIVERSAL MODAL COMPONENT (PUPR THEME)
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 23, 55, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius, 12px);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 23, 55, 0.25);
    border: 1px solid rgba(0, 40, 85, 0.08);
    color: var(--text-primary, #0f172a);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-box .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 40, 85, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card, #ffffff);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-box .modal-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary, #002855);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

html[data-theme="dark"] .modal-box .modal-header h3 {
    color: var(--text-primary, #f8fafc);
}

.modal-box .modal-header .close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition, all 0.2s ease);
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box .modal-header .close-btn:hover {
    background: rgba(231, 76, 60, 0.12);
    color: var(--danger, #e74c3c);
}

/* Modal Body */
.modal-box .modal-body {
    padding: 24px;
}

.modal-box .modal-body .form-group {
    margin-bottom: 18px;
}

.modal-box .modal-body .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary, #475569);
}

.modal-box .modal-body .form-group input,
.modal-box .modal-body .form-group select,
.modal-box .modal-body .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid rgba(0, 40, 85, 0.12);
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-body, #f8fafc);
    color: var(--text-primary, #0f172a);
    transition: var(--transition, all 0.2s ease);
    outline: none;
}

html[data-theme="dark"] .modal-box .modal-body .form-group input,
html[data-theme="dark"] .modal-box .modal-body .form-group select,
html[data-theme="dark"] .modal-box .modal-body .form-group textarea {
    border-color: rgba(255, 255, 255, 0.15);
    background: #0f172a;
    color: #f8fafc;
}

.modal-box .modal-body .form-group input:focus,
.modal-box .modal-body .form-group select:focus,
.modal-box .modal-body .form-group textarea:focus {
    border-color: var(--primary, #002855);
    box-shadow: 0 0 0 4px rgba(0, 40, 85, 0.1);
    background: #ffffff;
}

html[data-theme="dark"] .modal-box .modal-body .form-group input:focus,
html[data-theme="dark"] .modal-box .modal-body .form-group select:focus,
html[data-theme="dark"] .modal-box .modal-body .form-group textarea:focus {
    background: #1e293b;
    border-color: var(--primary, #002855);
}

.modal-box .modal-body .form-group textarea {
    resize: vertical;
    min-height: 85px;
}

.modal-box .modal-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Modal Footer */
.modal-box .modal-footer {
    padding: 18px 24px;
    border-top: 1px solid rgba(0, 40, 85, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-card, #ffffff);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.modal-box .modal-footer .btn {
    padding: 10px 22px;
    border-radius: var(--radius-sm, 6px);
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition, all 0.2s ease);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal-box .modal-footer .btn-cancel {
    background: var(--bg-body, #f1f5f9);
    color: var(--text-secondary, #475569);
    border: 1px solid rgba(0, 40, 85, 0.08);
}
.modal-box .modal-footer .btn-cancel:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.modal-box .modal-footer .btn-submit {
    background: var(--primary, #002855);
    color: #ffffff;
}
.modal-box .modal-footer .btn-submit:hover {
    background: var(--primary-light, #003a7a);
    box-shadow: 0 4px 12px rgba(0, 40, 85, 0.25);
    transform: translateY(-2px);
}

/* Button Hover Micro-animations for Modal Confirmation (Batal & Ya Keluar) */
.modal-box .modal-footer .btn-outline,
.modal-box .modal-footer .btn-modal-cancel {
    background: var(--bg-card, #ffffff);
    color: var(--text-secondary, #475569);
    border: 1px solid rgba(0, 40, 85, 0.16);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.modal-box .modal-footer .btn-outline:hover,
.modal-box .modal-footer .btn-modal-cancel:hover {
    background: rgba(0, 40, 85, 0.06) !important;
    color: var(--primary, #002855) !important;
    border-color: var(--primary, #002855) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 40, 85, 0.12) !important;
}

.modal-box .modal-footer .btn-danger,
.modal-box .modal-footer .btn-modal-logout {
    background: var(--danger, #e74c3c) !important;
    color: #ffffff !important;
    border: none !important;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.modal-box .modal-footer .btn-danger:hover,
.modal-box .modal-footer .btn-modal-logout:hover {
    background: #c0392b !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.4) !important;
}

/* Responsive Modal */
@media (max-width: 640px) {
    .modal-box {
        max-width: 100%;
        margin: 10px;
    }
    .modal-box .modal-body .form-row {
        grid-template-columns: 1fr;
    }
}
