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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --bg: #0f172a;
    --bg-light: #1e293b;
    --bg-card: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
    --success: #10b981;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #1a1f3a 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.3s ease-in;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="text"] {
    padding: 0.875rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

.btn-text:hover {
    color: var(--text);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--bg-card);
    color: var(--text);
}

.btn-small:hover {
    background: var(--border);
}

.info-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.info-box p {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box li {
    padding: 0.5rem 0;
    color: var(--text-muted);
    padding-left: 1.5rem;
    position: relative;
}

.info-box li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Chat Page Styles */
#chat-page {
    max-width: 800px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.room-info {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.room-id {
    font-family: 'Courier New', monospace;
}

.expiry-time {
    color: var(--error);
}

.messages-container {
    flex: 1;
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.875rem 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    animation: slideIn 0.2s ease-out;
}

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

.message.own {
    background: var(--primary);
    margin-left: auto;
    max-width: 70%;
}

.message.other {
    background: var(--bg-card);
    margin-right: auto;
    max-width: 70%;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message-username {
    font-weight: 600;
    color: var(--primary);
}

.message.own .message-username {
    color: var(--text);
}

.message-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.message-text {
    word-wrap: break-word;
}

.system-message {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
    padding: 0.5rem;
}

.message-form {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
}

.message-form input {
    flex: 1;
    margin: 0;
}

.message-form button {
    padding: 0.875rem 2rem;
}

/* Scrollbar styling */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: var(--bg);
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--bg-card);
}

/* Responsive */
@media (max-width: 640px) {
    .header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    #chat-page {
        height: 100vh;
    }

    .chat-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .room-info {
        flex-direction: column;
        gap: 0.25rem;
    }

    .message.own,
    .message.other {
        max-width: 85%;
    }
}
