/* ============================================
   CSS VARIABLES - Modern Color System
   ============================================ */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: rgba(15, 23, 42, 0.08);
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --message-self: #3b82f6;
    --message-other: #64748b;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: rgba(0, 0, 0, 0.4);
    --accent-primary: #60a5fa;
    --accent-hover: #3b82f6;
    --danger: #f87171;
    --danger-hover: #ef4444;
    --success: #34d399;
    --warning: #fbbf24;
    --message-self: #3b82f6;
    --message-other: #475569;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* ============================================
   LANDING PAGE - Professional Layout
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 20px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--bg-tertiary);
}

.landing {
    max-width: 1000px;
    margin: 0 auto;
}

.hero {
    text-align: center;
    margin-bottom: 50px;
}

.hero h2 {
    font-size: 2.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 700;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 60px;
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px var(--shadow);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
}

.card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.938rem;
}

.card input[type="text"] {
    width: 90%;
    max-width: 300px;
    padding: 14px 16px;
    margin: 0 auto 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    display: block;
}

.card input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.card input[type="text"]::placeholder {
    color: var(--text-secondary);
    letter-spacing: 1px;
    font-weight: 500;
}

.card .btn {
    min-width: 160px;
    padding: 14px 32px;
    font-size: 1rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin: 60px 0;
}

.feature {
    text-align: center;
    padding: 24px 16px;
}

.feature .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.feature h4 {
    font-size: 1.125rem;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-links a {
    font-size: 0.938rem;
    font-weight: 500;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   CHAT CONTAINER - Professional Layout
   ============================================ */

.chat-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* ============================================
   CHAT HEADER - Clean & Compact
   ============================================ */

.chat-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
    box-shadow: 0 1px 3px var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.header-left h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

#end-chat-btn-mobile {
    display: none;
}

.room-id {
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-id strong {
    color: var(--accent-primary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-icon:active {
    transform: translateY(0);
}

.btn-danger-small {
    background: var(--danger);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.938rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-danger-small:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================
   CHAT BODY - Optimized Layout
   ============================================ */

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.status-indicator {
    font-size: 0.625rem;
}

.encryption-notice {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 20px;
    background: var(--success);
    color: white;
    font-size: 0.813rem;
    font-weight: 500;
}

/* ============================================
   USERS LIST - Compact Design
   ============================================ */

.users-list {
    background: var(--bg-secondary);
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    margin: 0;
    overflow: hidden;
}

.users-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.users-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.users-list-items {
    padding: 8px;
    max-height: 120px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.user-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.user-item:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

.user-badge-you {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #f59e0b 0%, #10b981 100%);
    color: white;
    padding: 2px 5px;
    border-radius: 8px;
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.users-list-empty {
    grid-column: 1 / -1;
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}



/* ============================================
   MESSAGES CONTAINER - Modern Chat UI
   ============================================ */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.message {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    animation: messageSlide 0.25s ease;
    box-shadow: 0 1px 2px var(--shadow);
    line-height: 1.5;
}

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

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

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

.system-message {
    align-self: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 0.813rem;
    text-align: center;
    max-width: 80%;
    box-shadow: none;
}

.message-timestamp {
    font-size: 0.688rem;
    opacity: 0.7;
    margin-top: 6px;
    font-weight: 400;
}

.message-self video,
.message-other video {
    background: transparent;
    display: block;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

.typing-indicator {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* ============================================
   CHAT INPUT - Redesigned Layout
   ============================================ */

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.input-tools {
    display: flex;
    gap: 6px;
    align-items: center;
}

.input-field-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    font-size: 0.938rem;
    line-height: 1.5;
    transition: all 0.2s ease;
}

#message-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#message-input::placeholder {
    color: var(--text-secondary);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.938rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

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

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

#send-btn {
    padding: 0 28px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   EMOJI PICKER
   ============================================ */

.emoji-trigger {
    font-size: 1.5rem;
}

.emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    max-width: 340px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 10px 25px var(--shadow);
    z-index: 100;
}

.emoji-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.emoji-item:hover {
    background: var(--bg-tertiary);
    transform: scale(1.15);
}

/* ============================================
   MODALS - Professional Design
   ============================================ */

.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-box {
    position: relative;
    background: var(--bg-primary);
    padding: 32px;
    border-radius: 16px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Mobile: Position modal higher to avoid keyboard */
@media (max-width: 768px) {
    #username-modal {
        align-items: flex-start;
        padding-top: 15vh;
    }
    
    #username-modal .modal-box {
        margin-bottom: auto;
    }
}

@media (max-height: 600px) {
    #username-modal {
        padding-top: 8vh;
    }
}

.modal-box h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 1.375rem;
    font-weight: 600;
}

.modal-box p {
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 0.938rem;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================
   WAITING MODAL
   ============================================ */

#waiting-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    pointer-events: none;
}

.waiting-notification {
    background: var(--bg-primary);
    padding: 40px 50px;
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--shadow);
    text-align: center;
    width: 380px;
    max-width: 90vw;
    pointer-events: all;
}

@media (max-width: 768px) {
    .waiting-notification {
        padding: 36px 40px;
        width: 320px;
        max-width: 85vw;
    }
}

.waiting-notification .spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.waiting-notification h3 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.waiting-notification p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.938rem;
}

/* ============================================
   VOICE RECORDING MODAL
   ============================================ */

.voice-record-box {
    min-width: 360px;
}

.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
}

.recording-dot {
    width: 16px;
    height: 16px;
    background: var(--danger);
    border-radius: 50%;
    animation: recordingPulse 1.5s ease-in-out infinite;
}

@keyframes recordingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.2); }
}

.voice-waveform {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    height: 64px;
    margin: 20px 0;
}

.wave-bar {
    width: 8px;
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    border-radius: 4px;
    min-height: 12px;
    transition: height 0.1s ease;
}

.voice-message-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    max-width: 260px;
}

[data-theme="dark"] .voice-message-player {
    background: rgba(255, 255, 255, 0.04);
}

.voice-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.voice-play-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.voice-duration {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   RESPONSIVE - MOBILE OPTIMIZED
   ============================================ */

@media (max-width: 768px) {
    /* Landing Page */
    header {
        padding: 24px 16px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        top: 12px;
        right: 12px;
    }

    .hero {
        margin-bottom: 30px;
    }

    .hero h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .hero p {
        font-size: 0.875rem;
        line-height: 1.5;
    }

    .action-cards {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 30px;
    }

    .card {
        padding: 20px 18px;
    }

    .card h3 {
        font-size: 1.125rem;
        margin-bottom: 8px;
    }

    .card p {
        font-size: 0.813rem;
        margin-bottom: 14px;
    }

    .card input[type="text"] {
        padding: 12px 14px;
        font-size: 0.938rem;
        margin-bottom: 12px;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        margin: 30px 0;
    }

    .feature {
        padding: 16px 12px;
    }

    .feature .icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .feature h4 {
        font-size: 0.938rem;
        margin-bottom: 6px;
    }

    .feature p {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .footer-links {
        gap: 16px;
    }

    footer {
        padding: 30px 16px;
        margin-top: 40px;
    }

    /* Chat Page - MOBILE REDESIGN */
    .chat-header {
        display: flex;
        flex-direction: column;
        padding: 10px 12px;
        gap: 8px;
    }

    /* Top row: Logo + Room ID (left) | End button (right) */
    .header-left {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 8px;
    }

    .header-left h2 {
        font-size: 1rem;
        margin: 0;
        flex-shrink: 0;
    }

    .room-id {
        font-size: 0.75rem;
        flex: 1;
        min-width: 0;
    }

    #end-chat-btn-mobile {
        display: block;
        margin-left: auto;
    }

    #end-chat-btn {
        display: none;
    }

    /* Bottom row: All icons in one line */
    .header-right {
        display: flex;
        justify-content: space-between;
        width: 100%;
        gap: 4px;
    }

    .btn-icon {
        width: 38px;
        height: 38px;
        font-size: 1.25rem;
        padding: 6px;
    }

    .btn-danger-small {
        padding: 6px 12px;
        font-size: 0.75rem;
        height: 32px;
    }

    /* Users List - Lower height on mobile */
    .users-list {
        margin: 0;
    }

    .users-list-header {
        padding: 5px 10px;
        font-size: 0.688rem;
    }

    .users-count {
        padding: 2px 6px;
        font-size: 0.625rem;
    }

    .users-list-items {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        max-height: 50px;
        padding: 5px;
    }

    .user-item {
        padding: 4px 3px;
        gap: 3px;
        position: relative;
    }

    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.688rem;
        position: relative;
    }

    .user-name {
        font-size: 0.563rem;
    }

    .user-badge-you {
        position: absolute;
        top: -3px;
        right: -3px;
        font-size: 0.375rem;
        padding: 1px 3px;
        border-radius: 6px;
    }

    .messages-container {
        padding: 12px;
        gap: 10px;
    }

    .message {
        max-width: 80%;
        padding: 10px 14px;
        border-radius: 14px;
    }

    .chat-input-container {
        padding: 10px 12px;
    }

    .input-tools {
        gap: 4px;
    }

    #message-input {
        font-size: 16px;
        padding: 10px 14px;
    }

    #send-btn {
        padding: 0 18px;
        font-size: 0.875rem;
    }

    .emoji-picker {
        left: 12px;
        right: 12px;
        max-width: none;
        bottom: 110px;
    }

    .modal-box {
        padding: 28px 24px;
    }

    .waiting-notification {
        width: 320px;
        padding: 36px 40px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.813rem;
    }

    .hero h2 {
        font-size: 1.25rem;
        margin-bottom: 8px;
    }

    .hero p {
        font-size: 0.813rem;
    }

    .card {
        padding: 18px 16px;
    }

    .card h3 {
        font-size: 1rem;
    }

    .card p {
        font-size: 0.75rem;
        margin-bottom: 12px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .feature {
        padding: 12px;
    }

    .feature .icon {
        font-size: 1.75rem;
    }

    .feature h4 {
        font-size: 0.875rem;
    }

    .feature p {
        font-size: 0.688rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }

    .footer-text {
        font-size: 0.75rem;
    }

    .header-left h2 {
        font-size: 1rem;
    }

    .room-id {
        font-size: 0.75rem;
    }

    .btn-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .users-list-items {
        grid-template-columns: repeat(3, 1fr);
    }

    .message {
        max-width: 85%;
        font-size: 0.938rem;
    }

    #message-input {
        min-height: 42px;
    }

    #send-btn {
        height: 42px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

input:disabled,
textarea:disabled,
button:disabled {
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}