@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: rgba(20, 20, 30, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);
    --accent-primary: #007aff;
    --accent-secondary: #5e5ce6;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Login Overlay */
#login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 48px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-card h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-card input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

.login-card button {
    width: 100%;
    padding: 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-card button:hover {
    background: #0066dd;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 122, 255, 0.3);
}

/* Main Wrapper */
.main-wrapper {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    padding: 24px;
    height: 100vh;
    transition: filter 0.3s ease;
}

.container {
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-glass);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff3b30;
    box-shadow: 0 0 12px rgba(255, 59, 48, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.connected {
    background: #34c759;
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.primary-btn {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 122, 255, 0.3);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.secondary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.volume-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.volume-control label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.volume-control input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
    transition: all 0.2s ease;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.mic-meter-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.mic-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #34c759, #30d158);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.5);
}

/* User List */
.user-list h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.user-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-list li {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.user-list li.audio-active {
    border-color: var(--accent-primary);
    background: rgba(0, 122, 255, 0.1);
}

.user-list li:hover {
    background: rgba(255, 255, 255, 0.05);
}

.local-id {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.local-id span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Chat Container */
.chat-container {
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-glass);
    font-size: 18px;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Message Styles - Modern Chat Bubbles */
.message-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-container.sent {
    flex-direction: row-reverse;
}

.message-container.received {
    flex-direction: row;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

.sender-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0 12px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    font-size: 14px;
    line-height: 1.5;
}

.message.sent {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 70%;
}

.timestamp {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 12px;
}

.message-container.sent .timestamp {
    text-align: right;
}

/* Chat Input */
.chat-input-area {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 12px;
}

.chat-input-area input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}


.chat-input-area button {
    padding: 14px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-input-area button.icon-btn {
    padding: 10px 14px;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
}

.chat-input-area button.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.chat-input-area button:hover {
    background: #0066dd;
    transform: translateY(-2px);
}

/* Chat Image Styles */
.chat-image {
    display: block;
    max-width: 300px;
    height: auto;
    margin: 8px 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-image:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-panel.open {
    opacity: 1;
    pointer-events: all;
}

.settings-content {
    background: var(--bg-glass);
    backdrop-filter: blur(60px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.settings-panel.open .settings-content {
    transform: scale(1);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-glass);
}

.settings-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-btn {
    width: 100%;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    text-align: left;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.debug-audio-container {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    min-height: 60px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.monitor-container {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    position: relative;
}

.monitor-container canvas {
    width: 100%;
    height: 100px;
    display: block;
    border-radius: 8px;
}

.monitor-label {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 10px;
    color: #0f0;
    font-weight: 600;
    letter-spacing: 1px;
}

/* Rooms Section */
.rooms-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rooms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rooms-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.create-room-btn {
    width: 36px;
    height: 36px;
    background: var(--accent-primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.create-room-btn:hover {
    background: #0066dd;
    transform: scale(1.05);
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    opacity: 0.7;
}

.room-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.room-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.join-room-btn-small {
    padding: 8px 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.join-room-btn-small:hover {
    background: #0066dd;
    transform: scale(1.05);
}

/* Current Room Indicator */
.current-room-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(94, 92, 230, 0.1));
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    margin-bottom: 16px;
}

.room-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-badge span {
    font-size: 20px;
}

.room-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.room-members {
    font-size: 12px;
    color: var(--text-secondary);
}

.leave-room-btn {
    padding: 8px 16px;
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.5);
    border-radius: 8px;
    color: #ff3b30;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.leave-room-btn:hover {
    background: rgba(255, 59, 48, 0.3);
    border-color: #ff3b30;
}

/* Collapsible Room Tree */
.room-tree-item {
    margin-bottom: 4px;
}

.room-tree-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.room-tree-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.expand-icon {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    min-width: 12px;
}

.room-icon {
    font-size: 16px;
}

.room-tree-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.room-tree-join-btn {
    padding: 4px 12px;
    background: var(--accent-primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.room-tree-header:hover .room-tree-join-btn {
    opacity: 1;
}

.room-tree-join-btn:hover {
    background: #0066dd;
}

.room-tree-members {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 28px;
}

.room-tree-item.expanded .room-tree-members {
    max-height: 500px;
}

.room-tree-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    margin: 2px 0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.room-tree-member:hover {
    background: rgba(255, 255, 255, 0.03);
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), rgba(94, 92, 230, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.member-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.speaker-icon {
    font-size: 14px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.empty-members {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Room Modals */
.room-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.room-modal.open {
    opacity: 1;
    pointer-events: all;
}

.room-modal-content {
    background: var(--bg-glass);
    backdrop-filter: blur(60px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.room-modal.open .room-modal-content {
    transform: scale(1);
}

.room-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-glass);
}

.room-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.room-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

.join-room-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.error-message {
    padding: 10px 14px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 8px;
    color: #ff3b30;
    font-size: 13px;
    text-align: center;
}

/* Screen Sharing */
.sharing-indicator {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(94, 92, 230, 0.15));
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.stop-share-btn {
    padding: 6px 14px;
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.5);
    border-radius: 8px;
    color: #ff3b30;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stop-share-btn:hover {
    background: rgba(255, 59, 48, 0.3);
    border-color: #ff3b30;
}

.screen-viewer {
    margin-top: 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 20px;
}

.screen-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.screen-count {
    color: var(--text-secondary);
    font-size: 14px;
    margin-left: 8px;
}

.screens-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.shared-screen-container {
    position: relative;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16/9;
    border: 1px solid var(--border-glass);
}

.shared-screen-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.screen-name-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .container {
        max-height: 40vh;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {

    /* Allow normal scrolling on mobile */
    body {
        overflow-y: auto;
    }

    .main-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        padding: 12px;
        gap: 12px;
        height: auto;
        /* Let content determine height */
        min-height: 100vh;
    }

    .container {
        max-height: none;
        /* Remove height restrictions */
        padding: 16px;
        border-radius: 16px;
    }

    .header h1 {
        font-size: 18px;
    }

    .chat-container {
        border-radius: 16px;
        height: auto;
        /* Natural height */
    }

    .chat-messages {
        padding: 16px;
        height: auto;
        /* Natural height */
        max-height: none;
    }

    /* Make chat input easier to tap - no sticky positioning */
    .chat-input-area {
        padding: 16px;
        gap: 8px;
    }

    .chat-input-area input {
        flex: 1;
        padding: 16px 18px;
        font-size: 16px;
        /* Prevent iOS zoom */
        min-height: 48px;
        /* Easy to tap */
        border-radius: 14px;
    }

    .chat-input-area button {
        padding: 16px 20px;
        min-width: 80px;
        min-height: 48px;
        /* Easy to tap */
        border-radius: 14px;
    }

    /* Improve message bubbles on mobile */
    .message-content {
        max-width: 85%;
    }

    .message.sent {
        max-width: 85%;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    /* Settings panel mobile adjustments */
    .settings-content {
        padding: 24px;
        max-height: 90vh;
        border-radius: 20px;
    }

    .settings-header h2 {
        font-size: 20px;
    }

    /* Login card mobile adjustments */
    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .login-card h2 {
        font-size: 24px;
    }

    .login-card input,
    .login-card button {
        font-size: 16px;
        /* Prevent iOS zoom */
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .main-wrapper {
        padding: 8px;
        gap: 8px;
    }

    .header h1 {
        font-size: 16px;
        gap: 8px;
    }

    .status-indicator {
        width: 10px;
        height: 10px;
    }

    .chat-header {
        padding: 16px;
        font-size: 16px;
    }

    .chat-input-area {
        padding: 12px;
    }

    .message-text {
        font-size: 13px;
    }
}