/* ============================================
   Profile Styles - Стили экрана профиля
   ============================================ */

/* ================== ФОН ЭКРАНА ================== */

#profile-screen {
    min-height: 100vh;
    background: 
        url('../assets/bg-profile.svg') center top / cover no-repeat fixed,
        linear-gradient(180deg, #0a1628 0%, #1a2744 50%, #0d1829 100%) !important;
}

/* ================== ПОЗИЦИОНИРОВАНИЕ КНОПОК ================== */

/* По умолчанию (Default) */
#profile-screen {
    padding-top: calc(1rem + 25px) !important;
}

#back-to-arena-btn {
    position: absolute !important;
    top: 16px !important;
    left: 16px !important;
}

/* Кнопки настроек и языка - абсолютное позиционирование справа */
#locale-switch-btn {
    position: absolute !important;
    top: 21px !important;
    right: 60px !important;
}

#profile-settings-btn {
    position: absolute !important;
    top: 21px !important;
    right: 16px !important;
}

/* iOS: настройка позиций для профиля */
html[data-platform="ios"] #profile-screen {
    padding-top: calc(1rem + 53px) !important;
}

html[data-platform="ios"] #back-to-arena-btn {
    top: 100px !important;
    left: 16px !important;
}

html[data-platform="ios"] #locale-switch-btn {
    top: 95px !important;
    right: 60px !important;
}

html[data-platform="ios"] #profile-settings-btn {
    top: 95px !important;
    right: 16px !important;
}

/* Android: настройка позиций для профиля */
html[data-platform="android"] #profile-screen {
    padding-top: calc(1rem + 43px) !important;
}

html[data-platform="android"] #back-to-arena-btn {
    top: 80px !important;
    left: 16px !important;
}

html[data-platform="android"] #locale-switch-btn {
    top: 80px !important;
    right: 60px !important;
}

html[data-platform="android"] #profile-settings-btn {
    top: 80px !important;
    right: 16px !important;
}

/* ================== АВАТАР ================== */

.profile-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
}

.profile-avatar { 
    width: 100px; 
    height: 100px; 
    border-radius: 50%; 
    background-size: cover;
    background-position: center;
    transition: box-shadow 0.3s ease;
}

/* Glow эффект - цвет подстраивается через JS в зависимости от рамки */
.profile-avatar-wrapper.has-frame .profile-avatar {
    box-shadow: 0 0 20px var(--avatar-glow-color, rgba(255, 215, 0, 0.5));
}

/* Glow по уровням */
.profile-avatar-wrapper[data-level-tier="bronze"] .profile-avatar {
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.5);
}
.profile-avatar-wrapper[data-level-tier="silver"] .profile-avatar {
    box-shadow: 0 0 18px rgba(192, 192, 192, 0.6);
}
.profile-avatar-wrapper[data-level-tier="gold"] .profile-avatar {
    box-shadow: 0 0 22px rgba(255, 215, 0, 0.6);
}
.profile-avatar-wrapper[data-level-tier="diamond"] .profile-avatar {
    box-shadow: 0 0 25px rgba(185, 242, 255, 0.7);
}
.profile-avatar-wrapper[data-level-tier="legend"] .profile-avatar {
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.8), 0 0 50px rgba(247, 147, 30, 0.4);
    animation: legend-avatar-glow 2s ease-in-out infinite;
}

@keyframes legend-avatar-glow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 107, 53, 0.8), 0 0 50px rgba(247, 147, 30, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 107, 53, 1), 0 0 60px rgba(247, 147, 30, 0.7);
    }
}

/* Рамка аватара overlay */
#profile-avatar-frame {
    position: absolute;
    inset: -10px;
    pointer-events: none;
    z-index: 10;
}

#profile-avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* ================== ИМЯ + УРОВЕНЬ ================== */

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.profile-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Уровни по тирам */
.profile-level-badge.tier-bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #8b5a2b 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.profile-level-badge.tier-silver {
    background: linear-gradient(135deg, #e8e8e8 0%, #a8a8a8 100%);
    color: #333;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.5);
}

.profile-level-badge.tier-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #1a1a00;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

.profile-level-badge.tier-diamond {
    background: linear-gradient(135deg, #b9f2ff 0%, #7ee8fa 50%, #80c7d4 100%);
    color: #0a3d44;
    box-shadow: 0 2px 12px rgba(185, 242, 255, 0.6);
}

.profile-level-badge.tier-legend {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 30%, #ffd700 50%, #f7931e 70%, #ff6b35 100%);
    color: #1a0500;
    box-shadow: 0 2px 15px rgba(255, 107, 53, 0.7), 0 0 20px rgba(247, 147, 30, 0.5);
    animation: legend-glow 2s ease-in-out infinite;
}

@keyframes legend-glow {
    0%, 100% {
        box-shadow: 0 2px 15px rgba(255, 107, 53, 0.7), 0 0 20px rgba(247, 147, 30, 0.5);
    }
    50% {
        box-shadow: 0 2px 20px rgba(255, 107, 53, 0.9), 0 0 30px rgba(247, 147, 30, 0.8);
    }
}

/* ================== VIP КАРТОЧКА ================== */

.profile-vip-card {
    width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    display: none; /* Скрыта по умолчанию */
}

.profile-vip-card.vip-active {
    display: block;
}

.profile-vip-card.vip-bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(139, 90, 43, 0.3) 100%);
    border: 1px solid rgba(205, 127, 50, 0.4);
}

.profile-vip-card.vip-silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15) 0%, rgba(168, 168, 168, 0.25) 100%);
    border: 1px solid rgba(192, 192, 192, 0.4);
}

.profile-vip-card.vip-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 170, 0, 0.25) 100%);
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.profile-vip-card-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-vip-icon {
    font-size: 28px;
    margin-right: 12px;
}

.profile-vip-info {
    flex: 1;
}

.profile-vip-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-vip-card.vip-bronze .profile-vip-title { color: #cd7f32; }
.profile-vip-card.vip-silver .profile-vip-title { color: #c0c0c0; }
.profile-vip-card.vip-gold .profile-vip-title { color: #ffd700; }

.profile-vip-bonus {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* ================== СТАТИСТИКА ================== */

.profile-stat { 
    background: rgba(0,0,0,0.2); 
    padding: 0.5rem 1rem; 
    border-radius: 0.5rem; 
    display: flex; 
    justify-content: space-between; 
}

/* ================== РЕФЕРАЛЬНАЯ ПРОГРАММА ================== */

#referral-screen {
    padding-top: calc(1rem + 25px) !important;
    min-height: 100vh;
    background: 
        url('../assets/bg-referral.svg') center top / cover no-repeat fixed,
        linear-gradient(135deg, #0a1a15 0%, #102820 50%, #081510 100%) !important;
}

#back-to-profile-from-referral-btn {
    top: 16px !important;
    left: 16px !important;
}

/* iOS: настройка позиций для реферальной программы */
html[data-platform="ios"] #referral-screen {
    padding-top: calc(1rem + 80px) !important;
}

html[data-platform="ios"] #back-to-profile-from-referral-btn {
    top: 24px !important;
    left: 16px !important;
}

/* Android: настройка позиций для реферальной программы */
html[data-platform="android"] #referral-screen {
    padding-top: calc(1rem + 60px) !important;
}

html[data-platform="android"] #back-to-profile-from-referral-btn {
    top: 20px !important;
    left: 16px !important;
}

/* ================== АДАПТИВНОСТЬ ================== */

@media (max-width: 360px) {
    .profile-avatar-wrapper {
        width: 100px;
        height: 100px;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
    
    .profile-name-row {
        gap: 6px;
    }
    
    .profile-name-row h2 {
        font-size: 1.25rem;
    }
    
    .profile-level-badge {
        padding: 2px 8px;
        font-size: 10px;
    }
    
    .profile-vip-card {
        padding: 10px 12px;
    }
    
    .profile-vip-icon {
        font-size: 24px;
    }
    
    .profile-stat {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* ================== НАСТРОЙКИ ПОЛЬЗОВАТЕЛЯ ================== */

#user-settings-screen {
    padding-top: calc(1rem + 25px) !important;
    min-height: 100vh;
    background: 
        url('../assets/bg-settings.svg') center top / cover no-repeat fixed,
        linear-gradient(135deg, #0c1220 0%, #1a2035 50%, #0a0f1a 100%) !important;
}

/* iOS: настройки */
html[data-platform="ios"] #user-settings-screen {
    padding-top: calc(1rem + 80px) !important;
}

/* Android: настройки */
html[data-platform="android"] #user-settings-screen {
    padding-top: calc(1rem + 60px) !important;
}

/* ================== ИНВЕНТАРЬ ================== */

#inventory-screen {
    padding-top: calc(1rem + 25px) !important;
    min-height: 100vh;
    background: 
        url('../assets/bg-inventory.svg') center top / cover no-repeat fixed,
        linear-gradient(135deg, #1a1510 0%, #2a2018 50%, #151008 100%) !important;
}

#back-from-inventory-btn {
    top: 16px !important;
    left: 16px !important;
}

/* iOS: инвентарь */
html[data-platform="ios"] #inventory-screen {
    padding-top: calc(1rem + 80px) !important;
}

html[data-platform="ios"] #back-from-inventory-btn {
    top: 100px !important;
    left: 16px !important;
}

/* Android: инвентарь */
html[data-platform="android"] #inventory-screen {
    padding-top: calc(1rem + 60px) !important;
}

html[data-platform="android"] #back-from-inventory-btn {
    top: 80px !important;
    left: 16px !important;
}

/* ================== РЕФЕРАЛЬНАЯ СИСТЕМА ================== */

.referral-screen {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.referral-screen h2 {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-align: center;
    margin-bottom: 30px;
}

.referral-screen h3 {
    font-size: 20px;
    font-weight: 600;
    color: #f0c000;
    margin-bottom: 15px;
}

/* Блок приглашения */
.referral-invite-section {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.referral-invite-section p {
    color: #ccc;
    margin-bottom: 20px;
    line-height: 1.5;
}

.referral-link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.referral-link-container input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    min-width: 0;
}

.referral-link-container .btn-primary {
    min-width: 50px;
    padding: 12px 16px;
    flex-shrink: 0;
}

/* Статистика рефералов */
.referral-stats-section {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.referral-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
}

.stat-card {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
}

/* Список рефералов */
.referral-list-section {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.referral-table {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.referral-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px;
    background: rgba(40, 40, 40, 0.8);
    border-radius: 8px;
    font-weight: bold;
    color: #ffd700;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.referral-table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 12px 10px;
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid #333;
    border-radius: 6px;
    margin-bottom: 8px;
}

.referral-user {
    color: #fff;
    font-weight: 500;
}

.referral-level {
    color: #60a5fa;
    font-weight: 600;
}

.referral-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.status-donated {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid #10b981;
}

.status-active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.referral-donation {
    color: #fbbf24;
    font-weight: 500;
}

.no-referrals {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

/* Информационная секция */
.referral-info-section {
    text-align: center;
    margin-bottom: 20px;
}

/* Модальное окно с информацией */
.referral-info-modal {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 2px solid #ffd700;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.referral-info-modal h3 {
    font-size: 24px;
    color: #ffd700;
    text-align: center;
    margin-bottom: 25px;
}

.referral-info-content {
    margin-bottom: 25px;
}

.info-block {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.info-block h4 {
    font-size: 16px;
    color: #ffd700;
    margin-bottom: 10px;
}

.info-block p {
    color: #ccc;
    line-height: 1.6;
    font-size: 14px;
}

.info-block strong {
    color: #10b981;
    font-weight: 600;
}

.info-highlight {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.info-highlight h4 {
    color: #10b981;
}

.info-milestone {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
    border-color: #f59e0b;
}

.info-milestone h4 {
    color: #fbbf24;
}

.info-milestone strong {
    color: #fbbf24;
}

.close-modal {
    width: 100%;
    margin-top: 10px;
}

/* Адаптивность реферальной системы */
@media (max-width: 600px) {
    .referral-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .referral-table-header,
    .referral-table-row {
        grid-template-columns: 2fr 1fr 1.2fr 1fr;
        font-size: 11px;
        gap: 5px;
        padding: 10px 8px;
    }
    
    .referral-screen h2 {
        font-size: 22px;
    }
    
    .referral-screen h3 {
        font-size: 18px;
    }

    .referral-link-container {
        flex-direction: row;
    }

    .referral-link-container input {
        font-size: 12px;
        padding: 10px 8px;
    }

    .referral-link-container .btn-primary {
        font-size: 18px;
        padding: 10px 12px;
        min-width: 50px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-label {
        font-size: 10px;
    }
}

/* ==========================================
   НОВЫЙ RPG ПРОФИЛЬ
   ========================================== */

/* Персонаж по центру */
.profile-character {
    width: 160px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 8px;
    position: relative;
    z-index: 0;
}

.profile-character img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Слоты экипировки */
.equipment-slot {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 2px solid rgba(100, 116, 139, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.equipment-slot-icon {
    font-size: 18px;
    opacity: 0.4;
}

.equipment-slot-item {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    z-index: 1;
}

.equipment-slot.equipped {
    border-color: rgba(34, 197, 94, 0.7);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.equipment-slot.equipped .equipment-slot-icon {
    display: none;
}

/* Boss Gear слоты выделяем отдельно */
.equipment-slot.boss-slot {
    border-color: rgba(239, 68, 68, 0.5);
}

.equipment-slot.boss-slot.equipped {
    border-color: rgba(239, 68, 68, 0.9);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}

/* Боксы статистики */
.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 8px;
    gap: 2px;
}

.stat-box .stat-value {
    font-size: 12px;
    font-weight: bold;
}

.stat-box-wide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
    padding: 8px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 8px;
}

.stat-box-wide .stat-value {
    font-size: 14px;
    font-weight: bold;
}

.token-emoji {
    font-size: 20px;
    line-height: 1;
    display: block;
}

#open-inventory-btn,
#open-referral-btn {
    pointer-events: auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    min-height: 45px;
    padding: 0;
    transform: none;
    transform-origin: center;
    line-height: 1;
}

/* Мини характеристики RPG */
.rpg-stat-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 12px;
    min-width: 0;
    flex: 1 1 0;
    width: 100%;
    box-sizing: border-box;
}

/* Боевые параметры */
.combat-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 6px;
}

/* Модальное окно прокачки */
#stats-modal .modal-content {
    background: linear-gradient(180deg, #1a2744 0%, #0d1829 100%);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

/* Редизайн верхней панели для iOS/Android */
html[data-platform="ios"] #profile-screen {
    padding-top: calc(0.75rem + 60px) !important;
}

html[data-platform="android"] #profile-screen {
    padding-top: calc(0.75rem + 50px) !important;
}
