/* css/style.css */

/* ============================================================================
   ОБЩИЕ СТИЛИ
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

h1 {
    color: #fff;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
    color: #444;
    margin-bottom: 15px;
}

h3 {
    color: #555;
    margin-bottom: 10px;
}

/* ============================================================================
   ФОРМЫ И КНОПКИ
   ============================================================================ */

.form-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 400px;
    margin: 0 auto;
}

.tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    background: rgba(255,255,255,0.3);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.tab:hover {
    background: rgba(255,255,255,0.5);
}

.tab.active {
    background: white;
    color: #667eea;
    font-weight: bold;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

button,
.btn-primary,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

button[type="submit"],
.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

button[type="submit"]:hover,
.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:disabled,
.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-large {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
}

.error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

/* ============================================================================
   ЛОББИ
   ============================================================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.2);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    color: white;
}

.lobby-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

.create-game,
.games-list {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.games-list table {
    width: 100%;
    border-collapse: collapse;
}

.games-list th,
.games-list td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.games-list th {
    background: #f8f9fa;
    font-weight: bold;
}

.games-list tr:hover {
    background: #f8f9fa;
}

.empty {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* ============================================================================
   ИГРОВОЙ ЭКРАН
   ============================================================================ */

.game-body {
    background: #1a1a2e;
    color: #eee;
}

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

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.1);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.game-info h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

#round-info {
    color: #ffd700;
    font-size: 18px;
}

.game-board {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 20px;
}

/* ============================================================================
   ИГРОКИ
   ============================================================================ */

.players-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-card {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.player-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.player-you {
    border-color: #ffd700;
    background: rgba(255,215,0,0.1);
}

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

.player-name {
    font-weight: bold;
    font-size: 16px;
}

.card-selected {
    color: #2ecc71;
    font-size: 14px;
}

.player-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.stat {
    display: flex;
    gap: 5px;
}

.stat .label {
    color: #aaa;
}

.stat .value {
    color: #ffd700;
    font-weight: bold;
}

.player-victories {
    font-size: 20px;
}

/* ============================================================================
   ЦЕНТРАЛЬНАЯ ОБЛАСТЬ (КУБИКИ И ЛОГ)
   ============================================================================ */

.center-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dice-area {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    min-height: 150px;
}

.dice-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.dice-item {
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
}

.dice-player {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 5px;
}

.dice-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
}

.dice-canceled {
    opacity: 0.5;
}

.dice-status {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
}

.game-log {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.game-log h3 {
    color: #fff;
    margin-bottom: 10px;
}

#log-messages {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.log-message {
    padding: 8px;
    border-radius: 5px;
    font-size: 14px;
}

.log-info {
    background: rgba(52, 152, 219, 0.2);
}

.log-success {
    background: rgba(46, 204, 113, 0.2);
}

.log-error {
    background: rgba(231, 76, 60, 0.2);
}

/* ============================================================================
   КАРТЫ ИГРОКА
   ============================================================================ */

.your-hand-container {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
}

.your-hand-container h3 {
    color: #fff;
    margin-bottom: 15px;
}

.your-hand {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
}

.card:hover {
    transform: translateX(5px);
    border-color: #ffd700;
    box-shadow: 0 5px 15px rgba(255,215,0,0.3);
}

.card-disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.card-disabled:hover {
    transform: none;
    border-color: transparent;
    box-shadow: none;
}

.card-selected {
    border-color: #2ecc71;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

.card-name {
    font-weight: bold;
    font-size: 16px;
}

.card-status {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
}

.card-info {
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.card-info h4 {
    color: #ffd700;
    margin-bottom: 5px;
}

.card-info p {
    font-size: 14px;
    color: #ddd;
}

/* ============================================================================
   КНОПКА СТАРТА
   ============================================================================ */

.start-game-container {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.hint {
    color: #aaa;
    font-size: 14px;
    margin-top: 10px;
}

/* ============================================================================
   МОДАЛЬНЫЕ ОКНА
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    text-align: center;
}

.winner-announce {
    font-size: 24px;
    color: #667eea;
    margin-bottom: 20px;
}

.final-scores {
    margin: 20px 0;
}

.score-line {
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 5px;
}

/* ============================================================================
   АДАПТИВНОСТЬ
   ============================================================================ */

@media (max-width: 1200px) {
    .game-board {
        grid-template-columns: 1fr;
    }
    
    .lobby-content {
        grid-template-columns: 1fr;
    }
}

.loading {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* ============================================================================
   МОДАЛЬНОЕ ОКНО ЧАРОДЕЙ
   ============================================================================ */

.wizard-modal-content {
    max-width: 600px;
    padding: 40px;
}

.wizard-info {
    text-align: center;
    font-size: 18px;
    margin-bottom: 20px;
    color: #667eea;
}

.wizard-info strong {
    font-size: 32px;
    color: #764ba2;
}

.wizard-instruction {
    text-align: center;
    font-size: 16px;
    margin-bottom: 20px;
    color: #555;
}

.wizard-choices {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 30px 0;
}

.wizard-choice-btn {
    padding: 20px;
    font-size: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.wizard-choice-btn:hover {
    transform: scale(1.05);
    border-color: #ffd700;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.wizard-choice-btn:active {
    transform: scale(0.95);
}

.wizard-hint {
    text-align: center;
    font-size: 14px;
    color: #999;
    font-style: italic;
    margin-top: 20px;
}

/* Адаптация для 5 кнопок (прилегающие грани) */
.wizard-choices button:nth-child(4),
.wizard-choices button:nth-child(5) {
    grid-column: span 1;
}

/* Если ровно 5 кнопок - центрируем последние две */
.wizard-choices:has(button:nth-child(5):last-child) {
    grid-template-columns: repeat(5, 1fr);
}

/* Анимация появления модального окна */
@keyframes wizardModalAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal[style*="display: flex"] .wizard-modal-content {
    animation: wizardModalAppear 0.3s ease-out;
}