/* CSS Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS переменные */
:root {
    --bg-dark: #1a1a1a;
    --bg-card: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-red: #dc3545;
    --border-radius: 12px;
    --border-radius-small: 8px;
}

/* Базовые стили */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-container {
    min-height: 100vh;
    background: var(--bg-dark);
}

/* Стили для страниц */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    padding-bottom: 80px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-dark);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.camera-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icons {
    display: flex;
    gap: 8px;
}

.header-icon {
    font-size: 18px;
    color: var(--text-secondary);
}

.close-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
}

.close-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.close-icon {
    font-size: 18px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Content */
.content {
    flex: 1;
    padding: 20px;
}

/* Tournament Section */
.tournament-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--border-radius-small);
    font-size: 14px;
    cursor: pointer;
}

.filter-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.location-icon {
    font-size: 16px;
}

.chevron {
    font-size: 12px;
}

.tournament-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tournament-info {
    flex: 1;
}

.tournament-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.tournament-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-primary);
}

.badge-icon {
    font-size: 14px;
}

.badge.date {
    background: rgba(74, 158, 255, 0.2);
}

.badge.sold-out {
    background: rgba(220, 53, 69, 0.2);
}

.tournament-image {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 53, 69, 0.2);
    border-radius: 50%;
}

.chip-logo {
    font-size: 32px;
    color: var(--accent-red);
}

/* Rating Section */
.rating-section {
    margin-bottom: 24px;
}

.rating-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    position: relative;
}

.rating-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.rating-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.rating-btn {
    width: 100%;
    background: var(--accent-red);
    border: none;
    border-radius: var(--border-radius-small);
    padding: 16px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rating-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.star-icon {
    font-size: 20px;
}

.trophy-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
}

/* Info Section */
.info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.info-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
}

.info-card:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.info-card h2 {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
}

/* About Section */
.about-section {
    text-align: center;
    margin-bottom: 24px;
}

.about-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.about-btn {
    width: 80px;
    height: 80px;
    background: var(--bg-card);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    cursor: pointer;
}

.about-btn:active {
    transform: scale(0.95);
}

.chip-icon {
    font-size: 40px;
    color: var(--accent-red);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 16px;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 12px;
}

/* Page Title */
.page-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

/* Rating Page Styles */
.rating-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-tab {
    flex: 1;
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    padding: 12px;
    border-radius: var(--border-radius-small);
    font-size: 14px;
    cursor: pointer;
}

.filter-tab.active {
    background: var(--accent-red);
    color: var(--text-primary);
}

.rating-filters-secondary {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-dropdown {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    padding: 12px;
    border-radius: var(--border-radius-small);
    font-size: 14px;
    cursor: pointer;
    justify-content: center;
}

.filter-dropdown:active {
    background: rgba(255, 255, 255, 0.1);
}

.filter-icon {
    font-size: 16px;
}

.leaderboard {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-col {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.header-col.sortable {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.sort-icon {
    font-size: 12px;
}

.leaderboard-body {
    max-height: 60vh;
    overflow-y: auto;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    background: var(--accent-red);
}

.player-nickname {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.player-stats {
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Agreement Page Styles */
.agreement-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

.agreement-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 24px;
}

.agreement-section {
    margin-bottom: 32px;
}

.agreement-section-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.agreement-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.agreement-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.agreement-date {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 16px;
    font-style: italic;
}

.scroll-indicator {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.scroll-indicator.hidden {
    display: none;
}

.agreement-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.accept-btn {
    width: 100%;
    background: var(--accent-red);
    border: none;
    border-radius: var(--border-radius-small);
    padding: 16px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.accept-btn:active:not(:disabled) {
    transform: scale(0.98);
    opacity: 0.9;
}

.accept-btn:disabled {
    background: rgba(220, 53, 69, 0.3);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Стили для новых страниц турниров */
.tournament-detail-section {
    margin-bottom: 24px;
}

.section-tab {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.tab-icon {
    font-size: 20px;
}

.tournament-info-section,
.tournament-rules-section,
.tournament-features-section,
.tournament-registration-section {
    margin-bottom: 24px;
}

.section-subtitle {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.info-icon {
    font-size: 18px;
}

.rules-text {
    color: var(--text-primary);
    line-height: 1.6;
}

.features-list {
    list-style: none;
    padding: 0;
}

.features-list li {
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-left: 24px;
    position: relative;
}

.features-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-red);
    font-size: 20px;
}

.badge-free {
    display: inline-block;
    background: #4a9eff;
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
}

.registration-card {
    background: var(--accent-red);
    border-radius: var(--border-radius);
    padding: 20px;
}

.registration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.registration-header h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: bold;
}

.info-icon-small {
    font-size: 18px;
}

.registration-text {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.participate-btn {
    width: 100%;
    background: var(--text-primary);
    border: none;
    border-radius: var(--border-radius);
    padding: 16px;
    color: var(--bg-dark);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 24px;
}

.participate-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Utility classes */
.hidden {
    display: none !important;
}
