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

body {
    min-height: 100vh;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
    background-image:
        radial-gradient(
            ellipse 80% 50% at 50% -20%,
            rgba(59, 130, 246, 0.12),
            transparent
        ),
        radial-gradient(
            ellipse 60% 40% at 80% 100%,
            rgba(99, 102, 241, 0.08),
            transparent
        );
    color: #e2e8f0;
    overflow: hidden;
    position: relative;
    padding: 0;
}

body::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 98vh;
    border-radius: 24px;
    background: linear-gradient(
        145deg,
        rgba(22, 22, 35, 0.95),
        rgba(15, 15, 24, 0.98)
    );
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 80px rgba(59, 130, 246, 0.08);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
    background: rgba(15, 15, 25, 0.5);
}

.header-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.header-logo svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
}

.header-info {
    flex: 1;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 2px;
}

.header-subtitle {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Services Dropdown Menu */
.header-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(100, 116, 139, 0.2);
    background: rgba(30, 30, 45, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 15;
}

.header-menu-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.header-menu-btn:active {
    transform: scale(0.95);
}

.services-dropdown {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    background: linear-gradient(
        145deg,
        rgba(22, 22, 35, 0.98),
        rgba(15, 15, 24, 0.99)
    );
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
}

.services-dropdown.open {
    transform: translateX(0);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.services-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.services-dropdown-title {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.services-dropdown-title svg {
    width: 24px;
    height: 24px;
    color: #3b82f6;
}

.services-dropdown-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(100, 116, 139, 0.2);
    background: rgba(30, 30, 45, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.services-dropdown-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.service-item {
    background: rgba(30, 30, 45, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #e2e8f0;
}

.service-item:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(4px);
}

.service-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-icon.file {
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.2),
        rgba(99, 102, 241, 0.2)
    );
}
.service-icon.chat {
    background: linear-gradient(
        135deg,
        rgba(34, 197, 94, 0.2),
        rgba(30, 161, 204, 0.2)
    );
}
.service-icon.video {
    background: linear-gradient(
        135deg,
        rgba(239, 68, 68, 0.2),
        rgba(168, 85, 247, 0.2)
    );
}
.service-icon.audio {
    background: linear-gradient(
        135deg,
        rgba(249, 115, 22, 0.2),
        rgba(217, 70, 242, 0.2)
    );
}

.service-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
}
.service-icon.file svg {
    stroke: #3b82f6;
}
.service-icon.chat svg {
    stroke: #22c55e;
}
.service-icon.video svg {
    stroke: #ef4444;
}
.service-icon.audio svg {
    stroke: #f97316;
}

.service-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #f1f5f9;
}

.service-info p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.4;
}

.services-all-link {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.services-all-link:hover {
    color: #6366f1;
    gap: 8px;
}

/* Overlay for closing menu */
.services-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.services-overlay.active {
    opacity: 1;
    pointer-events: all;
}

#lobby {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: linear-gradient(
        145deg,
        rgba(30, 30, 45, 0.9),
        rgba(20, 20, 30, 0.95)
    );
}

/* Lobby Content */
.lobby-content {
    flex: 1;
    padding: 16px;
    overflow: hidden;
    display: flex;
    background: linear-gradient(
        145deg,
        rgba(30, 30, 45, 0.9),
        rgba(20, 20, 30, 0.95)
    );
    flex-direction: column;
    min-height: 0;
}

.lobby-content::-webkit-scrollbar {
    width: 4px;
}

.lobby-content::-webkit-scrollbar-track {
    background: transparent;
}

.lobby-content::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}

/* Form Elements */
.input-group {
    margin-bottom: 8px;
}

.input-label {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 8px;
    display: block;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(100, 116, 139, 0.2);
    background: rgba(15, 15, 25, 0.6);
    color: #e2e8f0;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
}

.input-field::placeholder {
    color: #475569;
}

.input-field:focus {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(15, 15, 25, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.input-row .input-field {
    flex: 1;
}

.btn-primary {
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

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

/* Search */
.search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0px 0px 0px 12px;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid rgba(100, 116, 139, 0.2);
    background: rgba(15, 15, 25, 0.6);
    transition: all 0.2s ease;
}

.search-wrapper:focus-within {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(15, 15, 25, 0.8);
}

.search-wrapper:focus-within .search-icon {
    stroke: #60a5fa;
}

.search-icon {
    width: 18px;
    height: 18px;
    stroke: #475569;
    flex-shrink: 0;
    transition: stroke 0.2s ease;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
    padding: 14px;
}

.search-input::placeholder {
    color: #475569;
}

/* Section */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Room Cards */
.rooms-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
}

.rooms-list::-webkit-scrollbar {
    width: 4px;
}

.rooms-list::-webkit-scrollbar-track {
    background: transparent;
}

.rooms-list::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}

.room-card {
    background: rgba(30, 30, 45, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s ease;
}

.room-card:hover {
    background: rgba(40, 40, 55, 0.6);
    border-color: rgba(59, 130, 246, 0.2);
}

.room-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.2),
        rgba(99, 102, 241, 0.2)
    );
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.room-avatar svg {
    width: 22px;
    height: 22px;
    stroke: #3b82f6;
}

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

.room-name {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-meta {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.room-meta svg {
    width: 12px;
    height: 12px;
    stroke: #64748b;
}

.btn-connect {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-connect:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: rgba(100, 116, 139, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.empty-icon svg {
    width: 28px;
    height: 28px;
    stroke: #475569;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
}

.empty-text {
    font-size: 13px;
    color: #64748b;
}

/* Chat View */
#chat {
    display: none;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.connection-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(10, 10, 15, 0.72);
    backdrop-filter: blur(3px);
}

.connection-overlay.hidden {
    display: none;
}

.connection-loader {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid rgba(148, 163, 184, 0.35);
    border-top-color: #3b82f6;
    animation: connection-spin 0.9s linear infinite;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.25);
}

.connection-overlay-text {
    font-size: 14px;
    color: #dbeafe;
    text-align: center;
    max-width: 280px;
    line-height: 1.5;
}

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

.chat-header {
    padding: 16px 20px;
    background: rgba(20, 20, 32, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 14px;
    backdrop-filter: blur(10px);
}

.btn-back {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    background: rgba(30, 30, 45, 0.5);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-back:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-back:hover svg {
    stroke: #ef4444;
}

.btn-back svg {
    width: 18px;
    height: 18px;
    stroke: #94a3b8;
    transition: stroke 0.2s ease;
}

.chat-peer {
    flex: 1;
}

.chat-peer-name {
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 2px;
}

.chat-peer-status {
    font-size: 12px;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-peer-status .status-dot {
    width: 6px;
    height: 6px;
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    background: linear-gradient(
        145deg,
        rgba(30, 30, 45, 0.9),
        rgba(20, 20, 30, 0.95)
    );
    flex-direction: column;
    gap: 8px;
}

.messages::-webkit-scrollbar {
    width: 4px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}

.message {
    max-width: 80%;
    padding: 8px 8px;
    font-size: 14px;
    line-height: 1.4;
    animation: message-in 0.2s ease;
    position: relative;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.me {
    align-self: flex-end;
    background: #2b5178;
    color: #fff;
    border-radius: 18px 18px 6px 18px;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}

.message.other {
    align-self: flex-start;
    background: rgba(45, 45, 60, 0.8);
    color: #e2e8f0;
    border-radius: 18px 18px 18px 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message-content {
    display: inline;
    word-wrap: break-word;
    word-break: break-word;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    white-space: nowrap;
    margin-left: 10px;
    display: inline-flex;
    align-items: flex-end;
    float: right;
    margin-top: 4px;
    position: relative;
    top: 3px;
}

.message-checks {
    font-size: 11px;
    margin-left: 4px;
    font-weight: 600;
}

.message-checks.delivered {
    color: #94a3b8;
}

.message-checks.read {
    color: #38bdf8;
}

.message.me .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message.other .message-time {
    color: #64748b;
}

/* Message Input */
.message-input-wrapper {
    padding: 12px 16px 12px 16px;
    background: rgba(20, 20, 32, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
    position: relative;
}

.btn-emoji {
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding-bottom: 6px;
}

.btn-emoji:hover {
    color: #3b82f6;
}

.btn-emoji svg {
    width: 24px;
    height: 24px;
}

.emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 16px;
    width: auto;
    height: 284px;
    max-height: 380px;
    background: rgba(25, 25, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.emoji-picker.show {
    display: flex;
}

.emoji-categories {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    flex-shrink: 0;
}

.emoji-categories::-webkit-scrollbar {
    display: none;
}

.emoji-cat-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.emoji-cat-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #94a3b8;
}

.emoji-cat-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.emoji-search {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.emoji-search input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(100, 116, 139, 0.2);
    background: rgba(15, 15, 25, 0.6);
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
}

.emoji-search input::placeholder {
    color: #475569;
}

.emoji-search input:focus {
    border-color: rgba(59, 130, 246, 0.5);
}

.emoji-grid {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.emoji-grid::-webkit-scrollbar {
    width: 4px;
}

.emoji-grid::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-grid::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}

.emoji-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.emoji-item:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.15);
}

.message-input {
    flex: 1;
    padding: 6px 16px 12px 16px;
    border-radius: 22px;
    border: 1px solid rgba(100, 116, 139, 0.2);
    background: rgba(30, 30, 45, 0.6);
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 34px;
    max-height: 120px;
    line-height: 1.4;
    transition:
        border-color 0.2s ease,
        background 0.2s ease;
    overflow-y: auto;
    scrollbar-width: none;
}

.message-input::-webkit-scrollbar {
    width: 3px;
}

.message-input::-webkit-scrollbar-track {
    background: transparent;
}

.message-input::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 3px;
}

.message-input::placeholder {
    color: #475569;
}

.message-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(30, 30, 45, 0.8);
}

.btn-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

.btn-send svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    margin-left: 2px;
}

/* Call Button */
.btn-call {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-call:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.btn-call svg {
    width: 20px;
    height: 20px;
    stroke: #22c55e;
}

.chat-status {
    text-align: center;
    font-size: 12px;
    color: #64748b;
    padding: 0px 8px 8px 8px;
    background: rgba(20, 20, 32, 0.5);
}

/* System Messages */
.system-message {
    align-self: center;
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
    font-size: 12px;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 8px 0;
}

/* Loader Spinner */
.btn-loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.btn-connect.loading {
    padding: 6px;
    cursor: not-allowed;
    opacity: 0.8;
}

.btn-connect.loading span {
    display: none;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .header {
        padding: 16px 20px;
    }

    .header-logo {
        width: 40px;
        height: 40px;
    }

    .header-logo svg {
        width: 20px;
        height: 20px;
    }

    .header-title {
        font-size: 16px;
    }

    .services-dropdown {
        max-width: 100%;
        width: 100%;
    }

    .header-menu-btn {
        width: 36px;
        height: 36px;
    }

    .lobby-content {
        padding: 16px;
    }

    .emoji-picker {
        left: 8px;
        right: 8px;
        width: calc(100% - 16px);
        max-width: 400px;
    }

    .room-card {
        padding: 14px;
    }

    .room-avatar {
        width: 44px;
        height: 44px;
    }

    .messages {
        padding: 16px;
    }

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

@media (max-width: 480px) {
    .header {
        padding: 14px 16px;
        gap: 12px;
    }

    .header-logo {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .header-logo svg {
        width: 18px;
        height: 18px;
    }

    .header-title {
        font-size: 15px;
    }

    .header-subtitle {
        font-size: 11px;
    }

    .services-dropdown {
        padding: 16px;
    }

    .services-dropdown-header {
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .services-dropdown-title {
        font-size: 18px;
    }

    .service-item {
        padding: 14px;
    }

    .service-icon {
        width: 42px;
        height: 42px;
    }

    .service-icon svg {
        width: 22px;
        height: 22px;
    }

    .service-info h4 {
        font-size: 15px;
    }

    .service-info p {
        font-size: 12px;
    }

    .lobby-content {
        padding: 16px;
    }

    .input-field {
        padding: 12px 14px;
        font-size: 16px;
    }

    .search-input {
        padding: 12px;
        font-size: 16px;
    }

    .btn-primary {
        padding: 14px 18px;
        font-size: 14px;
    }

    .input-row {
        flex-direction: column;
        gap: 8px;
    }

    .input-row .btn-primary {
        width: 100%;
    }

    .section-title {
        font-size: 12px;
    }

    .section-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .room-card {
        padding: 12px;
        gap: 12px;
    }

    .room-avatar {
        width: 40px;
        height: 40px;
    }

    .room-avatar svg {
        width: 20px;
        height: 20px;
    }

    .room-name {
        font-size: 14px;
    }

    .room-meta {
        font-size: 11px;
    }

    .btn-connect {
        padding: 8px 14px;
        font-size: 12px;
    }

    .empty-icon {
        width: 56px;
        height: 56px;
    }

    .empty-icon svg {
        width: 24px;
        height: 24px;
    }

    .empty-title {
        font-size: 14px;
    }

    .empty-text {
        font-size: 12px;
    }

    .chat-header {
        padding: 12px 16px;
        gap: 10px;
    }

    .btn-back {
        width: 32px;
        height: 32px;
    }

    .btn-back svg {
        width: 16px;
        height: 16px;
    }

    .chat-peer-name {
        font-size: 15px;
    }

    .chat-peer-status {
        font-size: 11px;
    }

    .btn-call {
        width: 36px;
        height: 36px;
    }

    .btn-call svg {
        width: 18px;
        height: 18px;
    }

    .messages {
        padding: 12px;
        gap: 6px;
    }

    .message {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 14px;
    }

    .message-time {
        font-size: 9px;
    }

    .message-input-wrapper {
        padding: 10px 12px;
        gap: 8px;
    }

    .btn-emoji svg {
        width: 22px;
        height: 22px;
    }

    .message-input {
        font-size: 14px;
        padding: 6px 16px 12px 16px;
        min-height: 34px;
    }

    .btn-send {
        width: 34px;
        height: 34px;
    }

    .btn-send svg {
        width: 18px;
        height: 18px;
    }

    .emoji-picker {
        bottom: 64px;
        left: 4px;
        right: 4px;
        width: calc(100% - 8px);
        height: 300px;
    }

    .emoji-categories {
        padding: 6px;
        gap: 2px;
    }

    .emoji-cat-btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    .emoji-search {
        padding: 8px 10px;
    }

    .emoji-search input {
        padding: 8px 12px;
        font-size: 14px;
    }

    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        padding: 8px;
    }

    .emoji-item {
        font-size: 20px;
    }

    .chat-status {
        font-size: 11px;
        padding: 6px;
    }

    .system-message {
        font-size: 11px;
        padding: 6px 12px;
    }
}

@media (max-width: 375px) {
    .header {
        padding: 12px 14px;
    }

    .lobby-content {
        padding: 14px;
    }

    .input-group {
        margin-bottom: 14px;
    }

    .input-row {
        margin-bottom: 16px;
    }

    .search-wrapper {
        margin-bottom: 16px;
    }

    .section-header {
        margin-bottom: 14px;
    }

    .room-card {
        padding: 10px;
        gap: 10px;
    }

    .room-avatar {
        width: 36px;
        height: 36px;
    }

    .room-name {
        font-size: 13px;
    }

    .messages {
        padding: 10px;
    }

    .message {
        padding: 8px 10px;
        font-size: 13px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .emoji-item {
        font-size: 18px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .container {
        height: 100vh;
        max-height: 100vh;
    }

    .header {
        padding: 10px 16px;
    }

    .lobby-content {
        padding: 12px 16px;
    }

    .messages {
        padding: 10px 12px;
    }

    .message-input-wrapper {
        padding: 8px 12px;
    }

    .emoji-picker {
        height: 200px;
        bottom: 56px;
    }

    .empty-state {
        padding: 20px;
    }
}

@media (hover: none) and (pointer: coarse) {
    button,
    .btn-primary,
    .btn-connect,
    .btn-send,
    .btn-emoji,
    .btn-back,
    .btn-call {
        touch-action: manipulation;
    }

    .btn-back,
    .btn-call,
    .btn-emoji,
    .btn-send {
        min-width: 22px;
        min-height: 22px;
    }
}

/* Attachment Button */
.btn-attach {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding-bottom: 14px;
}

.btn-attach svg {
    width: 22px;
    height: 22px;
}

/* File Transfer Progress */
.file-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 8px;
    padding: 8px 16px;
    background: rgba(30, 30, 45, 0.7);
    border-radius: 12px;
    animation: fade-in 0.3s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.file-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.file-speed {
    margin-left: 12px;
    color: #64748b;
    font-size: 13px;
    min-width: 70px;
    text-align: right;
    display: inline-block;
}

.file-progress-info {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.file-progress-cancel {
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.file-progress-cancel:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* File Message */
.message.file {
    max-width: 90%;
    padding: 12px 16px 12px 12px;
    background: rgba(45, 45, 60, 0.9);
    border-radius: 16px;
}

.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    background: #3b82f6;
    border-radius: 50px;
    margin-right: 8px;
    flex-shrink: 0;
}

.file-icon svg {
    width: 24px;
    height: 24px;
    stroke: #3b82f6;
}

.file-name {
    font-weight: 500;
    color: #f1f5f9;
    word-break: break-all;
}

.file-size {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    flex-direction: column;
    padding: 2px 0;
}

.context-menu-item {
    padding: 6px 10px;
    color: #e2e8f0;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s ease;
}

.context-menu-item:hover {
    background: rgba(59, 130, 246, 0.2);
}

.context-menu-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.message-quote {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    padding-left: 12px;
    border-left: 2px solid rgba(59, 130, 246, 0.4);
    max-width: 80%;
    align-self: flex-start;
}

.message.me + .message-quote {
    align-self: flex-end;
    border-left-color: rgba(255, 255, 255, 0.3);
}

.context-menu-item.save-image {
    display: none;
}

.message.image + .context-menu-item.save-image {
    display: block;
}

.quote-author {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.quote-text {
    font-size: 13px;
    color: #cbd5e1;
    word-break: break-word;
    line-height: 1.4;
}

/* Link Detection */
.message-content a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.message-content a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Image Message */
.message.image {
    max-width: 90%;
    padding: 12px 16px;
    background: rgba(45, 45, 60, 0.9);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

.message.image img.chat-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message.image img.chat-image:hover {
    transform: scale(1.03);
}

.message.image .file-name {
    font-weight: 500;
    color: #f1f5f9;
    font-size: 14px;
}

.message.image .file-size {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}
