/* Backwards Banter Styles */

:root {
    --primary-color: #4a90d9;
    --primary-dark: #357abd;
    --secondary-color: #50c878;
    --warning-color: #f5a623;
    --error-color: #d9534f;
    --bg-color: #1a1a2e;
    --surface-color: #16213e;
    --surface-light: #1f3460;
    --text-color: #e8e8e8;
    --text-muted: #a0a0a0;
    --player1-color: #4a90d9;
    --player2-color: #50c878;
    --disabled-color: #555;
    --border-radius: 8px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Intro Page */
.intro-container {
    max-width: 800px;
}

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

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-style: italic;
}

.rules {
    background: var(--surface-color);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.rules h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.rules ol {
    padding-left: 25px;
}

.rules li {
    margin-bottom: 10px;
}

.rules em {
    color: var(--warning-color);
}

.game-setup {
    background: var(--surface-color);
    padding: 25px;
    border-radius: var(--border-radius);
}

.game-setup h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.player-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
}

@media (max-width: 600px) {
    .player-inputs {
        grid-template-columns: 1fr;
    }
}

.player-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--surface-light);
}

.player-section:first-child h3 {
    color: var(--player1-color);
    border-color: var(--player1-color);
}

.player-section:last-child h3 {
    color: var(--player2-color);
    border-color: var(--player2-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:disabled {
    background: var(--disabled-color);
    cursor: not-allowed;
    opacity: 0.6;
}

#start-button, .primary-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    font-size: 1.1rem;
    padding: 15px;
}

#start-button:not(:disabled):hover, .primary-btn:hover {
    background: var(--primary-dark);
}

#game-created {
    background: var(--surface-color);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
}

#game-created h2 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.url-display {
    margin: 20px 0;
    text-align: left;
}

.url-display label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.url-box {
    display: flex;
    gap: 10px;
}

.url-box input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
}

.copy-btn {
    background: var(--surface-light);
    color: var(--text-color);
    padding: 10px 15px;
}

.copy-btn:hover {
    background: var(--primary-color);
}

/* Game Page */
.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: var(--surface-color);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.turn-indicator {
    font-size: 1.2rem;
}

.turn-indicator .player-name {
    font-weight: bold;
}

.turn-indicator.player1 .player-name {
    color: var(--player1-color);
}

.turn-indicator.player2 .player-name {
    color: var(--player2-color);
}

.volley-counter {
    background: var(--surface-light);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.volley-counter span {
    color: var(--warning-color);
    font-weight: bold;
}

.game-instructions {
    background: var(--surface-light);
    padding: 12px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.game-instructions.my-turn {
    background: rgba(74, 144, 217, 0.2);
    color: var(--text-color);
}

.game-instructions.not-my-turn {
    background: rgba(85, 85, 85, 0.3);
}

.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.video-section {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: stretch;
}

@media (max-width: 900px) {
    .video-section {
        flex-direction: column;
    }
}

.video-box {
    flex: 1;
    max-width: 450px;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.video-box.player1 {
    border-top: 3px solid var(--player1-color);
}

.video-box.player2 {
    border-top: 3px solid var(--player2-color);
}

.video-box.disabled {
    opacity: 0.6;
}

.video-box h3 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-box.player1 h3 {
    color: var(--player1-color);
}

.video-box.player2 h3 {
    color: var(--player2-color);
}

.your-turn-badge {
    background: var(--secondary-color);
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    aspect-ratio: 4/3;
    margin-bottom: 15px;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-light);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.video-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.video-controls button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--surface-light);
    color: var(--text-color);
    font-size: 0.9rem;
}

.video-controls button:not(:disabled):hover {
    background: var(--primary-color);
}

.video-controls button.recording {
    background: var(--error-color);
    animation: pulse 1s infinite;
}

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

.video-controls button svg {
    width: 20px;
    height: 20px;
}

.arrows-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    padding: 0 10px;
}

@media (max-width: 900px) {
    .arrows-section {
        flex-direction: row;
        justify-content: center;
    }
}

.pass-turn-btn {
    padding: 15px 20px;
    background: var(--surface-light);
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.pass-turn-btn:not(:disabled):hover {
    background: var(--secondary-color);
}

.pass-turn-btn svg {
    width: 24px;
    height: 24px;
}

.solve-btn {
    background: var(--secondary-color);
    color: white;
    padding: 15px 20px;
}

.solve-btn:not(:disabled):hover {
    background: #45b369;
}

/* Chat Section */
.chat-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 15px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.chat-section h3 {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.chat-messages {
    height: 150px;
    overflow-y: auto;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 10px;
}

.chat-message {
    margin-bottom: 8px;
    line-height: 1.4;
}

.chat-message .player-name {
    font-weight: bold;
}

.chat-message.player1 .player-name {
    color: var(--player1-color);
}

.chat-message.player2 .player-name {
    color: var(--player2-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.chat-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-input-wrapper input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input-wrapper button {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
}

.chat-input-wrapper button:not(:disabled):hover {
    background: var(--primary-dark);
}

/* URL Display in game */
.urls-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 15px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.urls-section h3 {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

@media (max-width: 600px) {
    .urls-grid {
        grid-template-columns: 1fr;
    }
}

.url-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.url-item .url-box {
    display: flex;
    gap: 8px;
}

.url-item input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.85rem;
}

/* Game Status Overlays */
.game-status-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-status-content {
    background: var(--surface-color);
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 500px;
}

.game-status-content h2 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 2rem;
}

.game-status-content p {
    margin-bottom: 20px;
    color: var(--text-muted);
}

.game-status-content .final-score {
    font-size: 1.5rem;
    color: var(--warning-color);
    margin-bottom: 20px;
}

/* Loading spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--surface-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Recording timer */
.recording-timer {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--error-color);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* Processing overlay */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    gap: 15px;
}

.processing-overlay .spinner {
    width: 40px;
    height: 40px;
}
