/* ========================================
   MODAL BASE STYLES
   Базовые стили контейнера модального окна
   ======================================== */

/* Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: #191b24;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Modal window */
.modal {
    position: fixed;
    z-index: 9999;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(680px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 32px;
    padding: 40px;
    background-color: var(--black-2);
    border-top: solid 1px #0F151ACC;
    border-bottom: solid 1px #0F151ACC;
    box-shadow: 0 0 79px 0 rgba(24, 46, 65, 0.45);
}

/* Close button */
.close-btn {
    position: absolute;
    right: 18px;
    top: 16px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.close-btn::before,
.close-btn::after {
    content: "";
    width: 16px;
    height: 2px;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    position: absolute;
}

.close-btn::before { transform: rotate(45deg); }
.close-btn::after { transform: rotate(-45deg); }

.close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.03);
}

.close-btn:active { transform: scale(0.98); }

/* Hide close button modifier */
.modal.hide-close-btn .close-btn {
    display: none !important;
}

/* Modal title */
.modal-title {
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 32px;
    line-height: 40px;
    color: white;
}

/* Modal content */
.modal-content {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
    line-height: 1.55;
    max-height: calc(100vh - 180px);
    overflow: auto;
    padding-right: 6px;
    margin-top: 24px;
}

/* Scrollbar */
.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Loader */
.loader {
    transform: translateZ(1px);
}

.loader:after {
    content: '$';
    display: block;
    width: 48px;
    height: 48px;
    margin: auto;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    font-size: 32px;
    font-weight: bold;
    background: #FFD700;
    color: #DAA520;
    border: 4px double;
    box-sizing: border-box;
    box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.1);
    animation: coin-flip 4s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

@keyframes coin-flip {
    0%, 100% {
        animation-timing-function: cubic-bezier(0.5, 0, 1, 0.5);
    }
    0% { transform: rotateY(0deg); }
    50% {
        transform: rotateY(1800deg);
        animation-timing-function: cubic-bezier(0, 0.5, 0.5, 1);
    }
    100% { transform: rotateY(3600deg); }
}

/* === RESPONSIVE === */
@media (max-width: 520px) {
    .modal {
        width: calc(100vw - 24px);
        padding: 26px 20px 22px;
        border-radius: 22px;
    }
    
    .modal-title {
        font-size: 26px;
        margin-right: 46px;
    }
    
    .close-btn {
        right: 12px;
        top: 10px;
        width: 38px;
        height: 38px;
    }
}
