/* --- СИСТЕМНЫЕ СТИЛИ МОДАЛОК АВИТОПРО.РФ --- */

.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); 
    display: none; justify-content: center; align-items: center; 
    z-index: 3000; opacity: 0; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}
.modal-overlay.active { display: flex; opacity: 1; }

.modal-box { 
    background: #fff; border: 1px solid var(--border); border-radius: 32px; 
    padding: 40px; width: 100%; max-width: 500px; 
    box-shadow: 0 30px 100px rgba(0,0,0,0.15); 
    transform: scale(0.9) translateY(20px); transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); 
    position: relative; 
    max-height: 90vh;
    overflow-y: auto;
}
.modal-overlay.active .modal-box { transform: scale(1) translateY(0); }

/* Scrollbar styling */
.modal-box::-webkit-scrollbar {
    width: 6px;
}
.modal-box::-webkit-scrollbar-track {
    background: transparent;
    margin: 20px 0;
}
.modal-box::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}
.modal-box::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

.modal-box h2 { 
    font-size: 21px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.5px; 
    text-align: center;
    padding-left: 20px;
    padding-right: 20px; /* Чтобы не налезало на крестик и было строго по центру */
    white-space: nowrap;
}
.modal-box p { 
    color: var(--text-muted); font-size: 14px; font-weight: 500; margin-bottom: 24px; line-height: 1.5; 
    text-align: center;
}

.modal-close { 
    position: absolute; top: 24px; right: 24px; cursor: pointer; 
    color: var(--text-muted); font-size: 20px; transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; outline: none; opacity: 1;
}
.modal-close:hover { color: var(--accent-red); background: none; }

/* Пополнение баланса */
.topup-input-wrapper { position: relative; margin-bottom: 24px; }
.topup-input { 
    width: 100%; height: 64px; padding: 0 60px 0 24px; border-radius: 18px; 
    border: 1.5px solid var(--border); font-size: 24px; font-weight: 800; 
    outline: none; transition: 0.2s; background: #FAFAFA;
}
.topup-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.05); }
.topup-currency { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); font-size: 20px; font-weight: 900; color: var(--text-muted); }

/* Методы оплаты / Опции подключения */
.modal-options { display: flex; flex-direction: column; gap: 12px; }
.modal-option { 
    display: flex; align-items: center; gap: 16px; padding: 18px; 
    border-radius: 20px; border: 1px solid var(--border); background: #F9FAFB; 
    cursor: pointer; transition: 0.2s; text-align: left;
}
.modal-option:hover { border-color: var(--primary); background: #fff; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.modal-option.active { border-color: var(--accent-green); background: #E6F6F0; box-shadow: 0 4px 20px rgba(36, 180, 126, 0.1); }

.mo-icon { 
    width: 48px; height: 48px; background: #fff; border-radius: 14px; 
    display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); flex-shrink: 0; border: 1px solid var(--border); font-size: 22px;
}
.mo-icon img { width: 32px; height: 32px; object-fit: contain; }
.mo-text { flex: 1; }
.mo-title { font-size: 15px; font-weight: 800; display: block; margin-bottom: 2px; }
.mo-desc { font-size: 12px; color: var(--text-muted); font-weight: 500; line-height: 1.3; }

/* Кнопки в модалках */
.modal-actions { margin-top: 28px; display: flex; gap: 12px; }
.btn-modal { 
    height: 56px; border-radius: 16px; font-size: 15px; font-weight: 800; 
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.btn-modal-primary { 
    flex: 1; background: var(--accent-green); color: white; border: none; 
    border-bottom: 2px solid rgba(0,0,0,0.15); 
}
.btn-modal-primary:hover { background: #2ecc71; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2); }
.btn-modal-primary:active { transform: translateY(1px); border-bottom: none; }

.btn-modal-cancel { 
    flex: 1; background: #fff; color: var(--accent-red); border: 1.5px solid #FEE2E2; 
    border-bottom: 2px solid rgba(239, 68, 68, 0.1);
}
.btn-modal-cancel:hover { background: #FFF1F2; border-color: #FDA4AF; transform: translateY(-1px); }
.btn-modal-cancel:active { transform: translateY(1px); border-bottom: none; }

/* Формы в модалках */
.form-group { margin-bottom: 16px; text-align: left; }
.form-label { 
    display: block; font-size: 11px; font-weight: 800; color: var(--text-muted); 
    text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; 
}
.form-control { 
    width: 100%; height: 48px; padding: 0 16px; border-radius: 12px; 
    border: 1.5px solid var(--border); background: #F9FAFB; font-size: 14px; 
    font-weight: 600; outline: none; transition: 0.2s; color: var(--text-main);
}
.form-control:focus { 
    border-color: var(--primary); background: #fff; 
    box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.05); 
    outline: none !important;
}
.form-control::placeholder { color: #A0AEC0; font-weight: 500; }

.btn-red { 
    background: #fff !important; color: #EF4444 !important; 
    border: 1px solid #FEE2E2 !important;
    border-bottom: 2px solid rgba(239, 68, 68, 0.1) !important;
}
.btn-red:hover { background: #FFF1F2 !important; border-color: #FDA4AF !important; transform: translateY(-1px); }
.btn-red:active { transform: translateY(1px); border-bottom: none !important; }

/* Аватар в профиле */
.edit-profile-avatar-container {
    width: 130px;
    height: 130px;
    border-radius: 50% !important;
    overflow: hidden !important;
    border: 4px solid #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    position: relative;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.edit-profile-avatar-container:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.edit-profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
    border-radius: 50%;
}

.edit-profile-avatar-container:hover .avatar-edit-overlay {
    opacity: 1;
}

.avatar-edit-overlay svg {
    width: 28px;
    height: 28px;
    color: white;
}

/* Сетка полей профиля */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.full-width {
    grid-column: span 2;
}

/* Переключатель видимости пароля */
.password-wrapper { 
    position: relative; 
    width: 100%;
}
.password-toggle { 
    position: absolute; 
    right: 16px; 
    top: 50%; 
    transform: translateY(-50%); 
    cursor: pointer; 
    opacity: 0.4; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 10;
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.password-toggle:hover { 
    opacity: 1; 
    color: var(--primary); 
    background: rgba(0, 170, 255, 0.05);
}
.password-toggle svg {
    width: 18px;
    height: 18px;
}

/* Переключатель-тумблер */
.dot-toggle-pro { 
    width: 34px; 
    height: 18px; 
    background: #E5E7EB; 
    border-radius: 20px; 
    position: relative; 
    transition: 0.2s;
}
.dot-toggle-pro::after { 
    content: ''; 
    position: absolute; 
    width: 12px; 
    height: 12px; 
    background: #fff; 
    border-radius: 50%; 
    top: 3px; 
    left: 3px; 
    transition: 0.2s; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.dot-toggle-pro.active { background: var(--accent-green); }
.dot-toggle-pro.active::after { left: 19px; }

/* Global modal input style */
.modal-input {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: #F9FAFB;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    transition: 0.2s;
    color: var(--text-main);
}
.modal-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.05);
    outline: none !important;
}
.modal-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
}

/* API connection modal inputs custom sizes */
#modalApi input.modal-input {
    height: 48px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
}

/* Global premium focus style for tab navigation (excluding inputs, textareas, and selects) */
*:focus-visible:not(input):not(textarea):not(select) {
    outline: 2px solid var(--primary, #00aaff) !important;
    outline-offset: 2px;
}

/* --- PREMIUM CUSTOM TOASTS --- */
#custom-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 20000; /* Must be higher than modals */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 48px);
}

.custom-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.02);
    border-radius: 18px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main, #1e293b);
    transition: transform 0.2s ease, opacity 0.2s ease;
    animation: slideInToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.custom-toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08);
}

.custom-toast.toast-success {
    border-left: 5px solid var(--accent-green, #24b47e);
}

.custom-toast.toast-error {
    border-left: 5px solid var(--accent-red, #ef4444);
}

.custom-toast.toast-info {
    border-left: 5px solid var(--primary, #00aaff);
}

.toast-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-message {
    line-height: 1.4;
}

@keyframes slideInToast {
    from {
        transform: translateX(50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeOutToast {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(-10px) scale(0.9);
        opacity: 0;
    }
}

@media (max-width: 576px) {
    .modal-overlay {
        align-items: stretch !important;
        justify-content: stretch !important;
    }
    
    .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        padding: 56px 24px 32px !important;
        overflow-y: auto !important;
    }

    .modal-actions {
        margin-top: auto !important;
    }
    
    .modal-box h2 {
        white-space: normal !important;
    }
}
