/**
 * GameHubJS - Chat Styles
 * Consolidated chat styling — replaces the duplicated rules in main.css + games.css.
 *
 * Filename: app/static/css/chat.css
 * Signed: admin@thepandadev.com
 */

/* ============================================
   Chat Ban Banner
   ============================================ */
.chat-ban-banner {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: #ffb1b1;
    font-size: 0.9rem;
}

.chat-ban-banner i {
    font-size: 1.4rem;
    color: #ff6b6b;
}

.chat-ban-banner .chat-ban-reason {
    display: block;
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 0.15rem;
}

.chat-ban-banner .chat-ban-contact {
    display: block;
    font-size: 0.75rem;
    color: #718096;
    margin-top: 0.15rem;
}

/* ============================================
   Chat Hero Banner
   ============================================ */
.chat-hero {
    position: relative;
    padding: 1.5rem 2rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, #1a1a3e 0%, #0a0a1a 100%);
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.03);
}

.chat-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.chat-hero .hero-content {
    position: relative;
    z-index: 2;
}

.chat-hero .hero-title {
    font-family: var(--font-gaming, 'Orbitron', sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.chat-hero .hero-title i { color: #4facfe; }

.chat-hero .hero-subtitle {
    color: var(--text-muted, #718096);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.chat-hero .online-count {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(72, 187, 120, 0.1);
    border: 1px solid rgba(72, 187, 120, 0.2);
    color: #48bb78;
    font-size: 0.8rem;
}

.chat-hero .online-count .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #48bb78;
    animation: chatStatusPulse 2s ease-in-out infinite;
}

@keyframes chatStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================
   Chat Page Wrapper
   Keeps the chat container from overflowing the
   fixed header + fixed mobile bottom nav.
   ============================================ */
.chat-page-wrapper {
    display: flex;
    flex-direction: column;
    /* Reserve space for the mobile bottom nav (72px) + safe-area inset */
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

/* ============================================
   Chat Container
   ============================================ */
.chat-container {
    display: flex;
    /* dvh respects dynamic mobile browser chrome; vh fallback below */
    height: calc(100dvh - 280px);
    min-height: 400px;
    max-height: calc(100dvh - 200px);
    background: rgba(255,255,255,0.02);
    border-radius: 1rem;
    border: 1px solid rgba(255,255,255,0.03);
    overflow: hidden;
}

/* Fallback for browsers without dvh support */
@supports not (height: 100dvh) {
    .chat-container {
        height: calc(100vh - 280px);
        max-height: calc(100vh - 200px);
    }
}

/* ============================================
   Sidebar
   ============================================ */
.chat-sidebar {
    width: 240px;
    background: rgba(255,255,255,0.02);
    border-right: 1px solid rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
}

.chat-sidebar .sidebar-header {
    padding: 0.75rem 1rem;
    min-height: 52px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-sidebar .sidebar-header h6 {
    font-weight: 600;
    color: var(--text-secondary, #a0aec0);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.chat-sidebar .sidebar-header h6 i {
    margin-right: 0.5rem;
    color: var(--brand-primary, #6c63ff);
}

.chat-sidebar .sidebar-create-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(108, 99, 255, 0.5);
    background: linear-gradient(135deg, #6c63ff, #ff6584);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.35);
}

.chat-sidebar .sidebar-create-btn:hover {
    background: linear-gradient(135deg, #7a72ff, #ff7593);
    border-color: transparent;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
}

.chat-sidebar .sidebar-create-btn:active {
    transform: scale(0.95);
}

.chat-sidebar .sidebar-create-btn i {
    font-size: 0.95rem;
    line-height: 1;
}

.chat-sidebar .room-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem;
}

.chat-sidebar .room-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-secondary, #a0aec0);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.chat-sidebar .room-item:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-primary, #fff);
}

.chat-sidebar .room-item.active {
    background: rgba(108, 99, 255, 0.08);
    color: var(--brand-primary, #6c63ff);
}

.chat-sidebar .room-item .room-icon {
    font-size: 0.9rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.chat-sidebar .room-item .room-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-sidebar .room-item .room-private-badge {
    font-size: 0.6rem;
    color: #ffd93d;
    flex-shrink: 0;
}

/* ============================================
   Main Chat Area
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.chat-main .chat-header {
    padding: 0.5rem 1rem;
    min-height: 48px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-main .chat-header .room-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chat-main .chat-header .room-info .room-name {
    font-weight: 600;
    color: #fff;
}

.chat-main .chat-header .room-info .room-type {
    font-size: 0.6rem;
    padding: 0.05rem 0.4rem;
    border-radius: 10px;
    background: rgba(108, 99, 255, 0.2);
    color: var(--brand-primary, #6c63ff);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-main .chat-header .room-info .room-owner-badge {
    font-size: 0.6rem;
    padding: 0.05rem 0.4rem;
    border-radius: 10px;
    background: rgba(255, 217, 61, 0.15);
    color: #ffd93d;
    font-weight: 600;
}

.chat-main .chat-header .chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-main .chat-header .chat-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: var(--text-secondary, #a0aec0);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-main .chat-header .chat-header-btn:hover {
    background: rgba(108, 99, 255, 0.1);
    color: var(--brand-primary, #6c63ff);
    border-color: rgba(108, 99, 255, 0.3);
}

.chat-main .chat-header .online-count {
    font-size: 0.75rem;
    color: var(--text-muted, #718096);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ============================================
   Messages Area
   ============================================ */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: rgba(0,0,0,0.2);
}

.chat-message {
    display: flex;
    gap: 0.5rem;
    animation: chatMessageSlide 0.3s ease;
    max-width: 85%;
}

.chat-message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary, linear-gradient(135deg, #6c63ff, #ff6584));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-message .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-message .message-bubble {
    background: rgba(255,255,255,0.03);
    padding: 0.4rem 0.75rem;
    border-radius: 0.75rem;
    border-top-left-radius: 0.2rem;
    max-width: 100%;
    position: relative;
}

.chat-message.sent .message-bubble {
    background: var(--gradient-primary, linear-gradient(135deg, #6c63ff, #ff6584));
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.2rem;
    color: #fff;
}

.chat-message .message-bubble .message-username {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--brand-primary, #6c63ff);
    margin-bottom: 0.05rem;
}

.chat-message.sent .message-bubble .message-username {
    color: rgba(255,255,255,0.8);
}

.chat-message .message-bubble .message-text {
    font-size: 0.85rem;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-message .message-bubble .message-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.55rem;
    color: var(--text-muted, #718096);
    margin-top: 0.15rem;
    align-items: center;
}

.chat-message.sent .message-bubble .message-meta {
    color: rgba(255,255,255,0.6);
}

.chat-message .message-bubble .message-meta .edited-badge {
    font-style: italic;
}

.chat-message.system {
    align-self: center;
    max-width: 90%;
}

.chat-message.system .message-bubble {
    background: rgba(108, 99, 255, 0.05);
    border-radius: 0.75rem;
    padding: 0.2rem 0.75rem;
    text-align: center;
}

.chat-message.system .message-bubble .message-text {
    font-size: 0.75rem;
    color: var(--text-muted, #718096);
}

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

/* ============================================
   Typing Indicator
   ============================================ */
.typing-indicator {
    padding: 0.15rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted, #718096);
    font-style: italic;
    min-height: 20px;
    flex-shrink: 0;
    display: none;
}

/* ============================================
   Chat Input
   ============================================ */
.chat-input-area {
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.03);
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}

.chat-input-area .input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input-area .input-wrapper input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary, #fff);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.chat-input-area .input-wrapper input:focus {
    outline: none;
    border-color: rgba(108, 99, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.05);
}

.chat-input-area .input-wrapper input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input-area .input-wrapper input::placeholder {
    color: var(--text-muted, #718096);
}

.chat-input-area .input-wrapper .input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #718096);
    font-size: 0.85rem;
    pointer-events: none;
}

.chat-input-area .btn-send {
    width: 44px;
    height: 44px;
    border-radius: 0.75rem;
    border: none;
    background: var(--gradient-primary, linear-gradient(135deg, #6c63ff, #ff6584));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-input-area .btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3);
}

.chat-input-area .btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Modals (Create Room / Invite)
   ============================================ */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-custom {
    background: linear-gradient(135deg, #1a1a3e, #0a0a1a);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 1.25rem;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
    box-shadow: 0 20px 80px rgba(0,0,0,0.6);
    animation: chatModalIn 0.3s ease;
}

@keyframes chatModalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.modal-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.modal-header-custom h5 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header-custom h5 i { color: var(--brand-primary, #6c63ff); }

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: #a0aec0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.2);
}

.modal-body-custom { margin-bottom: 1.25rem; }

.form-group-custom {
    margin-bottom: 1rem;
}

.form-group-custom label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #a0aec0);
    margin-bottom: 0.4rem;
}

.form-group-custom label small {
    font-weight: 400;
    color: var(--text-muted, #718096);
}

.form-group-custom input[type="text"],
.form-group-custom textarea {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    border-radius: 0.75rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group-custom input[type="text"]:focus,
.form-group-custom textarea:focus {
    outline: none;
    border-color: var(--brand-primary, #6c63ff);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
    background: rgba(255,255,255,0.05);
}

.form-group-custom textarea {
    resize: vertical;
    min-height: 70px;
}

.form-group-custom .hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted, #718096);
    margin-top: 0.35rem;
}

.room-type-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary, #a0aec0);
}

.room-type-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-primary, #6c63ff);
    cursor: pointer;
}

.modal-status {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    min-height: 0;
    margin-top: 0.5rem;
}

.modal-status.error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: #ff6b6b;
}

.modal-status.success {
    background: rgba(72, 187, 120, 0.1);
    border: 1px solid rgba(72, 187, 120, 0.25);
    color: #48bb78;
}

.modal-status.info {
    background: rgba(108, 99, 255, 0.08);
    border: 1px solid rgba(108, 99, 255, 0.2);
    color: var(--brand-primary, #6c63ff);
}

.modal-status:empty { display: none; }

.modal-footer-custom {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.btn-primary-custom,
.btn-secondary-custom {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary-custom {
    background: var(--gradient-primary, linear-gradient(135deg, #6c63ff, #ff6584));
    color: #fff;
}

.btn-primary-custom:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.35);
}

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

.btn-secondary-custom {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
    color: var(--text-secondary, #a0aec0);
}

.btn-secondary-custom:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* ============================================
   Members panel (inside invite modal)
   ============================================ */
.invite-members-panel {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.invite-members-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #718096);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.members-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

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

.member-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gradient-primary, linear-gradient(135deg, #6c63ff, #ff6584));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.member-name {
    font-size: 0.85rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-tag.owner {
    font-size: 0.55rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: rgba(255, 217, 61, 0.15);
    color: #ffd93d;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.member-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.member-status.online  { background: #48bb78; box-shadow: 0 0 6px #48bb78; }
.member-status.offline { background: #4a5568; }

.members-loading,
.members-empty {
    font-size: 0.8rem;
    color: var(--text-muted, #718096);
    padding: 0.75rem;
    text-align: center;
    list-style: none;
}

/* ============================================
   Chat toast (invites)
   ============================================ */
.chat-toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: linear-gradient(135deg, #1a1a3e, #0a0a1a);
    border: 1px solid rgba(79, 172, 254, 0.3);
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 3000;
    max-width: 380px;
    color: #fff;
    animation: chatToastIn 0.3s ease;
}

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

.chat-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(79, 172, 254, 0.15);
    color: #4facfe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-toast-body {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-toast-link {
    padding: 0.25rem 0.7rem;
    background: var(--gradient-primary, linear-gradient(135deg, #6c63ff, #ff6584));
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 2rem;
    text-decoration: none;
    flex-shrink: 0;
}

.chat-toast-link:hover { color: #fff; transform: translateY(-1px); }

.chat-toast-close {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 0.7rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toast-close:hover { color: #fff; background: rgba(255,255,255,0.05); }

/* ============================================
   Responsive — Tablet
   ============================================ */
@media (max-width: 992px) {
    .chat-sidebar { width: 200px; }
}

/* ============================================
   Responsive — Mobile (<= 768px)
   Hides the hero banner to reclaim vertical space.
   Uses dvh + reserves the mobile bottom nav area.
   ============================================ */
@media (max-width: 768px) {
    /* Hide hero entirely on mobile — biggest win for space */
    .chat-hero {
        display: none !important;
    }

    /* Tighter outer padding on mobile */
    .chat-page-wrapper {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-top: 0.5rem;
        /* Reserve space for the mobile bottom nav (72px) */
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 0.5rem);
    }

    .chat-container {
        /* Account for: navbar (~70px) + bottom nav (~72px) + small margins */
        height: calc(100dvh - 160px);
        max-height: calc(100dvh - 160px);
        min-height: 0;
        flex-direction: column;
        border-radius: 0.75rem;
    }

    /* Fallback for browsers without dvh */
    @supports not (height: 100dvh) {
        .chat-container {
            height: calc(100vh - 160px);
            max-height: calc(100vh - 160px);
        }
    }

    /* Sidebar becomes a horizontal strip at the top */
    .chat-sidebar {
        width: 100%;
        max-height: 108px;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        overflow: visible;
    }

    .chat-sidebar .sidebar-header {
        padding: 0.5rem 0.75rem;
        min-height: 48px;
        flex-shrink: 0;
    }

    .chat-sidebar .sidebar-create-btn {
        width: 30px;
        height: 30px;
        box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
    }

    .chat-sidebar .room-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.25rem 0.5rem;
        gap: 0.25rem;
        height: 56px;
        align-items: center;
        flex: none;
    }

    .chat-sidebar .room-item {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.3rem 0.6rem;
    }

    .chat-sidebar .room-item .room-name { max-width: 120px; }

    .chat-message { max-width: 90%; }
    .chat-message .message-bubble { padding: 0.3rem 0.6rem; }
    .chat-message .message-bubble .message-text { font-size: 0.8rem; }
    .chat-message .message-bubble .message-username { font-size: 0.65rem; }

    .chat-main .chat-header .room-info .room-name { font-size: 0.9rem; }

    .modal-custom { padding: 1.25rem; }
    .modal-header-custom h5 { font-size: 1rem; }
    .modal-footer-custom { flex-direction: column-reverse; }
    .btn-primary-custom,
    .btn-secondary-custom { width: 100%; justify-content: center; }

    .chat-toast {
        left: 10px;
        right: 10px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 10px);
        max-width: none;
    }
}

/* ============================================
   Responsive — Small phones (<= 576px)
   ============================================ */
@media (max-width: 576px) {
    .chat-page-wrapper {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
        padding-top: 0.4rem;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 0.4rem);
    }

    .chat-container {
        height: calc(100dvh - 140px);
        max-height: calc(100dvh - 140px);
        min-height: 0;
        border-radius: 0.5rem;
    }

    @supports not (height: 100dvh) {
        .chat-container {
            height: calc(100vh - 140px);
            max-height: calc(100vh - 140px);
        }
    }

    .chat-sidebar { max-height: 96px; }
    .chat-sidebar .sidebar-header { min-height: 42px; padding: 0.35rem 0.6rem; }
    .chat-sidebar .sidebar-create-btn { width: 28px; height: 28px; font-size: 0.8rem; }
    .chat-sidebar .room-list { height: 48px; }

    .chat-message .message-avatar { width: 24px; height: 24px; font-size: 0.6rem; }

    .chat-input-area { padding: 0.3rem 0.5rem; gap: 0.3rem; }
    .chat-input-area .input-wrapper input { padding: 0.3rem 0.6rem 0.3rem 2rem; font-size: 0.8rem; }
    .chat-input-area .input-wrapper .input-icon { font-size: 0.7rem; left: 0.5rem; }
    .chat-input-area .btn-send { width: 36px; height: 36px; font-size: 0.8rem; }

    .chat-messages { padding: 0.5rem; }

    .chat-main .chat-header { padding: 0.4rem 0.6rem; min-height: 44px; }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .chat-message,
    .modal-custom,
    .chat-toast {
        animation: none !important;
    }
    .chat-hero .online-count .dot {
        animation: none;
    }
}

/* End of file: app/static/css/chat.css */
/* Signed: admin@thepandadev.com */