﻿/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* Переменные цветов для Telegram темы */
:root {
    --primary-color: var(--tg-theme-button-color, #2481cc);
    --secondary-color: var(--tg-theme-secondary-bg-color, #f1f1f1);
    --text-color: var(--tg-theme-text-color, #000000);
    --hint-color: var(--tg-theme-hint-color, #999999);
    --bg-color: var(--tg-theme-bg-color, #ffffff);
    --section-bg: var(--tg-theme-section-bg-color, #ffffff);
    --accent-text: var(--tg-theme-accent-text-color, #2481cc);
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
}

/* Загрузочный экран */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--secondary-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Утилиты */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Хедер */
.header {
    background: var(--section-bg);
    padding: 12px 16px;
    border-bottom: 1px solid var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance {
    font-weight: 600;
    color: var(--success-color);
    font-size: 18px;
}

.stats {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: var(--hint-color);
}

/* Вкладки */
.tabs {
    display: flex;
    background: var(--section-bg);
    border-bottom: 1px solid var(--secondary-color);
}

.tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--hint-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab:hover {
    background: var(--secondary-color);
}

/* Контент вкладок */
.tab-content {
    height: calc(100vh - 120px);
    overflow: hidden;
}

.tab-pane {
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Карта */
#map-tab {
    padding: 0;
}

#map-container {
    position: relative;
    height: 100%;
}

#map {
    height: 100%;
    width: 100%;
}

.map-controls {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 1000;
}

.map-btn {
    flex: 1;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.map-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.map-btn:active {
    transform: translateY(0);
}

/* Заголовки секций */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    color: var(--text-color);
    font-size: 18px;
}

/* Кнопки */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Карточки локаций */
.location-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.location-card {
    background: var(--section-bg);
    border: 1px solid var(--secondary-color);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.location-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.location-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
}

.location-distance {
    font-size: 12px;
    color: var(--hint-color);
    background: var(--secondary-color);
    padding: 4px 8px;
    border-radius: 12px;
}

.location-address {
    color: var(--hint-color);
    font-size: 14px;
    margin-bottom: 8px;
}

.location-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.location-type {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.location-reward {
    color: var(--success-color);
    font-weight: 600;
}

.location-price {
    color: var(--warning-color);
    font-weight: 600;
}

.location-actions {
    display: flex;
    gap: 8px;
}

.location-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-available {
    background: var(--success-color);
    color: white;
}

.status-visited {
    background: var(--primary-color);
    color: white;
}

.status-owned {
    background: var(--warning-color);
    color: white;
}

.status-far {
    background: var(--secondary-color);
    color: var(--hint-color);
}

/* Карточки владений */
.properties-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.property-card {
    background: var(--section-bg);
    border: 1px solid var(--secondary-color);
    border-radius: 12px;
    padding: 16px;
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.property-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.property-stat {
    text-align: center;
    padding: 8px;
    background: var(--secondary-color);
    border-radius: 6px;
}

.property-stat-label {
    font-size: 12px;
    color: var(--hint-color);
    margin-bottom: 4px;
}

.property-stat-value {
    font-weight: 600;
    color: var(--text-color);
}

/* Профиль */
.profile-card {
    background: var(--section-bg);
    border: 1px solid var(--secondary-color);
    border-radius: 12px;
    padding: 20px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--secondary-color);
}

.profile-row:last-child {
    border-bottom: none;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
}

.modal-content {
    background: var(--bg-color);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--secondary-color);
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--hint-color);
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
}

/* Уведомления */
.notifications {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 11000;
    pointer-events: none;
}

.notification {
    background: var(--section-bg);
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--error-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Пустые состояния */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--hint-color);
}

.empty-state p {
    font-size: 16px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 480px) {
    .header {
        padding: 8px 12px;
    }
    
    .tab-pane {
        padding: 12px;
    }
    
    .location-card, .property-card, .profile-card {
        padding: 12px;
    }
    
    .map-controls {
        bottom: 12px;
        left: 12px;
        right: 12px;
    }
}

/* Leaflet карта стили */
.leaflet-popup-content {
    font-family: inherit;
    color: var(--text-color);
}

.leaflet-control-zoom {
    border-radius: 8px !important;
}

.leaflet-control-zoom a {
    background: var(--section-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--secondary-color) !important;
}

/* Кастомные маркеры */
.location-marker {
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.location-marker.visited {
    background: var(--success-color);
}

.location-marker.owned {
    background: var(--warning-color);
}

.player-marker {
    background: var(--error-color);
    border: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}