/* Sjuan Game Styles */

/* ================================
   Body & Container
   ================================ */

body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 20px;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.back-to-games {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background 0.3s;
}

.back-to-games:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ================================
   Layout & Screens
   ================================ */

.welcome-screen,
.lobby-screen,
.game-screen {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.welcome-screen h2 {
    color: #1e3c72;
    margin-bottom: 25px;
    text-align: center;
}

/* ================================
   Form Elements
   ================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
}

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

.form-group input:focus {
    outline: none;
    border-color: #1e3c72;
}

.divider {
    text-align: center;
    margin: 25px 0;
    color: #999;
    font-size: 14px;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #ddd;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.saved-rooms-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

/* ================================
   Lobby Screen
   ================================ */

.lobby-screen h2 {
    color: #1e3c72;
    text-align: center;
    margin-bottom: 25px;
}

.lobby-info {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.info-item {
    margin-bottom: 10px;
    font-size: 16px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.btn-copy {
    background: #1e3c72;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-copy:hover {
    background: #2a5298;
}

.lobby-players {
    background: #fff;
    border: 2px solid #1e3c72;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.lobby-players h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    text-align: center;
}

#lobbyPlayersList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lobby-player {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lobby-player.host::before {
    content: '👑';
    font-size: 20px;
}

.lobby-actions {
    text-align: center;
}

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

/* ================================
   Game Screen Layout
   ================================ */

.game-screen {
    position: relative;
}

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

.player-info-badge {
    background: #1e3c72;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
}

/* ================================
   Menu Button
   ================================ */

.menu-btn {
    background: #1e3c72;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

.menu-btn:hover {
    background: #2a5298;
}

.menu-btn span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* ================================
   Turn Indicator
   ================================ */

.turn-indicator {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #ddd;
}

.turn-indicator.your-turn {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
    animation: pulse 2s infinite;
}

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

/* ================================
   Players Info
   ================================ */

.players-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.player-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-card.current-turn {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.player-card.you {
    border-color: #1e3c72;
    background: #e3f2fd;
}

.player-name {
    font-weight: bold;
    font-size: 16px;
    color: #1e3c72;
}

.player-cards-count {
    font-size: 14px;
    color: #666;
}

.player-score {
    font-size: 14px;
    color: #4CAF50;
    font-weight: bold;
}

/* ================================
   Game Layout (4 Suit Columns)
   ================================ */

.game-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    min-height: 300px;
}

.suit-column {
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.suit-header {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    color: #333;
}

/* Color the suit headers appropriately */
.suit-column[data-suit="♠"] .suit-header,
.suit-column[data-suit="♣"] .suit-header {
    color: #000;
}

.suit-column[data-suit="♥"] .suit-header,
.suit-column[data-suit="♦"] .suit-header {
    color: #d32f2f;
}

.suit-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.suit-cards .card {
    margin: 0;
    flex-shrink: 0;
}

.suit-cards.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-style: italic;
}

.suit-cards.empty::after {
    content: 'No cards played';
}

/* ================================
   Your Hand
   ================================ */

.your-hand {
    background: #fff;
    border: 3px solid #1e3c72;
    border-radius: 15px;
    padding: 20px;
}

.your-hand h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    text-align: center;
}

.hand-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 120px;
}

.hand-cards .card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hand-cards .card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.hand-cards .card.selected {
    transform: translateY(-15px);
    box-shadow: 0 10px 25px rgba(30, 60, 114, 0.5);
    border: 3px solid #1e3c72;
}

.hand-cards .card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hand-cards .card.disabled:hover {
    transform: none;
    box-shadow: none;
}

.hand-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.hand-controls .btn {
    width: auto;
    min-width: 150px;
}

/* ================================
   Game Over
   ================================ */

.game-over-info {
    background: #fff;
    border: 3px solid #4CAF50;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    text-align: center;
}

.game-over-info h2 {
    color: #4CAF50;
    margin-bottom: 20px;
}

#gameOverResults {
    margin: 20px 0;
}

.result-item {
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 18px;
}

.result-item.winner {
    background: #4CAF50;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

/* ================================
   Side Menu
   ================================ */

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 998;
}

.menu-overlay.active {
    display: block;
}

.side-menu {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s;
    z-index: 999;
    overflow-y: auto;
    padding: 20px;
}

.side-menu.active {
    right: 0;
}

.menu-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-section h3 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.menu-info-item {
    margin-bottom: 15px;
}

.menu-info-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.menu-info-value {
    font-size: 16px;
    font-weight: bold;
    color: #1e3c72;
}

.menu-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-player {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
}

.menu-player.host::before {
    content: '👑 ';
}

.lang-btn {
    padding: 10px;
    border: 2px solid #1e3c72;
    background: white;
    color: #1e3c72;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: #1e3c72;
    color: white;
}

.lang-btn.active {
    background: #1e3c72;
    color: white;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-actions .btn {
    width: 100%;
}

/* ================================
   Toast Notifications
   ================================ */

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: #d32f2f;
}

.toast.success {
    background: #4CAF50;
}

/* ================================
   Responsive Design - Mobile
   ================================ */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 24px;
    }

    .welcome-screen,
    .lobby-screen,
    .game-screen {
        padding: 20px;
    }

    /* Show mobile menu button, hide desktop */
    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none;
    }

    .desktop-header {
        display: none;
    }

    /* Mobile menu button positioning */
    .lobby-screen .menu-btn.mobile-only,
    .game-screen .menu-btn.mobile-only {
        position: absolute;
        top: 20px;
        right: 20px;
        z-index: 100;
    }

    /* Game layout - stack columns vertically on small screens */
    .game-layout {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        min-height: auto;
    }

    .suit-column {
        padding: 10px;
    }

    .suit-header {
        font-size: 16px;
        padding: 8px;
    }

    /* Players info */
    .players-info {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .player-card {
        padding: 10px;
    }

    .player-name {
        font-size: 14px;
    }

    .player-cards-count,
    .player-score {
        font-size: 12px;
    }

    /* Hand cards */
    .your-hand {
        padding: 15px;
    }

    .hand-cards {
        gap: 8px;
    }

    .hand-controls {
        flex-direction: column;
    }

    .hand-controls .btn {
        width: 100%;
    }

    /* Side menu */
    .side-menu {
        width: 100%;
        right: -100%;
    }

    /* Turn indicator */
    .turn-indicator {
        font-size: 16px;
        padding: 12px;
    }

    /* Lobby */
    .lobby-info {
        padding: 15px;
    }

    .info-item {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    /* Stack suit columns into single column on very small screens */
    .game-layout {
        grid-template-columns: 1fr;
    }

    .players-info {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 20px;
    }

    .back-to-games {
        font-size: 14px;
        padding: 5px 10px;
    }
}
