/* ============================================================================
   KUBOID KOMBAT - INTERFACE STYLESHEET
   All UI elements: title screen, lobby, modals, buttons, etc.
   ============================================================================ */

/* ============================================================================
   GLOBAL STYLES
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial Black', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 100vh;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

.logo {
    font-size: 64px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    letter-spacing: -2px;
}

.lobby .logo {
    font-size: 48px;
    text-align: center;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.8;
}

h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================================================
   CONTAINERS & LAYOUT
   ============================================================================ */

.container {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.title-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

body.lobby {
    padding: 20px;
}

body.lobby {
    padding: 20px;
}

body.lobby .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

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

.panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   ROOM CODE DISPLAY
   ============================================================================ */

.room-code-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.room-code {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 10px 0;
    display: flex;
    justify-content: center;
}

.room-code-word {
    display: inline-block;
}

.room-code-word:nth-child(1) {
    color: #FFD700; /* Light yellow */
}

.room-code-word:nth-child(2) {
    color: #4DD0E1; /* Light blue */
}

.room-code-word:nth-child(3) {
    color: #EF5350; /* Light red */
}

.room-code-label {
    font-size: 14px;
    opacity: 0.7;
    text-transform: uppercase;
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */

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

input[type="text"] {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-family: 'Arial Black', Arial, sans-serif;
    text-transform: uppercase;
    text-align: center;
}

input[type="text"]::placeholder {
    text-transform: none;
    opacity: 0.5;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

button {
    padding: 20px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Arial Black', Arial, sans-serif;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.button-group {
    display: grid;
    gap: 15px;
    margin-top: 30px;
}

/* Lobby controls layout */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.controls button {
    padding: 15px 30px;
    font-size: 18px;
    height: 60px;
}

.controls .btn-ready,
.controls .btn-unready {
    width: 100%;
    margin: 0 auto;
    padding: 30px 40px; /* 2x taller than default */
    font-size: 24px;
    height: auto !important; /* Override the fixed height */
}

.controls .button-row {
    display: flex;
    gap: 15px;
}

.controls .button-row button {
    flex: 1;
}

/* Button Colors */
.btn-create {
    background: #4CAF50;
    color: white;
}

.btn-join {
    background: #2196F3;
    color: white;
}

.btn-ready {
    background: #4CAF50;
    color: white;
}

.btn-unready {
    background: #ff9800;
    color: white;
    display: none;
}

.btn-leave {
    background: #f44336;
    color: white;
}

.btn-join-different {
    background: #9C27B0;
    color: white;
}

.btn-options {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    padding: 15px;
}

.btn-cancel {
    background: #666;
    color: white;
}

.btn-kick,
.kick-btn {
    padding: 8px 12px;
    font-size: 12px;
    background: #f44336;
    color: white;
    margin-left: auto;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

.kick-btn:hover {
    background: #d32f2f;
}

.change-name-btn {
    padding: 8px 12px;
    font-size: 12px;
    background: #2196F3;
    color: white;
    margin-left: auto;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

.change-name-btn:hover:not(:disabled) {
    background: #1976D2;
}

.change-name-btn:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.copy-btn {
    padding: 8px 16px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 14px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================================================
   PLAYER LIST
   ============================================================================ */

.player-list {
    display: grid;
    gap: 10px;
}

.player {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-square {
    width: 40px;
    height: 40px;
    background: #2196F3;
    border-radius: 5px;
    flex-shrink: 0;
}

.player.ready .player-square {
    background: #4CAF50;
}

.player.you .player-square {
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.player.disconnected {
    opacity: 0.5;
    background: rgba(255, 152, 0, 0.2);
}

.player.disconnected .player-square {
    background: #666;
}

.player-info {
    flex: 1;
}

.player-name {
    font-size: 18px;
    font-weight: bold;
}

.player-status {
    font-size: 14px;
    opacity: 0.7;
}

.player-count {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 15px;
}

/* ============================================================================
   LAYOUT VOTING
   ============================================================================ */

.layout-voting {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.layout-btn {
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
    font-family: 'Arial Black', Arial, sans-serif;
    padding: 10px;
    font-size: 14px;
}

.layout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.layout-btn.selected {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
    border-width: 3px;
}

.layout-num {
    font-size: 20px;
    font-weight: bold;
}

.layout-votes {
    font-size: 12px;
    opacity: 0.7;
}

/* ============================================================================
   STATUS MESSAGES
   ============================================================================ */

.status-message {
    text-align: center;
    font-size: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
}

/* ============================================================================
   COUNTDOWN
   ============================================================================ */

.countdown {
    font-size: 72px;
    font-weight: bold;
    text-align: center;
    margin: 50px 0;
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    display: none;
}

.countdown.active {
    display: block;
}

.countdown-number {
    font-size: 48px;
    font-weight: bold;
    color: #4CAF50;
}

/* ============================================================================
   CONNECTION STATUS
   ============================================================================ */

.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.connection-status.connected {
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid #4CAF50;
}

.connection-status.disconnected {
    background: rgba(244, 67, 54, 0.3);
    border: 1px solid #f44336;
}

/* ============================================================================
   MODALS
   ============================================================================ */

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

.modal-content {
    background: rgba(30, 30, 60, 0.95);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    max-width: 500px;
    width: 90%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.modal h2 {
    margin-bottom: 20px;
    text-align: center;
}

.modal input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-family: 'Arial Black', Arial, sans-serif;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 20px;
}

.modal .button-group {
    grid-template-columns: 1fr 1fr;
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Confirmation modal specific styles */
.confirm-modal {
    max-width: 450px;
}

.confirm-modal h2 {
    margin-bottom: 15px;
}

.confirm-modal p {
    text-align: center;
    line-height: 1.5;
}

/* Confirm button (Yes) */
.btn-confirm {
    background: #4CAF50;
    color: white;
    order: 2; /* Put Yes button on the right */
}

.btn-confirm:hover {
    background: #45a049;
}

/* ============================================================================
   MESSAGES & ERRORS
   ============================================================================ */

.error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.error.visible {
    display: block;
}

/* ============================================================================
   FOOTER & VERSION
   ============================================================================ */

.version {
    margin-top: 40px;
    font-size: 12px;
    opacity: 0.5;
    text-align: center;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Floating squares background */
.bg-square {
    position: fixed;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite;
    z-index: -1;
}

/* Specific positioning for background squares */
.bg-square.square-1 {
    width: 60px;
    height: 60px;
    left: 10%;
    top: 20%;
    animation-delay: 0s;
}

.bg-square.square-2 {
    width: 80px;
    height: 80px;
    left: 80%;
    top: 30%;
    animation-delay: 2s;
}

.bg-square.square-3 {
    width: 40px;
    height: 40px;
    left: 70%;
    top: 70%;
    animation-delay: 4s;
}

.bg-square.square-4 {
    width: 50px;
    height: 50px;
    left: 20%;
    top: 80%;
    animation-delay: 6s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(50px, -50px) rotate(90deg);
    }
    50% {
        transform: translate(0, -100px) rotate(180deg);
    }
    75% {
        transform: translate(-50px, -50px) rotate(270deg);
    }
}

/* ============================================================================
   BADGES & STATUS INDICATORS
   ============================================================================ */

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

.badge-disconnected {
    background: #ff9800;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.empty-state {
    text-align: center;
    opacity: 0.5;
    padding: 40px;
}

.empty-state-small {
    text-align: center;
    opacity: 0.7;
    margin-bottom: 20px;
}

