/* Royal Game of Ur - High-End Game Styles */

:root {
    /* Color Palette */
    --primary-gold: #D4AF37;
    --primary-gold-dark: #B8941F;
    --primary-gold-light: #F4D03F;
    --secondary-burgundy: #800020;
    --secondary-burgundy-dark: #600018;
    --accent-royal-blue: #003366;
    --accent-emerald: #50C878;
    --accent-ruby: #E0115F;
    
    /* Neutral Colors */
    --bg-dark: #1A1A1A;
    --bg-medium: #2D2D2D;
    --bg-light: #3A3A3A;
    --text-primary: #FFFFFF;
    --text-secondary: #CCCCCC;
    --text-muted: #999999;
    
    /* Board Colors */
    --board-light: #F5DEB3;
    --board-dark: #8B4513;
    --rosette-gold: #FFD700;
    --rosette-highlight: #FFED4E;
    
    /* Game Piece Colors */
    --piece-player1: #4169E1;
    --piece-player1-light: #6495ED;
    --piece-player2: #DC143C;
    --piece-player2-light: #FF6B6B;
    
    /* Animations */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-medium: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.4);
    --shadow-ruby: 0 0 20px rgba(224, 17, 95, 0.4);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Game Container */
.game-container {
    display: grid;
    grid-template-areas: 
        "header header"
        "main sidebar";
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    gap: 20px;
    padding: 20px;
}

/* Game Header */
.game-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 16px;
    padding: 20px 30px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
}

.game-info {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.game-id {
    font-weight: 500;
}

.game-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-status.active {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #45B068 100%);
    color: white;
}

.game-status.waiting {
    background: linear-gradient(135deg, var(--accent-royal-blue) 0%, #002244 100%);
    color: white;
}

.game-status.completed {
    background: linear-gradient(135deg, var(--text-muted) 0%, #666666 100%);
    color: white;
}

/* Player Info */
.header-right {
    display: flex;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.player::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-slow);
}

.player.active {
    border-color: var(--primary-gold);
    box-shadow: var(--shadow-gold);
}

.player.active::before {
    left: 100%;
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-gold);
    box-shadow: var(--shadow-light);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
}

.player-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-gold);
}

.vs-indicator {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* Game Main */
.game-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Board Container */
.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-board {
    position: relative;
    width: 900px;
    height: 600px;
    background: url('../images/game board without pieces on the board.png') no-repeat center center;
    background-size: contain;
    margin: 0 auto; /* Center the board on the page */
}



/* Board Grid */
.board-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    width: 90%;
    height: 60%;
}

.board-tile {
    background: linear-gradient(135deg, var(--board-light) 0%, #DEB887 100%);
    border: 1px solid var(--board-dark);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--board-dark);
}

.board-tile:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-light);
}

.board-tile.rosette {
    background: linear-gradient(135deg, var(--rosette-gold) 0%, var(--rosette-highlight) 100%);
    border-color: var(--primary-gold-dark);
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.3);
}

.board-tile.rosette::before {
    content: '✦';
    position: absolute;
    font-size: 1.5rem;
    color: var(--primary-gold-dark);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.board-tile.valid-move {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #45B068 100%);
    animation: pulse 2s infinite;
}

.board-tile.selected {
    border: 3px solid var(--primary-gold);
    box-shadow: var(--shadow-gold);
}

/* Game Pieces */
.pieces-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.game-piece {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-medium);
    box-shadow: var(--shadow-medium);
    border: 3px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.game-piece.player-1 {
    background: linear-gradient(135deg, var(--piece-player1) 0%, var(--piece-player1-light) 100%);
}

.game-piece.player-2 {
    background: linear-gradient(135deg, var(--piece-player2) 0%, var(--piece-player2-light) 100%);
}

.game-piece:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-heavy);
}

.game-piece.selected {
    border-color: var(--primary-gold);
    box-shadow: var(--shadow-gold);
    animation: glow 1.5s infinite alternate;
}

.game-piece.moving {
    z-index: 100;
    animation: movePiece 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dice Container */
.dice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dice-roller {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.dice {
    width: 80px;
    height: 80px;
    perspective: 1000px;
}

.dice-face {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--text-primary) 0%, #F0F0F0 100%);
    border-radius: 12px;
    box-shadow: var(--shadow-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--transition-medium);
}

.dice.rolling .dice-face {
    animation: rollDice 1s ease-in-out;
}

.dice-dots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    width: 60px;
    height: 60px;
}

.dice-dot {
    width: 12px;
    height: 12px;
    background: var(--bg-dark);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.dice-dot.active {
    opacity: 1;
}

.roll-button {
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-dark) 100%);
    border: none;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.roll-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

.roll-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.roll-button:hover:not(:disabled) .button-glow {
    left: 100%;
}

.dice-result {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* Move Controls */
.move-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.move-indicator {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
}

.move-text {
    font-size: 1rem;
    margin-bottom: 10px;
}

.move-highlight {
    height: 4px;
    background: linear-gradient(90deg, var(--primary-gold) 0%, var(--primary-gold-light) 100%);
    border-radius: 2px;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.move-highlight.active {
    opacity: 1;
    animation: moveHighlight 2s infinite;
}

.move-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.move-option {
    padding: 12px 20px;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-medium);
    text-align: center;
    font-weight: 500;
}

.move-option:hover {
    border-color: var(--primary-gold);
    background: rgba(212, 175, 55, 0.1);
}

.move-option.selected {
    border-color: var(--primary-gold);
    background: rgba(212, 175, 55, 0.2);
}

/* Game Actions */
.game-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.action-button.secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-button.secondary:hover:not(:disabled) {
    background: var(--bg-medium);
    border-color: var(--primary-gold);
}

.action-button.danger {
    background: linear-gradient(135deg, var(--accent-ruby) 0%, #C41E3A 100%);
    color: white;
}

.action-button.danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-ruby);
}

.action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-icon {
    font-size: 1.1rem;
}

/* Game Sidebar */
.game-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-gold);
    margin-bottom: 15px;
    text-align: center;
}

/* Game Log */
.game-log {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary-gold);
}

.log-entry.player-1 {
    border-left-color: var(--piece-player1);
}

.log-entry.player-2 {
    border-left-color: var(--piece-player2);
}

.log-entry.system {
    border-left-color: var(--accent-emerald);
}

/* Game Stats */
.game-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.stat-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-gold);
}

/* Game Settings */
.game-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-item {
    display: flex;
    align-items: center;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-medium);
}

.setting-label:hover {
    color: var(--text-primary);
}

.setting-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: var(--bg-light);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition-medium);
}

.setting-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
}

.setting-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px var(--primary-gold); }
    100% { box-shadow: 0 0 20px var(--primary-gold), 0 0 30px var(--primary-gold); }
}

@keyframes moveHighlight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-secondary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.modal-header {
    margin-bottom: 30px;
}

.modal-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-gold);
    margin-bottom: 10px;
}

.modal-body {
    margin-bottom: 30px;
}

.game-result {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.game-result.winner {
    color: var(--accent-emerald);
}

.game-result.loser {
    color: var(--accent-ruby);
}

.final-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-dark);
    padding: 20px;
    border-radius: 12px;
}

.modal-footer {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-button {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-button.primary {
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-dark) 100%);
    color: white;
}

.modal-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

.modal-button.secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-button.secondary:hover {
    background: var(--bg-medium);
    border-color: var(--primary-gold);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr 250px;
    }
}

@media (max-width: 768px) {
    .game-container {
        grid-template-areas: 
            "header"
            "main"
            "sidebar";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    
    .game-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .game-board {
        width: 100%;
        max-width: 500px;
        height: 350px;
    }
    
    .board-grid {
        width: 95%;
        height: 70%;
    }
    
    .game-piece {
        width: 35px;
        height: 35px;
    }
    
    .dice {
        width: 70px;
        height: 70px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
        gap: 10px;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .player-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-board {
        height: 300px;
    }
    
    .board-grid {
        grid-template-columns: repeat(8, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    
    .game-piece {
        width: 30px;
        height: 30px;
    }
    
    .dice {
        width: 60px;
        height: 60px;
    }
    
    .game-actions {
        flex-direction: column;
    }
    
    .modal-footer {
        flex-direction: column;
    }
}