* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0a1014;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

a:link {
    text-decoration: none !important;
}

.mobile-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #0b141a;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Desktop: Center and limit width */
@media (min-width: 768px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
    }

    .mobile-container {
        width: 100%;
        max-width: 480px;
        height: 100vh;
        max-height: 850px;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* ===== CHAT LIST SCREEN ===== */

.chat-list-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0b141a;
    padding-bottom: 62px;
    /* Space for bottom nav */
}

/* Fixed Header */
.chat-list-header {
    background: #0c141b;
    color: #e9edef;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-list-header h1 {
    font-size: 21px;
    font-weight: 600;
}

.header-icons {
    display: flex;
    gap: 8px;
}

/* CHANGE 3: Search Bar - Fixed, Improved Styling */
.search-bar {
    background: #23282C;
    padding: 8px 16px 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 60px;
    z-index: 10;
    border-radius: 50px;
    width: 95%;
    margin: 0 auto 15px auto;
}

.search-icon {
    flex-shrink: 0;
    color: #8696a0;
    opacity: 0.8;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #e9edef;
    font-size: 15px;
    padding: 0;
}

.search-input::placeholder {
    color: #8696a0;
    /* Gray placeholder text */
    opacity: 0.9;
}

/* CHANGE 1: ARCHIVED SECTION REMOVED - All styles deleted */

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar but keep functionality */
.chat-list::-webkit-scrollbar {
    display: none;
}

.chat-list {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-item {
    display: flex;
    padding: 12px 16px;
    background: #0b141a;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #1a2930;
}

.chat-item:hover {
    background: #202c33;
}

.chat-item:active {
    background: #2a3942;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.chat-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

/* Pin Icon Support */
.chat-name-with-pin {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.pin-icon {
    flex-shrink: 0;
    color: #8696a0;
}

.chat-name {
    font-size: 16px;
    font-weight: 500;
    color: #e9edef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 12px;
    color: #8696a0;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Green time when unread badge is present */
.chat-time.has-unread {
    color: #25d366;
}

.chat-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-last-message {
    font-size: 14px;
    color: #8696a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

/* Icons & Badge Container */
.chat-icons-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Mute Icon BEFORE badge */
.mute-icon-badge {
    flex-shrink: 0;
    color: #8696a0;
}

.message-check-small {
    width: 16px;
    height: 15px;
    flex-shrink: 0;
}

.sender-name {
    color: #8696a0;
    margin-right: 4px;
}

.unread-badge {
    background: #25d366;
    color: #000;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 78px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 30%;
    background: #00a884;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: all 0.3s;
}

.fab:hover {
    background: #06cf9c;
    transform: scale(1.05);
}

.fab:active {
    transform: scale(0.95);
}

.fab svg {
    color: #fff;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0c141b;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 62px;
    z-index: 100;
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0 0 8px 8px;
    }

    .fab {
        right: calc(50% - 220px);
    }
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.nav-item.active {
    background: rgba(58, 192, 98, 0.1);
    border-radius: 50px;
}

.nav-icon {
    color: #8696a0;
    margin-bottom: 2px;
}

.nav-item.active .nav-icon {
    color: #e9edef;
}

.nav-label {
    font-size: 12px;
    color: white;
}

.nav-item.active .nav-label {
    color: white;
}

/* Nav Badge for Chats */
.nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 22px);
    background: #25d366;
    color: #000;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Nav Dot for Updates */
.nav-dot {
    position: absolute;
    top: 6px;
    right: calc(50% - 16px);
    width: 8px;
    height: 8px;
    background: #25d366;
    border-radius: 50%;
}

/* Custom Popup Modal */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.popup-overlay.active {
    display: flex;
}

.popup-modal {
    background: #202c33;
    border-radius: 12px;
    padding: 24px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

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

.popup-icon {
    text-align: center;
    margin-bottom: 16px;
    color: #8696a0;
}

.popup-message {
    text-align: center;
    color: #e9edef;
    font-size: 16px;
    margin-bottom: 24px;
    line-height: 1.4;
}

.popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.popup-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-btn-cancel {
    background: #2a3942;
    color: #e9edef;
}

.popup-btn-cancel:hover {
    background: #344047;
}

.popup-btn-ok {
    background: #00a884;
    color: #fff;
}

.popup-btn-ok:hover {
    background: #06cf9c;
}

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

/* ===== CHAT SCREEN ===== */

.chat-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Chat Header with Video & Call icons */
.chat-header {
    background: #202c33;
    color: #e9edef;
    padding: 10px 8px 10px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    flex-shrink: 0;
}

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

.back-btn {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 8px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.profile-clickable {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    margin: -4px 0;
    border-radius: 8px;
    transition: background 0.2s;
}

.profile-clickable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.profile-clickable:active {
    background: rgba(255, 255, 255, 0.1);
}

.profile-pic {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
}

.header-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 500;
    color: #e9edef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 13px;
    color: #8696a0;
}

.header-right {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

.icon-btn {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

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

/* Menu Dropdown */
.menu-dropdown {
    position: absolute;
    top: 60px;
    right: 8px;
    background: #233138;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: none;
    min-width: 200px;
    overflow: hidden;
}

.menu-dropdown.active {
    display: block;
}

.menu-item {
    padding: 14px 20px;
    color: #e9edef;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #2a3942;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #2a3942;
}

.menu-item:active {
    background: #344047;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    position: relative;
    background-image: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEf5ztX9se-vCDB-V6TBc61zqGKS8ppIBW_I1XCde-scE2So4wmTCS-7ewJnsSKmeJdjH_-NVVvn1cg9vbEEARkIX9VWCc2qUnaTijX4HQE9BvDP2z7TASMqXps8QRXSkjSs83YvPSvVupv8odsByjVE9M2WkAao0ByhjUaXCZGM6GiuzWg7RyKeoagxht/s16000/chat-bg.png');
    background-size: auto;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Hide scrollbar */
.chat-messages::-webkit-scrollbar {
    display: none;
}

.chat-messages {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.date-divider {
    text-align: center;
    margin: 20px 0;
}

.date-divider span {
    background: #202c33;
    color: #8696a0;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
}

.message {
    display: flex;
    margin-bottom: 8px;
    animation: messageSlide 0.3s ease-out;
}

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

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

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.user .message-bubble {
    background: #005c4b;
    color: #e9edef;
    border-radius: 7.5px 7.5px 0 7.5px;
}

.message.bot .message-bubble {
    background: #202c33;
    color: #e9edef;
    border-radius: 7.5px 7.5px 7.5px 0;
}

/* Message text and time on same line */
.message-content-wrapper {
    display: inline;
}

.message-text {
    font-size: 14.2px;
    line-height: 19px;
    display: inline;
    white-space: pre-wrap;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    vertical-align: bottom;
    float: right;
    margin-top: 4px;
}

.message.user .message-time {
    color: #99d6c9;
}

.message-time svg {
    width: 16px;
    height: 16px;
}

/* Tick color variations */
.message-time svg.grey-tick {
    color: #8696a0;
}

.message-time svg.blue-tick,
.blue-tick {
    color: #53bdeb;
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 16px 8px 16px;
    display: flex;
    justify-content: flex-start;
    animation: messageSlide 0.3s ease-out;
}

.typing-bubble {
    background: #202c33;
    color: #e9edef;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px 7.5px 7.5px 0;
    max-width: 75%;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-text {
    font-style: italic;
    color: #8696a0;
    font-size: 14.2px;
    line-height: 19px;
}

.typing-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
}

.typing-dots .dot {
    color: #8696a0;
    font-size: 16px;
    animation: dotFade 1.5s infinite;
    font-weight: bold;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes dotFade {

    0%,
    60%,
    100% {
        opacity: 0.2;
    }

    30% {
        opacity: 1;
    }
}

/* Scroll to Bottom Button */
.scroll-to-bottom {
    position: absolute;
    bottom: 80px;
    right: 16px;
    width: 42px;
    height: 42px;
    background: #202c33;
    border: none;
    border-radius: 50%;
    color: #8696a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    z-index: 10;
}

.scroll-to-bottom:hover {
    background: #2a3942;
    transform: scale(1.05);
}

.scroll-to-bottom:active {
    transform: scale(0.95);
}

/* Chat Input Area */
.chat-input {
    background: #202c33;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.emoji-btn,
.attach-btn {
    flex-shrink: 0;
}

.input-wrapper {
    flex: 1;
    background: #2a3942;
    border-radius: 20px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    min-width: 0;
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #e9edef;
    font-size: 15px;
    padding: 9px 0;
    min-width: 0;
}

#messageInput::placeholder {
    color: #8696a0;
}

.send-btn {
    background: #00a884;
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #06cf9c;
}

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

/* Mobile optimization */
@media (max-width: 380px) {
    .chat-input {
        gap: 6px;
    }

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

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

/* ===== PROFILE MODAL ===== */

.profile-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0b141a;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.profile-modal.active {
    display: flex;
}

.profile-header {
    background: #202c33;
    color: #e9edef;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 60px;
    font-size: 19px;
    font-weight: 500;
    flex-shrink: 0;
}

.profile-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.profile-content::-webkit-scrollbar {
    display: none;
}

.profile-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.profile-image-large {
    background: #202c33;
    padding: 30px;
    text-align: center;
}

.profile-image-large img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid #00a884;
}

.profile-details {
    background: #202c33;
    padding: 20px;
    margin-top: 10px;
    text-align: center;
}

.profile-details h2 {
    color: #e9edef;
    font-size: 24px;
    margin-bottom: 8px;
}

.profile-status {
    color: #8696a0;
    font-size: 14px;
}

.profile-info {
    margin-top: 10px;
    background: #202c33;
    padding: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid #2a3942;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #8696a0;
    font-size: 14px;
}

.info-value {
    color: #e9edef;
    font-size: 14px;
}

.check-marks {
    display: inline-flex;
}

.profile-block-report {
    margin-top: 10px;
    background: #202c33;
    padding: 20px;
    border-top: 1px solid #2a3942;
}

.block-report-btn {
    padding: 12px 0;
    color: #e74c3c;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    justify-content: left;
    cursor: pointer;
}

.profile-block-report-badge {
    flex-shrink: 0;
    color: #e74c3c;
    margin: 2px 5px 0 0;
}

/* ===== FIREBASE LOGIN POPUP STYLES ===== */

/* Blur effect for background */
.mobile-container.blurred>*:not(.login-overlay) {
    filter: blur(8px);
    pointer-events: none;
}

/* Login overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.login-overlay.active {
    display: flex;
}

/* Login modal */
.login-modal {
    background: #202c33;
    border-radius: 16px;
    padding: 32px 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: loginSlideIn 0.4s ease-out;
}

@keyframes loginSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

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

/* Login header */
.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header svg {
    margin-bottom: 16px;
}

.login-header h2 {
    color: #e9edef;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: #8696a0;
    font-size: 14px;
}

/* Login form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.input-group label {
    color: #8696a0;
    font-size: 13px;
    font-weight: 500;
    margin-left: 4px;
}

.input-group input {
    background: #2a3942;
    border: 2px solid transparent;
    border-radius: 8px;
    color: #e9edef;
    font-size: 15px;
    padding: 12px 16px;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: #00a884;
    background: #344047;
}

.input-group input::placeholder {
    color: #667781;
}

/* Login error message */
.login-error {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid #e74c3c;
    border-radius: 8px;
    color: #ff6b6b;
    font-size: 13px;
    padding: 12px 16px;
    display: none;
    animation: errorShake 0.4s ease-out;
}

@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Login loading state */
.login-loading {
    background: rgba(0, 168, 132, 0.1);
    border: 1px solid #00a884;
    border-radius: 8px;
    color: #00a884;
    font-size: 14px;
    padding: 12px 16px;
    display: none;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

/* Loading spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 168, 132, 0.2);
    border-top-color: #00a884;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Login button */
.login-btn {
    background: #00a884;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 24px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}

.login-btn:hover {
    background: #06cf9c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 168, 132, 0.3);
}

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

.login-btn:disabled {
    background: #2a3942;
    color: #667781;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile optimization for login */
@media (max-width: 480px) {
    .login-modal {
        padding: 28px 20px;
        max-width: 90%;
    }

    .login-header h2 {
        font-size: 22px;
    }

    .input-group input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

/* Desktop centering for login */
@media (min-width: 768px) {
    .login-overlay {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}