:root {
    --bg-primary: #0f0c29;
    /* Darker navy for background */
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-heavy: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-gradient: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    --messenger-gradient: linear-gradient(135deg, #ff0080 0%, #ff8c00 100%);
    --msg-outgoing: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%);
    --msg-incoming: rgba(255, 255, 255, 0.1);
    --primary-color: #5b7aff;
    --primary-hover: #4a69ee;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
    width: 100vw;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: #0f0c29;
}

.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--messenger-gradient);
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: move 20s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    background: linear-gradient(135deg, #ff0080 0%, #ff8c00 100%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #00dbde 0%, #fc00ff 100%);
    animation-delay: -10s;
}

@keyframes move {
    from {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    to {
        transform: translate(100px, 100px) scale(1.2) rotate(360deg);
    }
}

.app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    position: relative;
    background: transparent;
    border: none;
    overflow: hidden;
}

.chat-header {
    height: 70px;
    padding: 0 1.5rem;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 100;
}

.header-left {
    display: flex;
    gap: 0.5rem;
}

.room-info-header {
    text-align: center;
}

.room-status {
    font-size: 0.75rem;
    color: var(--success-color);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.header-actions button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.screen {
    width: 100%;
    height: 100%;
    display: none;
}

.screen.active {
    display: flex;
}

/* ============= Sidebar ============= */
.sidebar {
    width: 280px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-img {
    height: 80px;
    width: auto;
    transition: height 0.3s ease;
}

/* Dashboard specific logo size */
#dashboard-screen .logo-img {
    height: 250px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-glass-heavy);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
    backdrop-filter: blur(5px);
}

.nav-icon {
    font-size: 1.5rem;
    transition: transform 0.2s;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}



.nav-text {
    font-size: 1rem;
    font-weight: 600;
}

/* ============= Main Content ============= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 90;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.sidebar-overlay.active {
    display: block;
    pointer-events: auto;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* ============= Auth Screens ============= */
#login-screen,
#register-screen {
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: transparent;
}

.auth-card {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 1.5rem;
    text-align: center;
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow);
}

.auth-logo {
    width: 200px;
    height: auto;
    margin-bottom: 2rem;
}

.auth-card h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: right;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.875rem;
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

input:focus {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    background: var(--primary-color);
    border: none;
    padding: 0.875rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

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

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

.secondary-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: none;
}

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

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============= Profile ============= */
.profile-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-width: 800px;
    margin: 2rem auto;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
}

.profile-card {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
}

.profile-avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.avatar-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
}

.profile-avatar-large {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0 0 75px 75px;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.avatar-wrapper:hover .avatar-overlay {
    opacity: 1;
}

.avatar-upload-btn {
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.profile-message {
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: none;
}

.profile-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: #6ee7b7;
}

.profile-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: #fca5a5;
}

/* ============= Dashboard ============= */
.dashboard-header {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem 2rem;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.logout-btn {
    background: var(--danger-color);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #dc2626;
}

.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.search-section,
.rooms-section {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.search-section h2,
.rooms-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
}

.search-box input {
    flex: 1;
    background: var(--bg-glass-heavy);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.25rem;
    border-radius: 2rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.search-box button {
    padding: 0 1.25rem;
    background: var(--primary-color);
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.search-box button:hover {
    background: var(--primary-hover);
}

.search-results,
.invite-search-results {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(5px);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}

.user-result:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.user-result .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    color: white;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.user-email {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.invite-user-btn,
.invite-btn {
    background: var(--primary-color);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: none;
    border-radius: 0.375rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.invite-user-btn:hover,
.invite-btn:hover {
    background: var(--primary-hover);
}

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

.no-results,
.no-rooms,
.loading,
.error,
.search-hint {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.rooms-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.room-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

.room-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 122, 255, 0.2);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.room-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.admin-badge {
    background: var(--success-color);
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.unread-badge {
    background: var(--danger-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.enter-room-btn {
    width: 100%;
    background: var(--primary-color);
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.enter-room-btn:hover {
    background: var(--primary-hover);
}

/* ============= Modal ============= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.invite-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============= Chat Screen ============= */
.chat-header {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
    z-index: 50;
}

.back-btn {
    background: var(--bg-tertiary);
    width: 44px;
    height: 44px;
    border-radius: 0.75rem;
    padding: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--bg-hover);
}

.room-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 0.5rem;
}

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

.user-info {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.room-settings-btn,
.invite-members-btn,
.call-btn {
    background: var(--bg-tertiary);
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-settings-btn:hover,
.invite-members-btn:hover,
.call-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.call-btn.active-call {
    background: var(--danger-color);
    border-color: var(--danger-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.messages-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scroll-behavior: smooth;
    background: transparent;
}

.message-wrapper {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
    margin-bottom: 0.25rem;
    animation: slideIn 0.3s ease-out;
}

.message-wrapper.incoming {
    align-self: flex-start;
    flex-direction: row;
}

.message-wrapper.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 4px;
}

.message-box {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 1rem;
    border-radius: 1.25rem;
    position: relative;
    line-height: 1.4;
    min-width: 40px;
    font-size: 0.95rem;
}

.incoming .message-box {
    background: var(--bg-glass-heavy);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-bottom-right-radius: 0.25rem;
}

.outgoing .message-box {
    background: var(--msg-outgoing);
    color: white;
    border: none;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.3);
}

.message-box .sender {
    display: none;
    /* Messenger style - names not shown in bubble */
}

.message-box .timestamp {
    font-size: 0.65rem;
    opacity: 0.5;
    margin-top: 0.2rem;
    align-self: flex-end;
}

.openmoji {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin: 0 2px;
}

.outgoing .message-box .timestamp {
    color: rgba(255, 255, 255, 0.7);
}

/* Input Area Overhaul */
.input-area {
    padding: 1rem 1.5rem;
    background: rgba(15, 15, 15, 0.82);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 150;
    /* Increased to stay above everything */
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.input-actions-left {
    display: flex;
    gap: 0.5rem;
}

.action-icon {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

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

#message-form {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.input-wrapper {
    flex: 1;
    background: var(--bg-glass-heavy);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border: 1px solid var(--glass-border);
}

#message-input {
    flex: 1;
    background: none;
    border: none;
    padding: 0.6rem 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

#message-input:focus {
    outline: none;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
}

#send-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.75rem;
    cursor: pointer;
    transition: transform 0.2s;
}

#send-btn:hover {
    transform: scale(1.1);
}

/* Info Sidebar Styling */
.info-sidebar {
    width: 320px;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(15px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    transition: transform 0.3s ease;
}

.info-sidebar:not(.open) {
    transform: translateX(100%);
    position: absolute;
    right: 0;
    height: 100%;
}

.info-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.sidebar-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 1rem;
    border: 3px solid var(--primary-color);
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.section-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
}

.section-header:hover {
    color: var(--primary-color);
}


.message-image,
.message-video {
    max-width: 100%;
    width: 320px;
    height: auto;
    border-radius: 12px;
    margin-top: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    background: #000;
}

.message-image:hover,
.message-video:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.message-audio {
    width: 280px;
    height: 45px;
    margin-top: 8px;
    border-radius: 25px;
    background: transparent;
    filter: invert(0.9) hue-rotate(180deg) brightness(1.2);
    /* Adjust for dark mode */
    opacity: 0.95;
    transition: all 0.2s;
}

.message-audio:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Specific styling for outgoing audio to keep it clean on blue background */
.outgoing .message-audio {
    filter: invert(1) brightness(2);
}

.message-file {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    color: white;
    text-decoration: none;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

.message-file:hover {
    background: rgba(0, 0, 0, 0.5);
}

.system-message-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0.5rem 0;
}

.message.system {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.input-area {
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

#message-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.file-btn {
    background: var(--bg-tertiary);
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.125rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.file-btn:hover,
.voice-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.voice-btn.recording {
    background: var(--danger-color);
    color: white;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

#message-form input[type="text"] {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 2rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

#message-form input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.voice-btn {
    background: var(--bg-tertiary);
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 1.25rem;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#message-form button[type="submit"] {
    background: var(--primary-color);
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

#message-form button[type="submit"]:hover {
    background: var(--primary-hover);
}

/* ============= Animations ============= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

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

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

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

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

/* ============= Responsive ============= */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Fixed sidebars for mobile */
    .sidebar {
        position: fixed;
        right: -280px;
        left: auto;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 2000;
        transition: right 0.3s ease-in-out;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        background: rgba(15, 15, 15, 0.95);
        backdrop-filter: blur(20px);
        border-left: 1px solid var(--glass-border);
    }

    .sidebar.open {
        right: 0;
    }

    .info-sidebar {
        position: fixed;
        left: -100%;
        right: auto;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 320px;
        z-index: 2000;
        transition: left 0.3s ease-in-out;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        background: rgba(15, 15, 15, 0.95);
        backdrop-filter: blur(20px);
        border-right: 1px solid var(--glass-border);
    }

    .info-sidebar.open {
        left: 0;
    }

    .main-content {
        width: 100%;
        min-width: 100%;
        flex: none;
        overflow-x: hidden;
    }

    .app-container {
        overflow: hidden;
        display: flex;
        flex-direction: row;
        /* Sidebar and main content side-by-side if needed */
        width: 100vw;
        height: 100dvh;
    }

    .screen {
        width: 100%;
        height: 100%;
        display: none;
        overflow: hidden;
    }

    /* Auth screens should scroll if content exceeds screen */
    #login-screen,
    #register-screen {
        overflow-y: auto;
        padding: 1rem 0.5rem;
        display: none;
        align-items: center;
        justify-content: center;
    }

    .screen.active,
    #login-screen.active,
    #register-screen.active {
        display: flex;
    }

    .auth-card {
        padding: 1rem;
        width: 95%;
        max-width: 400px;
        margin: auto;
        border-radius: 1rem;
        flex-shrink: 0;
    }

    .auth-logo {
        width: 130px;
        margin-bottom: 0.75rem;
    }

    .auth-card h1 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .auth-card p {
        margin-bottom: 1rem;
        font-size: 0.8rem;
    }

    .auth-card form {
        gap: 0.75rem;
    }

    .input-group label {
        font-size: 0.8rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        padding: 0.6rem;
    }

    .main-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .chat-header {
        padding: 0 0.75rem;
        height: 60px;
        display: flex;
        justify-content: space-between;
        flex-shrink: 0;
        z-index: 100;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .room-info-header {
        max-width: 150px;
        overflow: hidden;
    }

    .room-name {
        font-size: 0.9rem;
        white-space: nowrap;
        text-overflow: ellipsis;
        display: block;
    }

    .messages-container {
        padding: 1rem 0.5rem;
        width: 100%;
    }

    .message-wrapper {
        max-width: 92%;
    }

    .input-area {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
        width: 100%;
        background: rgba(10, 10, 10, 0.9);
    }

    .input-actions-left {
        gap: 0.2rem;
    }

    .action-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .input-wrapper input {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }

    #message-form {
        gap: 0.4rem;
    }
}

/* Sticky Notification Bar */
.sticky-notification {
    background: rgba(var(--primary-rgb), 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: absolute;
    top: 60px;
    /* Below header */
    left: 0;
    z-index: 90;
    animation: slideDown 0.3s ease-out;
}

.sticky-notification.active {
    display: flex;
}

.close-notification {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.5rem;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

/* Header Action Buttons */
.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

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

/* Settings Modal Enhancements */
.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1.5rem 0;
}

.danger-zone {
    border: 1px solid rgba(220, 53, 69, 0.3);
    padding: 1rem;
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.05);
}

.danger-zone label {
    color: #ff6b6b;
    font-weight: bold;
}

.danger-zone .description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.danger-btn {
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    transition: background 0.2s;
}

.danger-btn:hover {
    background: #c82333;
}