/* 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, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Screen management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* Login screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 100%;
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-container p {
    margin-bottom: 30px;
    opacity: 0.8;
    font-size: 1.1rem;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #ffffff;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4ecdc4;
    background: rgba(255, 255, 255, 0.15);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Button styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Ensure buttons are clickable */
.btn {
    pointer-events: auto;
    cursor: pointer;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Error message */
.error-message {
    color: #ff6b6b;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    display: none;
}

.error-message.show {
    display: block;
}

/* Lobby screen */
.lobby-container {
    max-width: 1200px;
    margin: 0 auto;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.lobby-header h2 {
    font-size: 2rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.lobby-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.lobbies-section h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.lobbies-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.lobby-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.lobby-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.lobby-card h4 {
    margin-bottom: 10px;
    color: #4ecdc4;
}

.lobby-card .lobby-info {
    margin-bottom: 15px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.lobby-card .lobby-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.lobby-card .lobby-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #4ecdc4;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Game screen */
.game-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.game-info h3 {
    color: #4ecdc4;
    margin-bottom: 5px;
}

.round-info {
    font-size: 0.9rem;
    opacity: 0.8;
}

.timer {
    font-size: 2rem;
    font-weight: bold;
    color: #ff6b6b;
    text-align: center;
    min-width: 100px;
}

.game-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.game-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.players-section,
.chat-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.players-section h4,
.chat-section h4 {
    margin-bottom: 15px;
    color: #4ecdc4;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #4ecdc4;
}

.player-item.is-drawer {
    border-left-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.player-name {
    font-weight: 500;
}

.player-score {
    color: #4ecdc4;
    font-weight: bold;
}

/* Chat styles */
.chat-messages {
    height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.chat-message.correct-guess {
    background: rgba(76, 175, 80, 0.2);
    border-left: 3px solid #4caf50;
}

.chat-message .player-name {
    font-weight: bold;
    color: #4ecdc4;
    margin-right: 8px;
}

.chat-message .message-text {
    color: #ffffff;
}

.chat-message .message-time {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-left: 8px;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #4ecdc4;
}

/* Drawing section */
.drawing-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.drawing-tools {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-group label {
    font-size: 0.9rem;
    white-space: nowrap;
}

.tool-group select,
.tool-group input[type="range"],
.tool-group input[type="color"] {
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.tool-actions {
    display: flex;
    gap: 10px;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

#drawing-canvas {
    border: 2px solid #ddd;
    cursor: crosshair;
    background: #ffffff;
}

.word-display {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.word-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4ecdc4;
    letter-spacing: 2px;
}

/* Final scores */
.final-scores h4 {
    margin-bottom: 20px;
    color: #4ecdc4;
    text-align: center;
}

.scores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid #4ecdc4;
}

.score-item.first {
    border-left-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.score-item .player-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.score-item .player-score {
    font-size: 1.2rem;
    color: #4ecdc4;
    font-weight: bold;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .game-left {
        order: 2;
    }
    
    .drawing-section {
        order: 1;
    }
    
    .lobby-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .drawing-tools {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tool-group {
        justify-content: space-between;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen.active {
    animation: fadeIn 0.5s ease-out;
}

.lobby-card {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
