/* Multiplayer Card Game - Styles */

/* Reset and Base Styles */
* {
    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: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Typography */
h1 {
    color: #fff;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
    color: #fff;
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: #fff;
    font-size: 1.5em;
    margin-bottom: 15px;
}

/* Home Screen */
.home-screen {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.game-title {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 5px;
}

.game-subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.info-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: left;
}

.info-section h3 {
    color: #667eea;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.info-section ul {
    list-style-position: inside;
    color: #666;
    line-height: 1.8;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

.btn-large {
    padding: 18px 40px;
    font-size: 1.2em;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-icon {
    font-size: 1.3em;
}

/* Form Styles */
.form-screen {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
}

.game-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"] {
    padding: 12px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-label:hover {
    border-color: #667eea;
}

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

.radio-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.radio-label input[type="radio"]:checked ~ * {
    color: #667eea;
}

.radio-label span {
    font-size: 1.1em;
    margin-bottom: 5px;
}

.radio-label small {
    color: #666;
    font-size: 0.85em;
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn-option {
    flex: 1;
    padding: 12px;
    font-size: 1.1em;
    font-weight: 600;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-option:hover {
    border-color: #667eea;
}

.btn-option.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.form-actions .btn {
    flex: 1;
}

/* Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    display: none;
}

.loading-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #bee5eb;
    text-align: center;
    display: none;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
}

/* Room List */
.list-screen {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.rooms-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    min-height: 200px;
}

.room-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
}

.room-card:hover {
    border-color: #667eea;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

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

.room-header h3 {
    color: #333;
    font-size: 1.3em;
    margin: 0;
}

.room-players {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.room-info {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* Lobby */
.lobby-screen {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 100%;
}

.room-code-display {
    color: #667eea;
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    background: #f0f0f0;
    padding: 5px 15px;
    border-radius: 5px;
}

.lobby-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
    min-height: 200px;
}

.player-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.player-item.player-me {
    border-color: #667eea;
    background: #f0f4ff;
}

.player-item.player-empty {
    border-style: dashed;
    opacity: 0.5;
}

.player-name {
    font-weight: 600;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.host-badge {
    background: #ffc107;
    color: #000;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
}

.me-badge {
    background: #667eea;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
}

.player-status {
    color: #28a745;
    font-weight: 600;
}

.game-status {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
}

.status-ready {
    background: #d4edda;
    color: #155724;
}

.status-waiting {
    background: #d1ecf1;
    color: #0c5460;
}

/* Game Screen */
.game-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    position: relative;
}

/* Top Players */
.top-players {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    min-height: 150px;
}

/* Middle Section */
.game-middle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.side-player {
    width: 200px;
}

/* Center Area */
.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.discard-pile {
    text-align: center;
}

.pile-label {
    color: white;
    font-weight: 600;
    margin-bottom: 10px;
}

.pile-cards {
    min-width: 120px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-pile {
    color: rgba(255,255,255,0.5);
    font-style: italic;
}

.turn-indicator {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.turn-indicator.my-turn {
    background: #28a745;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.last-action {
    color: white;
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    display: none;
}

/* My Hand */
.my-hand-area {
    padding: 20px;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.hand-label {
    color: white;
    text-align: center;
    font-weight: 600;
    margin-bottom: 10px;
}

.my-hand {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 140px;
}

/* Opponent Players */
.opponent-player {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    min-width: 180px;
    transition: all 0.3s;
}

.opponent-player.current-player {
    border: 3px solid #28a745;
    background: rgba(40, 167, 69, 0.2);
}

.opponent-name {
    color: white;
    font-weight: 600;
    margin-bottom: 10px;
}

.opponent-cards {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.card-count {
    color: rgba(255,255,255,0.7);
    font-size: 0.9em;
}

.no-cards {
    color: rgba(255,255,255,0.5);
    font-style: italic;
    padding: 20px 0;
}

/* Cards */
.card {
    width: 80px;
    height: 110px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.card-back {
    background: linear-gradient(135deg, #c94b4b 0%, #4b134f 100%);
    border: 2px solid #fff;
}

.card-front {
    background: white;
    border: 2px solid #333;
}

.card-large {
    width: 100px;
    height: 140px;
}

.card-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

.card-suit {
    font-size: 2em;
}

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

.suit-clubs, .suit-spades {
    color: #000;
}

.card-playable {
    cursor: pointer;
}

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

.card-playing {
    animation: playCard 0.6s ease-in-out forwards;
}

@keyframes playCard {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-200px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-250px) scale(1);
        opacity: 0;
    }
}

/* Game Info */
.game-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-info strong {
    color: #ffc107;
}

/* Error Toast */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #dc3545;
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: transform 0.3s ease;
    opacity: 0;
}

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

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9em;
}

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

    h1 {
        font-size: 2em;
    }

    .home-screen,
    .form-screen,
    .list-screen,
    .lobby-screen {
        padding: 20px;
    }

    .card {
        width: 60px;
        height: 85px;
    }

    .card-value {
        font-size: 1.2em;
    }

    .card-suit {
        font-size: 1.5em;
    }

    .opponent-player {
        min-width: 120px;
        padding: 10px;
    }

    .game-middle {
        padding: 0 10px;
    }
}
