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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --text: #e8e8ed;
    --text-muted: #8b8d9a;
    --border: #2d3142;
    --success: #00cec9;
    --danger: #ff7675;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Landing Page */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.landing h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing .tagline {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

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

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

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

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

/* Room Layout */
.room-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    gap: 0;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--accent-light);
}

.qr-section {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.qr-section img {
    border-radius: 12px;
    background: white;
    padding: 8px;
    max-width: 200px;
}

.qr-section p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface2);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.status-dot.waiting {
    background: #fdcb6e;
    animation: pulse 1.5s infinite;
}

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

/* File Section */
.file-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.1);
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.drop-zone .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--surface2);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    color: var(--text-muted);
    margin: 0 0.75rem;
    white-space: nowrap;
}

.file-item a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.file-item a:hover {
    text-decoration: underline;
}

/* Chat Area */
.chat-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

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

.chat-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.room-id {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: monospace;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.message.incoming {
    background: var(--surface2);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.outgoing {
    background: var(--accent);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message .sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 0.25rem;
}

.message.outgoing .sender {
    color: rgba(255, 255, 255, 0.7);
}

.message .time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.message.outgoing .time {
    color: rgba(255, 255, 255, 0.5);
}

.message.system {
    align-self: center;
    max-width: 100%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem;
    text-align: center;
}

.chat-input {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

.chat-input input:focus {
    border-color: var(--accent);
}

.chat-input button {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.chat-input button:hover {
    background: var(--accent-light);
}

/* Name Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal h2 {
    margin-bottom: 0.5rem;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.modal input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    text-align: center;
}

.modal input:focus {
    border-color: var(--accent);
}

/* Upload progress */
.upload-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.2s;
    width: 0%;
}

/* Responsive */
@media (max-width: 768px) {
    .room-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 40vh;
    }

    .chat-area {
        height: auto;
        min-height: 60vh;
    }

    .message {
        max-width: 85%;
    }

    .landing h1 {
        font-size: 2rem;
    }
}
