/* ========================================
   LLAMA CHECKERS - SIMPLIFIED STYLES
   Beautiful board, clean UI, no bloat!
   ======================================== */

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

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary-color: #e74c3c;
    --primary-hover: #c0392b;
    --secondary-color: #3498db;
    --secondary-hover: #2980b9;
    --accent-color: #f39c12;
    
    /* Background & Text */
    --background-color: #fff8f3;
    --card-background: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #ece0d1;
    
    /* Shadows */
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.12);
    --shadow-large: rgba(0, 0, 0, 0.16);
    
    /* Success & Danger */
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    
    /* Board Colors - THE BEAUTIFUL ONES! */
    --board-light: #f0d9b5;
    --board-dark: #b58863;
    --piece-red: #dc3545;
    --piece-black: #212529;
    
    /* Highlights */
    --highlight-selected: rgba(255, 255, 0, 0.5);
    --highlight-valid: rgba(0, 255, 0, 0.3);
    --highlight-last: rgba(255, 255, 0, 0.2);
    
    /* AI Colors */
    --ai-primary: #6c5ce7;
    --ai-bg-light: #f8f9ff;
}

/* Body */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(231, 76, 60, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(52, 152, 219, 0.05) 0%, transparent 50%);
    min-height: 100vh;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.section {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   LOBBY SECTION
   ======================================== */

.logo-section {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-section h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

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

/* Game Mode Cards */
.game-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto 2rem;
}

.mode-card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px var(--shadow-medium);
    transition: all 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-large);
}

.mode-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.mode-header p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.mode-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-difficulty {
    flex: 1;
    min-width: 90px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-difficulty:hover {
    background: var(--ai-primary);
    color: white;
    border-color: var(--ai-primary);
    transform: scale(1.05);
}

.btn-difficulty:active {
    transform: scale(0.98);
}

/* Join Group */
.join-group {
    display: flex;
    gap: 0.5rem;
}

.join-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 2px;
}

.join-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.divider {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* Tutorial Section */
.tutorial-section {
    text-align: center;
    margin-top: 2rem;
}

.tutorial-link {
    display: inline-block;
    color: var(--secondary-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.tutorial-link:hover {
    background: var(--ai-bg-light);
}

/* ========================================
   WAITING ROOM
   ======================================== */

.waiting-card {
    max-width: 500px;
    margin: 4rem auto;
    background: var(--card-background);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 8px 24px var(--shadow-medium);
    text-align: center;
}

.waiting-card h2 {
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.room-code-display {
    margin: 2rem 0;
}

.room-code-display label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.code {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--primary-color);
    margin: 1rem 0;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
}

.btn-copy {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: var(--secondary-hover);
}

.waiting-message {
    color: var(--text-secondary);
    margin: 1.5rem 0;
}

.spinner {
    font-size: 1.5rem;
    margin: 2rem 0;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   GAME SECTION
   ======================================== */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.player-info strong {
    color: var(--primary-color);
}

.turn-indicator {
    padding: 0.5rem 1rem;
    background: var(--success-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.connection-status {
    font-size: 0.9rem;
}

.game-controls {
    display: flex;
    gap: 0.75rem;
}

/* Board Container - THE BEAUTIFUL PART! */
.board-container {
    max-width: 800px;
    margin: 0 auto 1.5rem;
    padding: 1rem;
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: 0 8px 24px var(--shadow-large);
}

.board {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    touch-action: none;
    user-select: none;
}

/* Board Squares (SVG styling) */
.square {
    cursor: pointer;
    transition: opacity 0.2s;
}

.square:hover {
    opacity: 0.9;
}

.square.light {
    fill: var(--board-light);
}

.square.dark {
    fill: var(--board-dark);
}

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

.piece {
    position: absolute;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.3s ease, filter 0.2s;
}

.piece:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.piece.red circle {
    fill: var(--piece-red);
    stroke: #8b0000;
    stroke-width: 2;
}

.piece.black circle {
    fill: var(--piece-black);
    stroke: #000;
    stroke-width: 2;
}

/* King Pieces */
.piece.king text {
    fill: white;
    font-size: 24px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* Highlights */
.highlight-selected {
    fill: var(--highlight-selected);
    pointer-events: none;
}

.highlight-valid {
    fill: var(--highlight-valid);
    cursor: pointer;
    pointer-events: auto;
}

.highlight-last {
    fill: var(--highlight-last);
    pointer-events: none;
}

/* Game Status */
.game-status {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.status-message {
    font-size: 1.2rem;
    color: var(--text-primary);
    padding: 1rem;
}

.ai-thinking {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--ai-bg-light);
    border-radius: 12px;
    margin: 1rem 0;
    animation: pulse 1.5s infinite;
}

.thinking-spinner {
    font-size: 1.5rem;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn.secondary {
    background: var(--secondary-color);
    color: white;
}

.btn.secondary:hover {
    background: var(--secondary-hover);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn.danger {
    background: var(--danger-color);
    color: white;
}

.btn.danger:hover {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn.large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: var(--card-background);
    border-radius: 16px;
    padding: 3rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 2rem;
}

.modal-content p {
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--danger-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(400px); }
    to { transform: translateX(0); }
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .logo-section h1 {
        font-size: 2rem;
    }

    .game-modes {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .mode-card {
        padding: 1.5rem;
    }

    .difficulty-buttons {
        flex-direction: column;
    }

    .btn-difficulty {
        min-width: auto;
    }

    .game-header {
        flex-direction: column;
        text-align: center;
    }

    .player-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .code {
        font-size: 2rem;
        letter-spacing: 4px;
    }
}

@media (max-width: 480px) {
    #app {
        padding: 1rem 0.5rem;
    }

    .waiting-card {
        padding: 2rem 1.5rem;
    }

    .modal-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }
}

