/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

/* Screen transitions */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(20px);
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Start Screen Styles */
.start-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    max-width: 480px;
    margin: 0 auto;
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out;
}

.logo-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.3));
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo p {
    font-size: 1.1rem;
    color: #a0a0a0;
    font-weight: 400;
}

.join-form {
    width: 100%;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.input-group input::placeholder {
    color: #888;
}

.join-button {
    width: 100%;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    border: none;
    border-radius: 12px;
    padding: 1.25rem 2rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.join-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.join-button:active {
    transform: translateY(0);
}

.button-arrow {
    transition: transform 0.3s ease;
}

.join-button:hover .button-arrow {
    transform: translateX(4px);
}

/* Chat Screen Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #0f0f23;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.room-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.room-info span {
    font-size: 0.9rem;
    color: #a0a0a0;
}

.leave-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leave-button:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100%;
}

/* Message Styles */
.message {
    animation: messageSlideIn 0.3s ease-out;
    word-wrap: break-word;
}

.message.own {
    align-self: flex-end;
}

.message-bubble {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.875rem 1.25rem;
    border-radius: 18px;
    max-width: 70%;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message.own .message-bubble {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    margin-left: auto;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.message-username {
    font-weight: 600;
    font-size: 0.9rem;
    color: #8b5cf6;
}

.message.own .message-username {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
}

.message.own .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #e0e0e0;
}

.message.own .message-content {
    color: #ffffff;
}

/* Notification Messages */
.notification {
    align-self: center;
    animation: notificationSlideIn 0.4s ease-out;
}

.notification .message-bubble {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #c4b5fd;
    text-align: center;
    max-width: none;
}

/* Action Messages */
.action {
    align-self: flex-start;
    font-style: italic;
    opacity: 0.9;
}

.action .message-bubble {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    color: #c4b5fd;
}

/* Message Input */
.message-input-container {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.message-input-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.message-input-wrapper input {
    flex: 1;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.message-input-wrapper input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.message-input-wrapper input::placeholder {
    color: #888;
}

.send-button {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.send-button:active {
    transform: scale(0.95);
}

.input-hint {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    margin-top: 0.5rem;
}

/* Loading Screen */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1.5rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-top: 3px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.6);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .start-container {
        padding: 1.5rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 1rem 1.25rem;
    }
    
    .messages-container {
        padding: 1rem;
    }
    
    .message-input-container {
        padding: 1rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .message-bubble {
        max-width: 90%;
    }
    
    .room-info h2 {
        font-size: 1.25rem;
    }
}