/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Экраны */
.screen {
    display: none;
    background: #e5e7eb;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.screen.active {
    display: block;
}

/* Убираем лишние отступы и белые поля */
.screen {
    min-height: auto !important;
    max-height: none !important;
    margin-bottom: 0 !important;
}

/* Скрываем пустые элементы */
#room-info:empty,
.game-info:empty {
    display: none;
}

/* Убираем лишние отступы у элементов */
#game-result,
#profile,
#leaderboard {
    padding-bottom: 20px;
}

#game-status {
    white-space: pre-line;
    line-height: 1.6;
}

/* Заголовки */
h1 {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 30px;
    color: #4a5568;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 25px;
    color: #2d3748;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
}

.btn-info {
    background: linear-gradient(45deg, #4299e1, #3182ce);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #ed8936, #dd6b20);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #f56565, #e53e3e);
    color: white;
}

/* Главное меню */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.menu-buttons .btn {
    min-width: 250px;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #718096;
    font-style: italic;
}

/* Группы кнопок */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

/* Игровое поле */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.room-id-display {
    background: #e6fffa;
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid #38b2ac;
    color: #2c7a7b;
    font-size: 14px;
}

#timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e53e3e;
}

/* Шашечная доска */
.checkers-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 400px;
    height: 400px;
    margin: 0 auto 20px;
    border: 3px solid #8B4513;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.board-cell {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.board-cell:hover {
    transform: scale(1.05);
}

.board-cell.white {
    background-color: #F5DEB3; /* Бежевый */
}

.board-cell.black {
    background-color: #8B4513; /* Коричневый */
}

.board-cell.selected {
    background-color: #48bb78 !important;
    box-shadow: inset 0 0 0 3px #38a169;
}

.board-cell.possible-move {
    background-color: #ed8936 !important;
    box-shadow: inset 0 0 0 3px #dd6b20;
}

/* Шашки */
.checker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 3px solid #2d3748;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.checker.white {
    background: radial-gradient(circle at 30% 30%, #ffffff, #f0f0f0);
    border: 3px solid #d4d4d4;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.8),
        inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.checker.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #2d2d2d);
    border: 3px solid #1a1a1a;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.checker.king::after {
    content: '👑';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.checker.selected {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 
        0 0 20px rgba(72, 187, 120, 0.8),
        0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Информация об игре */
.game-info {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
}

#game-status {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a5568;
}

/* room-info удален из HTML */

/* Профиль */
.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

/* Скрываем пустые элементы */
#room-info:empty,
.game-info:empty {
    display: none;
}

.stat-item {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #2d3748;
}

/* Таблица лидеров */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.leaderboard-list {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
}

.leaderboard-name {
    flex: 1;
    margin: 0 15px;
}

.leaderboard-score {
    font-weight: bold;
    color: #2d3748;
}

/* Уведомления */
#notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-left: 4px solid #48bb78;
    animation: slideIn 0.3s ease;
}

.notification.error {
    border-left-color: #f56565;
}

.notification.warning {
    border-left-color: #ed8936;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Список комнат */
.rooms-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.room-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.room-id {
    font-weight: bold;
    color: #495057;
}

.room-type {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.room-type.free {
    background: #d4edda;
    color: #155724;
}

.room-type.paid {
    background: #fff3cd;
    color: #856404;
}

.room-details {
    margin-bottom: 10px;
}

.room-info {
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
}

.room-bet, .room-time {
    font-size: 14px;
    color: #6c757d;
}

.room-creator {
    font-size: 14px;
    color: #6c757d;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.loading, .error, .no-rooms {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.error {
    color: #dc3545;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .checkers-board {
        width: 300px;
        height: 300px;
    }
    
    .checker {
        width: 25px;
        height: 25px;
    }
    
    .menu-buttons .btn {
        min-width: 200px;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .checkers-board {
        width: 250px;
        height: 250px;
    }
    
    .checker {
        width: 20px;
        height: 20px;
    }
}

/* Стили для отображения хода */
#current-player {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: inline-block;
}

#current-player.your-turn {
    background-color: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
    border: 2px solid rgba(76, 175, 80, 0.5);
    animation: pulse-green 1s infinite;
}

#current-player.opponent-turn {
    background-color: rgba(244, 67, 54, 0.2);
    color: #c62828;
    border: 2px solid rgba(244, 67, 54, 0.5);
}

@keyframes pulse-green {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Экран результата игры */
#game-result {
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

#result-content h2 {
    margin: 20px 0;
    font-size: 2.5rem;
}

#result-content p {
    font-size: 1.2rem;
    margin: 10px 0;
}

#result-ok-btn {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 18px;
}
