/**
 * LaterGamer Game Framework CSS
 * Common styles for all browser-based games
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    --lg-primary: #6f42c1;
    --lg-secondary: #20c997;
    --lg-accent: #e94560;
    --lg-dark: #1a1a2e;
    --lg-darker: #16213e;
    --lg-light: #f8f9fa;
    --lg-success: #28a745;
    --lg-warning: #ffc107;
    --lg-danger: #dc3545;
    --lg-info: #17a2b8;

    --lg-card-bg: rgba(255, 255, 255, 0.1);
    --lg-card-border: rgba(111, 66, 193, 0.3);
    --lg-text: #ffffff;
    --lg-text-muted: rgba(255, 255, 255, 0.7);

    --lg-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --lg-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);

    --lg-transition: all 0.3s ease;
    --lg-radius: 8px;
    --lg-radius-lg: 16px;
}

/* ==================== RESET & BASE ==================== */
.lg-game-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--lg-dark) 0%, var(--lg-darker) 100%);
    color: var(--lg-text);
    margin: 0;
    padding: 0;
    min-height: 100%;
    position: relative;
    overflow: hidden;
}

.lg-game-container * {
    box-sizing: border-box;
}

/* ==================== CANVAS ==================== */
#game-canvas {
    display: block;
    margin: 0 auto;
    background: var(--lg-darker);
    border-radius: var(--lg-radius);
    box-shadow: var(--lg-shadow-lg);
}

/* ==================== UI CONTAINERS ==================== */
.lg-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 33, 62, 0.95);
    z-index: 100;
}

.lg-ui.hidden {
    display: none;
}

/* ==================== MENU ==================== */
.lg-menu-content,
.lg-gameover-content {
    text-align: center;
    padding: 40px;
    background: var(--lg-card-bg);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius-lg);
    box-shadow: var(--lg-shadow-lg);
    backdrop-filter: blur(10px);
    max-width: 400px;
    width: 90%;
}

.lg-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 30px 0;
    background: linear-gradient(135deg, var(--lg-primary), var(--lg-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lg-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== BUTTONS ==================== */
.lg-btn {
    display: inline-block;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--lg-text);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
    cursor: pointer;
    transition: var(--lg-transition);
}

.lg-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--lg-primary);
    transform: translateY(-2px);
    box-shadow: var(--lg-shadow);
}

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

.lg-btn-primary {
    background: linear-gradient(135deg, var(--lg-primary), #8b5cf6);
    border-color: var(--lg-primary);
}

.lg-btn-primary:hover {
    background: linear-gradient(135deg, #8b5cf6, var(--lg-primary));
    border-color: #8b5cf6;
}

.lg-btn-secondary {
    background: linear-gradient(135deg, var(--lg-secondary), #10b981);
    border-color: var(--lg-secondary);
}

.lg-btn-secondary:hover {
    background: linear-gradient(135deg, #10b981, var(--lg-secondary));
    border-color: #10b981;
}

.lg-btn-accent {
    background: linear-gradient(135deg, var(--lg-accent), #f43f5e);
    border-color: var(--lg-accent);
}

.lg-btn-accent:hover {
    background: linear-gradient(135deg, #f43f5e, var(--lg-accent));
    border-color: #f43f5e;
}

.lg-btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
    color: var(--lg-text);
    cursor: pointer;
    transition: var(--lg-transition);
}

.lg-btn-sm:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--lg-primary);
}

/* ==================== HUD ==================== */
.lg-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(22, 33, 62, 0.9) 0%, rgba(22, 33, 62, 0) 100%);
    z-index: 50;
}

.lg-hud-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.lg-hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--lg-card-bg);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
}

.lg-hud-label {
    color: var(--lg-text-muted);
    font-size: 0.875rem;
}

.lg-hud-value {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--lg-secondary);
}

.lg-hud-controls {
    display: flex;
    gap: 10px;
}

/* ==================== GAME OVER ==================== */
.lg-gameover-stats {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--lg-radius);
}

.lg-gameover-stats p {
    margin: 10px 0;
    font-size: 1.25rem;
}

.lg-gameover-stats span {
    color: var(--lg-secondary);
    font-weight: 700;
}

/* ==================== CARDS ==================== */
.lg-card {
    width: 70px;
    height: 100px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
}

.lg-card:hover {
    transform: translateY(-5px);
}

.lg-card.hearts, .lg-card.diamonds {
    color: #dc3545;
}

.lg-card.clubs, .lg-card.spades {
    color: #1a1a2e;
}

.lg-card.face-down {
    background: linear-gradient(135deg, var(--lg-primary) 0%, var(--lg-darker) 100%);
    background-image:
        repeating-linear-gradient(45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.1) 10px,
            rgba(255,255,255,0.1) 20px);
}

.lg-card-mini {
    position: absolute;
    font-size: 0.75rem;
}

.lg-card-mini.top-left {
    top: 4px;
    left: 4px;
}

.lg-card-mini.bottom-right {
    bottom: 4px;
    right: 4px;
    transform: rotate(180deg);
}

/* ==================== DICE ==================== */
.lg-dice {
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    gap: 2px;
}

.lg-dice-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--lg-dark);
}

.lg-dice-dot.hidden {
    visibility: hidden;
}

.lg-dice.rolling {
    animation: dice-roll 0.5s ease-in-out;
}

@keyframes dice-roll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg) scale(1.1); }
    50% { transform: rotate(-15deg) scale(1.1); }
    75% { transform: rotate(10deg); }
}

/* ==================== GAME BOARD ==================== */
.lg-board {
    display: grid;
    gap: 2px;
    background: var(--lg-darker);
    border: 2px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
    padding: 4px;
}

.lg-board-cell {
    background: var(--lg-card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--lg-transition);
}

.lg-board-cell:hover {
    background: rgba(111, 66, 193, 0.3);
}

.lg-board-cell.active {
    background: var(--lg-primary);
}

.lg-board-cell.highlight {
    background: rgba(32, 201, 151, 0.3);
    border: 2px solid var(--lg-secondary);
}

/* ==================== CHIP / TOKEN ==================== */
.lg-chip {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lg-chip.red { background: linear-gradient(135deg, #dc3545, #c82333); }
.lg-chip.blue { background: linear-gradient(135deg, #007bff, #0056b3); }
.lg-chip.green { background: linear-gradient(135deg, #28a745, #1e7e34); }
.lg-chip.yellow { background: linear-gradient(135deg, #ffc107, #d39e00); color: #1a1a2e; }
.lg-chip.purple { background: linear-gradient(135deg, var(--lg-primary), #5a32a3); }
.lg-chip.white { background: linear-gradient(135deg, #fff, #e0e0e0); color: #1a1a2e; }
.lg-chip.black { background: linear-gradient(135deg, #333, #1a1a2e); }

/* ==================== PLAYER LIST ==================== */
.lg-player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: var(--lg-card-bg);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
}

.lg-player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--lg-radius);
}

.lg-player-item.active {
    border: 2px solid var(--lg-secondary);
    background: rgba(32, 201, 151, 0.1);
}

.lg-player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--lg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.lg-player-info {
    flex: 1;
}

.lg-player-name {
    font-weight: 600;
}

.lg-player-score {
    font-size: 0.875rem;
    color: var(--lg-text-muted);
}

.lg-player-badge {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    background: var(--lg-primary);
}

.lg-player-badge.host {
    background: var(--lg-warning);
    color: #1a1a2e;
}

.lg-player-badge.ai {
    background: var(--lg-accent);
}

/* ==================== CHAT / LOG ==================== */
.lg-chat {
    display: flex;
    flex-direction: column;
    height: 200px;
    background: var(--lg-card-bg);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
    overflow: hidden;
}

.lg-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.lg-chat-message {
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.lg-chat-message .sender {
    font-weight: 600;
    color: var(--lg-secondary);
}

.lg-chat-input {
    display: flex;
    border-top: 1px solid var(--lg-card-border);
}

.lg-chat-input input {
    flex: 1;
    padding: 10px;
    border: none;
    background: rgba(0, 0, 0, 0.2);
    color: var(--lg-text);
}

.lg-chat-input button {
    padding: 10px 15px;
    background: var(--lg-primary);
    border: none;
    color: var(--lg-text);
    cursor: pointer;
}

/* ==================== MODALS ==================== */
.lg-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lg-modal.hidden {
    display: none;
}

.lg-modal-content {
    background: var(--lg-darker);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius-lg);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--lg-shadow-lg);
}

.lg-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lg-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.lg-modal-close {
    background: none;
    border: none;
    color: var(--lg-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.lg-modal-close:hover {
    color: var(--lg-text);
}

/* ==================== FORMS ==================== */
.lg-form-group {
    margin-bottom: 15px;
}

.lg-label {
    display: block;
    margin-bottom: 5px;
    color: var(--lg-text-muted);
    font-size: 0.875rem;
}

.lg-input, .lg-select {
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
    color: var(--lg-text);
    font-size: 1rem;
}

.lg-input:focus, .lg-select:focus {
    outline: none;
    border-color: var(--lg-primary);
}

/* ==================== NOTIFICATIONS ==================== */
.lg-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: var(--lg-card-bg);
    border: 1px solid var(--lg-card-border);
    border-radius: var(--lg-radius);
    box-shadow: var(--lg-shadow-lg);
    z-index: 2000;
    animation: slide-in 0.3s ease;
}

.lg-notification.success {
    border-color: var(--lg-success);
    background: rgba(40, 167, 69, 0.2);
}

.lg-notification.error {
    border-color: var(--lg-danger);
    background: rgba(220, 53, 69, 0.2);
}

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

/* ==================== LOADING ==================== */
.lg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.lg-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--lg-card-border);
    border-top-color: var(--lg-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .lg-title {
        font-size: 2rem;
    }

    .lg-menu-content,
    .lg-gameover-content {
        padding: 25px;
    }

    .lg-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .lg-hud-content {
        flex-direction: column;
        align-items: stretch;
    }

    .lg-card {
        width: 55px;
        height: 80px;
        font-size: 1.2rem;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
