/* CSS resets and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Strict Scrollbar Hiding for all scrollable wrappers */
.chat-list,
.chat-content,
.settings-content,
.profile-content,
.app-container,
html,
body,
* {
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
}

.chat-list::-webkit-scrollbar,
.chat-content::-webkit-scrollbar,
.settings-content::-webkit-scrollbar,
.profile-content::-webkit-scrollbar,
.app-container::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

html {
    height: 100%;
    height: -webkit-fill-available;
    width: 100vw;
    overscroll-behavior-y: none;
}

body {
    background-color: #0b0c0e;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    overflow: hidden;
    width: 100vw;
    overscroll-behavior-y: none;
}

/* App container centered on desktop, full screen on mobile */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    max-height: 960px;
    background: linear-gradient(110deg, #000000 0%, #060708 35%, #464a4f 100%);
    display: flex;
    flex-direction: column;
    padding: clamp(20px, 4dvh, 40px) 20px calc(clamp(28px, 6dvh, 52px) + env(safe-area-inset-bottom, 0px)) 20px;
    position: relative;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

@media (max-width: 480px) {
    body {
        background-color: #000000;
    }

    .app-container {
        max-width: 100%;
        height: 100vh;
        height: -webkit-fill-available;
        height: 100dvh;
        max-height: 100vh;
        max-height: -webkit-fill-available;
        max-height: 100dvh;
        border: none;
        box-shadow: none;
        padding: clamp(16px, 3dvh, 32px) 16px calc(clamp(24px, 5dvh, 44px) + env(safe-area-inset-bottom, 0px)) 16px;
    }
}

/* Header Layout */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: clamp(16px, 4dvh, 36px);
    flex-shrink: 0;
}

.logo-text {
    font-size: 25px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Circular Search Button */
.btn-search {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.btn-search:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

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

/* Pill profile button */
.btn-profile-pill {
    height: 44px;
    padding: 3px 18px 3px 3px;
    border-radius: 22px;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-profile-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.03);
}

.btn-profile-pill:active {
    transform: scale(0.97);
}

.pill-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.pill-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: transform 0.2s ease;
}

.btn-profile-pill:hover .pill-arrow {
    transform: translateX(3px);
}

/* Chat List */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
}


.chat-item {
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    padding: 8px 12px;
    margin: 0 -8px;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.01) translateX(2px);
}

.chat-item:active {
    transform: scale(0.98) translateX(0);
}

.avatar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* Green status/outline border for HOA NHAT ANH avatar */
.chat-item.has-status-border .chat-avatar {
    border: 2px solid #005039;
    /* Deep teal/green border exactly like screenshot */
    padding: 1.5px;
    background-color: transparent;
}

.chat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    min-width: 0;
}

.chat-name {
    font-size: 19px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-last-msg {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Chat View Integration Styles --- */
.main-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-container.chat-active .main-view,
.app-container.settings-active .main-view,
.app-container.profile-active .main-view {
    transform: translateX(-12%) scale(0.97);
    opacity: 0;
    pointer-events: none;
}

.app-container.profile-active .settings-view {
    transform: translateX(-12%) scale(0.97);
    opacity: 0;
    pointer-events: none;
}

.chat-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(110deg, #000000 0%, #060708 35%, #464a4f 100%);
    display: flex;
    flex-direction: column;
    padding: clamp(20px, 4dvh, 40px) 20px calc(clamp(14px, 3dvh, 26px) + env(safe-area-inset-bottom, 0px)) 20px;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    visibility: hidden;
}

.chat-view.active {
    transform: translateX(0);
    visibility: visible;
}

@media (max-width: 480px) {
    .chat-view {
        padding: clamp(16px, 3dvh, 32px) 16px calc(clamp(10px, 2dvh, 20px) + env(safe-area-inset-bottom, 0px)) 16px;
    }
}

/* Chat view Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: clamp(16px, 4dvh, 32px);
    flex-shrink: 0;
}

/* Circular Back Button */
.btn-back {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

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

/* Custom profile pill in Chat View */
.chat-view .btn-profile-pill {
    height: 52px;
    padding: 4px 16px 4px 4px;
    border-radius: 26px;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-view .btn-profile-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.03);
}

.chat-view .btn-profile-pill:active {
    transform: scale(0.97);
}

.chat-view .pill-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-view .pill-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.2px;
}

/* Circular background for arrow inside pill */
.pill-arrow-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.2s ease;
}

.chat-view .btn-profile-pill:hover .pill-arrow-circle {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.05);
}

/* Chat Content area */
.chat-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 22px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    margin-bottom: 30px;
    padding-right: 4px;
}


/* Chat Bubbles */
.chat-bubble-placeholder {
    min-height: 52px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
    flex-shrink: 0;
    animation: bubbleAppear 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

.chat-bubble-placeholder:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Left-aligned bubble (Incoming) */
.bubble-left {
    max-width: 80%;
    width: fit-content;
    margin-right: auto;
    transform-origin: left bottom;
}

/* Right-aligned bubble (Outgoing) */
.bubble-right {
    max-width: 80%;
    width: fit-content;
    margin-left: auto;
    transform-origin: right bottom;
    background: rgba(255, 255, 255, 0.25);
}

@keyframes bubbleAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(15px);
    }

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

/* Bottom Input Bar */
.bottom-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    position: relative;
    z-index: 999;
}

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

.message-input {
    width: 100%;
    height: 44px;
    max-height: 120px;
    border-radius: 22px;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: transparent;
    padding: 11px 46px;
    color: #ffffff;
    font-family: inherit;
    font-size: 16px;
    line-height: 20px;
    outline: none;
    resize: none;
    overflow-y: auto;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.input-action-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 2;
}

.input-action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.input-action-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.btn-emoji {
    left: 6px;
}

.btn-attachment {
    right: 6px;
}

.message-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.message-input:focus {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.02);
}

/* Plus Action Button */
.btn-plus {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-plus:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

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

/* --- Settings & Profile View Styles --- */

/* Settings button in header */
.btn-settings {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.2px solid rgba(255, 255, 255, 0.38);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #ffffff;
}

.btn-settings:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05) rotate(30deg);
}

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

/* View Titles */
.view-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

/* Settings Content Layout */
.settings-content, .profile-content {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3dvh, 28px);
    padding-right: 4px;
    margin-bottom: 20px;
}

/* Profile Card in Settings */
.settings-profile-card {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 16px;
}

.settings-profile-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.settings-profile-card:active {
    transform: translateY(0);
}

.profile-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.profile-card-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-card-name {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
}

.profile-card-username {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.profile-card-arrow {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
}

.settings-profile-card:hover .profile-card-arrow {
    color: #ffffff;
    transform: translateX(4px);
}

/* Settings Sections */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    padding-left: 8px;
}

/* Settings Items */
.settings-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    gap: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.settings-item:active {
    transform: scale(0.99) translateY(0);
}

.settings-item-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-item-label {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-item-label > span:first-child {
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
}

.settings-item-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.settings-item-value {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.select-item {
    cursor: pointer;
}

.select-item:active {
    transform: scale(0.99);
}

.action-item {
    cursor: pointer;
}

.action-item:hover {
    background: rgba(255, 59, 48, 0.04);
    border-color: rgba(255, 59, 48, 0.15);
}

.action-item:active {
    transform: scale(0.99);
}

.danger-icon {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.1) !important;
}

.danger-text {
    color: #ff3b30 !important;
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #005039; /* matches native theme */
    border-color: rgba(0, 80, 57, 0.2);
}

input:focus + .slider {
    box-shadow: 0 0 1px #005039;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Theme Dot Selector */
.theme-options {
    display: flex;
    gap: 8px;
}

.theme-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.theme-dot:hover {
    transform: scale(1.15);
}

.theme-dot.active {
    border-color: #ffffff;
    transform: scale(1.1);
}

.theme-dark { background: #0b0c0e; }
.theme-light { background: #f3f4f6; border: 1px solid rgba(0,0,0,0.1); }
.theme-neon { background: linear-gradient(135deg, #a855f7, #3b82f6); }

/* --- Profile View UI CSS --- */
.profile-avatar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin: 10px 0 20px 0;
}

.avatar-edit-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 50%;
}

.profile-display-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.15);
    transition: border-color 0.25s ease;
}

.avatar-edit-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #005039; /* matches native theme */
    border: 2.5px solid #060708;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-edit-badge:hover {
    transform: scale(1.1);
    background: #006648;
}

.profile-status-badge {
    position: absolute;
    bottom: 8px;
    left: calc(50% - 48px);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid #060708;
    background: #10b981; /* Default online green */
    transition: background-color 0.3s ease;
}

/* Forms styling */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    padding-left: 4px;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.01);
}

.input-help-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    padding-left: 4px;
}

.input-prefix-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 15px;
    pointer-events: none;
}

.prefix-input {
    padding-left: 32px;
}

.form-textarea {
    resize: none;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 44px;
    cursor: pointer;
}

.form-select option {
    background-color: #0b0c0e;
    color: white;
    padding: 12px;
}

.profile-action-buttons {
    margin-top: 10px;
}

.btn-profile-save {
    width: 100%;
    height: 48px;
    border-radius: 24px;
    border: none;
    background: #ffffff;
    color: #000000;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-profile-save:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

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

.btn-profile-save.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.btn-profile-logout {
    width: 100%;
    height: 48px;
    border-radius: 24px;
    border: 1px solid rgba(255, 59, 48, 0.3);
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-profile-logout:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.15);
}

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

/* Contact actions (visible on other profiles) */
.contact-details-actions {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 10px;
}

.contact-action-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.contact-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 6px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.contact-action-btn:active {
    transform: translateY(0) scale(0.96);
}

.action-icon {
    font-size: 18px;
}

.action-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    white-space: nowrap;
}

.contact-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-info-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 12px 16px;
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.info-value {
    font-size: 14px;
    color: #ffffff;
    margin-top: 4px;
}

.contact-danger-zone {
    margin-top: 10px;
}

.danger-btn {
    width: 100%;
    height: 48px;
    border-radius: 24px;
    border: 1.2px solid rgba(255, 59, 48, 0.4);
    background: transparent;
    color: #ff3b30;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: rgba(255, 59, 48, 0.08);
    border-color: rgba(255, 59, 48, 0.8);
}

.danger-btn:active {
    transform: scale(0.99);
}

/* --- Inline Search Header Styles --- */
.header {
    position: relative;
    overflow: visible;
}

.logo-text,
.btn-settings,
.btn-profile-pill,
.btn-search {
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1), margin 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-search-container {
    position: absolute;
    left: 0;
    right: 56px;
    top: 50%;
    transform: translateY(-50%) translateX(15px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

.search-input {
    width: 100%;
    height: 44px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    padding: 0 40px 0 18px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.25s ease;
}

.search-input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
}

.btn-clear-search {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 14px;
    display: none;
    transition: color 0.2s ease;
}

.btn-clear-search:hover {
    color: #ffffff;
}

/* Header searching active state styling */
.header.searching .logo-text {
    opacity: 0;
    transform: translateX(-15px) scale(0.95);
    pointer-events: none;
}

.header.searching .btn-settings,
.header.searching .btn-profile-pill {
    width: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
    border-width: 0;
    pointer-events: none;
}

.header.searching .header-search-container {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

/* --- Theme Modifications on .app-container --- */

/* Theme Light */
.app-container.theme-light {
    background: linear-gradient(110deg, #f3f4f6 0%, #e5e7eb 50%, #d1d5db 100%);
    color: #1f2937;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.app-container.theme-light .logo-text,
.app-container.theme-light .chat-name,
.app-container.theme-light .view-title,
.app-container.theme-light .profile-card-name,
.app-container.theme-light .settings-item-label > span:first-child,
.app-container.theme-light .info-value,
.app-container.theme-light .form-input,
.app-container.theme-light .form-select,
.app-container.theme-light .form-textarea,
.app-container.theme-light .chat-view .pill-name {
    color: #1f2937;
}

.app-container.theme-light .chat-last-msg,
.app-container.theme-light .settings-item-desc,
.app-container.theme-light .settings-item-value,
.app-container.theme-light .profile-card-username,
.app-container.theme-light .form-label,
.app-container.theme-light .input-prefix,
.app-container.theme-light .input-help-text,
.app-container.theme-light .action-label,
.app-container.theme-light .info-label {
    color: #6b7280;
}

.app-container.theme-light .section-title {
    color: #4b5563;
}

.app-container.theme-light .btn-search,
.app-container.theme-light .btn-settings,
.app-container.theme-light .btn-profile-pill,
.app-container.theme-light .btn-back,
.app-container.theme-light .btn-plus,
.app-container.theme-light .chat-view .btn-profile-pill {
    border-color: rgba(31, 41, 55, 0.25);
}

.app-container.theme-light .btn-search svg path,
.app-container.theme-light .btn-settings svg path,
.app-container.theme-light .btn-profile-pill svg path,
.app-container.theme-light .btn-back svg path,
.app-container.theme-light .btn-plus svg path {
    stroke: #1f2937;
}

.app-container.theme-light .btn-search:hover,
.app-container.theme-light .btn-settings:hover,
.app-container.theme-light .btn-profile-pill:hover,
.app-container.theme-light .btn-back:hover,
.app-container.theme-light .btn-plus:hover {
    background: rgba(31, 41, 55, 0.06);
}

.app-container.theme-light .settings-profile-card,
.app-container.theme-light .settings-item,
.app-container.theme-light .contact-action-btn,
.app-container.theme-light .contact-info-item,
.app-container.theme-light .chat-bubble-placeholder {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

.app-container.theme-light .settings-profile-card:hover,
.app-container.theme-light .settings-item:hover,
.app-container.theme-light .contact-action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}

.app-container.theme-light .chat-bubble-placeholder {
    color: #1f2937;
}

.app-container.theme-light .bubble-left {
    background: rgba(0, 0, 0, 0.05);
}

.app-container.theme-light .bubble-right {
    background: rgba(0, 0, 0, 0.1);
}

.app-container.theme-light .form-input,
.app-container.theme-light .form-select,
.app-container.theme-light .form-textarea {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.15);
}

.app-container.theme-light .form-input:focus,
.app-container.theme-light .form-select:focus,
.app-container.theme-light .form-textarea:focus {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.3);
}

.app-container.theme-light .btn-profile-save {
    background: #1f2937;
    color: #ffffff;
}

.app-container.theme-light .btn-profile-save:hover {
    background: #374151;
}

.app-container.theme-light .search-input {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.04);
    color: #1f2937;
}

.app-container.theme-light .search-input:focus {
    border-color: rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.08);
}

.app-container.theme-light .pill-arrow-circle {
    background: rgba(0, 0, 0, 0.08);
}

.app-container.theme-light .chat-view .btn-profile-pill:hover .pill-arrow-circle {
    background: rgba(0, 0, 0, 0.15);
}

.app-container.theme-light .message-input {
    border-color: rgba(0, 0, 0, 0.25);
    color: #1f2937;
}

.app-container.theme-light .message-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.app-container.theme-light .message-input:focus {
    border-color: rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.01);
}

.app-container.theme-light .input-action-btn {
    color: rgba(0, 0, 0, 0.5);
}

.app-container.theme-light .input-action-btn:hover {
    color: #000000;
    background: rgba(0, 0, 0, 0.06);
}


/* Theme Neon Glass */
.app-container.theme-neon {
    background: linear-gradient(135deg, #1e1b4b 0%, #311042 50%, #030712 100%);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.app-container.theme-neon .chat-view {
    background: linear-gradient(135deg, #1e1b4b 0%, #311042 50%, #030712 100%);
}

.app-container.theme-neon .settings-profile-card,
.app-container.theme-neon .settings-item,
.app-container.theme-neon .contact-action-btn,
.app-container.theme-neon .contact-info-item,
.app-container.theme-neon .chat-bubble-placeholder {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.15);
    backdrop-filter: blur(12px);
}

.app-container.theme-neon .settings-profile-card:hover,
.app-container.theme-neon .settings-item:hover,
.app-container.theme-neon .contact-action-btn:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

.app-container.theme-neon .btn-profile-save {
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    color: #ffffff;
}

.app-container.theme-neon .btn-profile-save:hover {
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
}

.app-container.theme-neon .avatar-edit-badge {
    background: linear-gradient(135deg, #a855f7, #3b82f6);
}

.app-container.theme-neon .chat-item.has-status-border .chat-avatar {
    border-color: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}


/* --- Custom Wallpapers --- */
.app-container.wp-neon #chat-messages-container {
    background: radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.15) 0%, transparent 80%);
}

.app-container.wp-classic #chat-messages-container {
    background: #000000;
}

.app-container.wp-emerald #chat-messages-container {
    background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.12) 0%, transparent 80%);
}

/* Keyboard open dynamic layout overrides */
.app-container.keyboard-open .chat-header {
    margin-bottom: clamp(6px, 2dvh, 12px);
}

.app-container.keyboard-open .chat-content {
    margin-bottom: clamp(10px, 2.5dvh, 16px);
    gap: clamp(8px, 2dvh, 14px);
}

.app-container.keyboard-open .header {
    margin-bottom: clamp(6px, 2dvh, 12px);
}

