/* ============================================
   CUSTOM MODAL - CSS
   ============================================ */

.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.2s, opacity 0.2s ease;
}

.custom-modal.open {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Overlay */
.custom-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Container */
.custom-modal-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: 90vh;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dialog */
.custom-modal-dialog {
    background-color: #1a1a1e;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-height: calc(90vh - 32px);
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-modal.open .custom-modal-dialog {
    transform: scale(1) translateY(0);
}

/* Tamanhos */
.custom-modal-sm {
    max-width: 400px;
}

.custom-modal-md {
    max-width: 560px;
}

.custom-modal-lg {
    max-width: 800px;
}

.custom-modal-xl {
    max-width: 1140px;
}

.custom-modal-full {
    max-width: calc(100% - 32px);
    max-height: calc(100vh - 32px);
}

/* Header */
.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.custom-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.custom-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.custom-modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(30, 188, 165, 0.5);
}

/* Body */
.custom-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.6;
}

.custom-modal-body h1,
.custom-modal-body h2,
.custom-modal-body h3,
.custom-modal-body h4 {
    color: #ffffff;
    margin-top: 24px;
    margin-bottom: 12px;
}

.custom-modal-body h1:first-child,
.custom-modal-body h2:first-child,
.custom-modal-body h3:first-child,
.custom-modal-body h4:first-child {
    margin-top: 0;
}

.custom-modal-body p {
    margin-bottom: 12px;
}

.custom-modal-body ul,
.custom-modal-body ol {
    margin-bottom: 12px;
    padding-left: 24px;
}

.custom-modal-body li {
    margin-bottom: 6px;
}

.custom-modal-body a {
    color: #1ebca5;
    text-decoration: none;
}

.custom-modal-body a:hover {
    text-decoration: underline;
}

/* Footer */
.custom-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* Loading */
.custom-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.6);
}

.custom-modal-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #1ebca5;
    border-radius: 50%;
    animation: modal-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* Error */
.custom-modal-error {
    text-align: center;
    padding: 40px;
    color: #ef4444;
}

/* Scrollbar customizada */
.custom-modal-body::-webkit-scrollbar {
    width: 8px;
}

.custom-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.custom-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.custom-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsivo */
@media (max-width: 640px) {
    .custom-modal-container {
        padding: 8px;
        align-items: flex-end;
    }

    .custom-modal-dialog {
        max-height: calc(100vh - 16px);
        border-radius: 16px 16px 0 0;
    }

    .custom-modal-sm,
    .custom-modal-md,
    .custom-modal-lg,
    .custom-modal-xl {
        max-width: 100%;
    }

    .custom-modal-header {
        padding: 14px 16px;
    }

    .custom-modal-body {
        padding: 16px;
    }

    .custom-modal-footer {
        padding: 14px 16px;
        flex-direction: column;
    }

    .custom-modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}
