/* Room Lobby Styles - Shared multiplayer UI components */

/* Mode Selection */
.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
    background: var(--card-background, #fff);
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--shadow, 0 4px 6px rgba(0,0,0,0.1));
    max-width: 400px;
    margin: 20px auto;
}

.mode-selection h2 {
    color: var(--secondary-color, #2c3e50);
    margin-bottom: 10px;
}

.mode-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--background-color, #f0f2f5);
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: var(--primary-color, #2980b9);
    background: var(--primary-color, #2980b9);
    color: white;
    transform: translateY(-2px);
}

.mode-btn .icon {
    font-size: 2rem;
}

.mode-btn .label {
    font-weight: 600;
}

.mode-btn .desc {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
}

.mode-btn:hover .desc {
    color: rgba(255,255,255,0.8);
}

/* Room Lobby */
.room-lobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: var(--card-background, #fff);
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--shadow, 0 4px 6px rgba(0,0,0,0.1));
    max-width: 450px;
    margin: 20px auto;
}

.room-lobby h2 {
    color: var(--secondary-color, #2c3e50);
    margin-bottom: 5px;
}

/* Create/Join Tabs */
.lobby-tabs {
    display: flex;
    width: 100%;
    border-bottom: 2px solid var(--border-color, #e9ecef);
    margin-bottom: 15px;
}

.lobby-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted, #666);
    transition: all 0.2s ease;
    margin-bottom: -2px;
    box-shadow: none;
}

.lobby-tab:hover {
    color: var(--primary-color, #2980b9);
    background: transparent;
    transform: none;
    box-shadow: none;
}

.lobby-tab.active {
    color: var(--primary-color, #2980b9);
    border-bottom-color: var(--primary-color, #2980b9);
}

/* Tab Content */
.tab-content {
    display: none;
    width: 100%;
}

.tab-content.active {
    display: block;
}

/* Form Elements */
.lobby-form {
    width: 100%;
}

.lobby-input-group {
    margin-bottom: 15px;
}

.lobby-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--secondary-color, #2c3e50);
}

.lobby-input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: var(--border-radius, 8px);
    transition: border-color 0.2s ease;
}

.lobby-input:focus {
    outline: none;
    border-color: var(--primary-color, #2980b9);
}

.lobby-input.room-code-input {
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 1.3rem;
    text-align: center;
    font-family: monospace;
}

.lobby-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    margin-top: 10px;
}

/* Waiting Room */
.waiting-room {
    text-align: center;
    padding: 30px;
    background: var(--card-background, #fff);
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--shadow, 0 4px 6px rgba(0,0,0,0.1));
    max-width: 450px;
    margin: 20px auto;
}

.room-code-display {
    font-size: 2.5rem;
    font-family: monospace;
    font-weight: bold;
    letter-spacing: 5px;
    color: var(--primary-color, #2980b9);
    background: var(--background-color, #f0f2f5);
    padding: 15px 30px;
    border-radius: var(--border-radius, 8px);
    margin: 15px 0;
    display: inline-block;
}

.copy-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    margin-left: 10px;
    background: var(--secondary-color, #2c3e50);
}

.copy-btn:hover {
    background: var(--text-muted, #666);
}

.share-link {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    margin-top: 10px;
    word-break: break-all;
}

/* Players List */
.players-list {
    width: 100%;
    margin: 20px 0;
    list-style: none;
    padding: 0;
}

.players-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--background-color, #f0f2f5);
    border-radius: var(--border-radius, 8px);
    margin-bottom: 8px;
}

.players-list .player-name {
    font-weight: 600;
}

.players-list .player-status {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
}

.players-list .player-status.host {
    color: var(--warning-color, #f39c12);
}

.players-list .player-status.ready {
    color: var(--success-color, #27ae60);
}

/* Waiting Animation */
.waiting-animation {
    margin: 20px 0;
}

.waiting-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.waiting-dots span {
    width: 12px;
    height: 12px;
    background: var(--primary-color, #2980b9);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.waiting-dots span:nth-child(1) { animation-delay: -0.32s; }
.waiting-dots span:nth-child(2) { animation-delay: -0.16s; }
.waiting-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.waiting-text {
    margin-top: 15px;
    color: var(--text-muted, #666);
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 20px;
    background: var(--background-color, #f0f2f5);
}

.connection-status .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.connection-status.connected .status-dot {
    background: var(--success-color, #27ae60);
}

.connection-status.disconnected .status-dot {
    background: var(--danger-color, #e74c3c);
}

.connection-status.connecting .status-dot {
    background: var(--warning-color, #f39c12);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error Message */
.error-message {
    color: var(--danger-color, #e74c3c);
    background: #fdecea;
    padding: 12px 15px;
    border-radius: var(--border-radius, 8px);
    margin: 10px 0;
    font-size: 0.9rem;
    text-align: center;
}

/* Online Indicator (for game board) */
.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--success-color, #27ae60);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
}

.online-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Turn Indicator */
.turn-indicator {
    padding: 10px 20px;
    background: var(--primary-color, #2980b9);
    color: white;
    border-radius: var(--border-radius, 8px);
    font-weight: 600;
    text-align: center;
    margin: 10px 0;
}

.turn-indicator.my-turn {
    background: var(--success-color, #27ae60);
    animation: glow 2s ease-in-out infinite alternate;
}

.turn-indicator.waiting {
    background: var(--text-muted, #666);
}

@keyframes glow {
    from { box-shadow: 0 0 5px rgba(46, 204, 113, 0.5); }
    to { box-shadow: 0 0 20px rgba(46, 204, 113, 0.8); }
}

/* Back Button Override for Lobby */
.lobby-back-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 500px) {
    .mode-selection,
    .room-lobby,
    .waiting-room {
        margin: 10px;
        padding: 20px;
    }

    .room-code-display {
        font-size: 1.8rem;
        letter-spacing: 3px;
        padding: 12px 20px;
    }
}
