/**
 * Multiplayer Interface Styles
 * Styles for waiting rooms, lobby, and multiplayer-specific UI components
 */

/* === MOBILE OPTIMIZATIONS === */
/* Prevent text selection on mobile */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Optimize for mobile performance */
@media (max-width: 768px) {
    * {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* PWA-like experience */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* === GAME STATE MANAGEMENT === */
/* Hide game elements until mode is selected */
.game-container,
.compact-ui {
    display: none;
}

/* Show game elements when mode is selected */
.game-active .game-container,
.game-active .compact-ui {
    display: block;
}

/* === MULTIPLAYER INTERFACE === */
.multiplayer-interface {
    max-width: 500px;
    margin: 10px auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    color: white;
    backdrop-filter: blur(10px);
    max-height: 85vh;
    overflow-y: auto;
}

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

.multiplayer-header h2 {
    margin: 0;
    color: #FFD700;
    font-size: 1.4em;
}

.back-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8em;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === WAITING ROOM - REDESIGNED COMPACT UX === */
.waiting-room {
    max-width: 400px;
    margin: 5px auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    color: white;
    backdrop-filter: blur(10px);
    text-align: center;
    max-height: 80vh;
    overflow-y: auto;
}

.waiting-room-header {
    margin-bottom: 8px;
}

.waiting-room-header h2 {
    margin: 0 0 4px 0;
    color: #FFD700;
    font-size: 1.1em;
}

.room-code {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin: 6px 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.waiting-status {
    margin: 6px 0;
    padding: 6px;
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: 4px;
    color: #FFC107;
    font-size: 0.75em;
}

/* === COMPACT PLAYERS GRID === */
.players-list {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
    margin: 8px 0;
    min-height: 80px;
}

.players-list h3 {
    margin: 0 0 6px 0;
    color: #FFD700;
    font-size: 0.85em;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    margin: 2px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.player-name {
    font-weight: bold;
    font-size: 0.75em;
}

.player-status {
    font-size: 0.65em;
    color: rgba(255, 255, 255, 0.8);
}

.host-badge {
    background: #FFD700;
    color: #000;
    padding: 1px 3px;
    border-radius: 6px;
    font-size: 0.55em;
    font-weight: bold;
}

/* === INLINE ROOM SETTINGS === */
.room-settings {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 6px;
    margin: 6px 0;
    text-align: center;
}

.room-settings h4 {
    margin: 0 0 4px 0;
    color: #FFD700;
    font-size: 0.75em;
}

.settings-inline {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 8px;
}

.setting-item {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.65em;
    text-align: center;
}

/* === COMPACT ACTION BUTTONS === */
.waiting-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.action-button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 120px;
}

.start-game-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.start-game-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-2px);
}

.start-game-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
}

.leave-room-btn {
    background: rgba(244, 67, 54, 0.8);
    color: white;
}

.leave-room-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: translateY(-2px);
}

/* === COMPACT INVITE LINK === */
.invite-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px;
    margin: 6px 0;
}

.invite-link h4 {
    margin: 0 0 4px 0;
    color: #FFD700;
    font-size: 0.75em;
}

.invite-url {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 2px;
    font-family: monospace;
    word-break: break-all;
    margin: 4px 0;
    font-size: 0.6em;
}

.copy-btn {
    background: rgba(33, 150, 243, 0.8);
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.65em;
}

.copy-btn:hover {
    background: rgba(33, 150, 243, 1);
}

/* === CONNECTION STATUS === */
.connection-status {
    text-align: center;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
}

.status-connecting {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
    border: 2px solid rgba(255, 193, 7, 0.5);
}

.status-connected {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 2px solid rgba(76, 175, 80, 0.5);
}

.status-error {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
    border: 2px solid rgba(244, 67, 54, 0.5);
}

/* === ROOM INTERFACE === */
.room-interface {
    margin-top: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.room-tabs {
    display: flex;
    margin-bottom: 12px;
    border-radius: 5px;
    overflow: hidden;
}

.room-tab {
    flex: 1;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
}

.room-tab.active {
    background: rgba(255, 255, 255, 0.3);
}

.room-content {
    display: none;
}

.room-content.active {
    display: block;
}

/* === FORM ELEMENTS === */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    color: #FFD700;
    font-size: 0.85em;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.85em;
    box-sizing: border-box;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* === COMPACT FORM LAYOUT === */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* === CREATE ROOM BUTTON === */
.mode-button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

.mode-button:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-1px);
}

/* === ROOM LIST === */
.room-list,
#roomList {
    max-height: 250px;
    overflow-y: auto;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
}

.room-item {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.room-item:last-child {
    border-bottom: none;
}

.room-name {
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.room-info {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.8);
}

/* === LOADING SPINNER === */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* === BACK TO MODE SELECTION BUTTON === */
.back-to-mode-selection {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.back-to-mode-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-to-mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.back-to-mode-btn:active {
    transform: translateY(0);
}
