:root {
    --bg: #efeae2;
    --panel: #ffffff;
    --panel-soft: #f0f2f5;
    --text: #111b21;
    --muted: #667781;
    --brand: #00a884;
    --header-bg: #075e54;
    --brand-dark: #008069;
    --border: #d1d7db;
    --shadow: 0 2px 5px rgba(11, 20, 26, .08);
    --wa-sent: #dcf8c6;
    --wa-received: #ffffff;
}

/* Dark Theme */
body.dark-theme {
    --bg: #111b21;
    --panel: #1f2c34;
    --panel-soft: #18252d;
    --text: #e9edef;
    --muted: #8696a0;
    --brand: #00a884;
    --header-bg: #075e54;
    --brand-dark: #008069;
    --border: #2a3942;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    --wa-sent: #005c4b;
    --wa-received: #202c33;
}

/* OLED Theme (True Black) */
body.oled-theme {
    --bg: #000000;
    --panel: #0a0a0a;
    --panel-soft: #f0f2f5;
    --text: #111b21;
    --muted: #667781;
    --brand: #00a884;
    --header-bg: #075e54;
    --brand-dark: #008069;
    --border: #d1d7db;
    --shadow: 0 2px 5px rgba(11, 20, 26, .08);
    --wa-sent: #dcf8c6;
    --wa-received: #ffffff;
}

body.oled-theme {
    --bg: #000000;
    --panel: #0a0a0a;
    --panel-soft: #121212;
    --text: #e9edef;
    --muted: #8696a0;
    --brand: #00a884;
    --header-bg: #000000;
    /* True black header */
    --brand-dark: #008069;
    --border: #2a3942;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    --wa-sent: #004d3f;
    /* Slightly darker green for OLED */
    --wa-received: #1a1a1a;
    /* Very dark gray for received */
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100svh;
    height: 100dvh;
    /* Dynamic viewport height for mobile browsers */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior-y: none;
    font-family: 'Inter', system-ui, sans-serif;
    background: linear-gradient(180deg, #e4ebe4 0%, #f4f8f4 100%);
    color: var(--text);
}

img,
video,
canvas,
svg,
iframe {
    max-width: 100%;
}

/* Professional Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

#main-app-content {
    display: flex !important;
    /* Forces flex layout to prevent blank page collapse */
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    /* Ensure it takes full width */
    overflow: hidden;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    /* Consistent padding */
    background: var(--header-bg);
    /* Use variable for header background */
    flex-shrink: 0;
    /* Prevent header from shrinking */
    color: white;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.app-logo {
    content: url('hotma logo.png');
    height: 50px;
    width: 50px;
    object-fit: cover;
    border-radius: 50%;
}

.header-brand .logo {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.header-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: #eee;
}

.navbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.72rem;
    font-weight: 500;
    gap: 3px;
    min-width: 62px;
    text-align: center;
}

.nav-item i {
    font-size: 1.25rem;
    margin-right: 0;
    color: rgba(255, 255, 255, 0.9);
    transition: transform 0.2s ease;
}

.nav-item span {
    line-height: 1.1;
}

.nav-item:hover i,
.nav-item.active i {
    transform: translateY(-1px);
    color: white;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.16);
    color: white;
}

.header-ellipsis-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    /* Ensure transparent background */
    border: none;
    /* Remove border */
    cursor: pointer;
    /* Indicate clickable */
    color: inherit;
    /* Inherit color from parent (white) */
    padding: 0 !important;
}

.nav-item.logout:hover {
    background: #e74c3c;
}

.header-dropdown-menu {
    position: absolute;
    top: 75px;
    /* Position below the header */
    right: 16px;
    /* Align with the right edge of the header */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    min-width: 200px;
    padding: 8px 0;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    animation: menuAppear 0.15s cubic-bezier(0, 0, 0.2, 1);
}

.header-dropdown-menu .context-menu-item:hover {
    background: #f5f5f5;
}

.container {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 20px;
    flex: 1;
    /* Occupy all remaining vertical space */
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 16px;
    overflow: hidden;
    /* Keep internal scrolling */
    width: min(100%, 1180px);
    min-width: 0;
    min-height: 0;
}

.container > * {
    min-width: 0;
}

.chatsidebar {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e6eee6;
    min-width: 0;
    min-height: 0;
}

.add-customer-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--brand);
    padding: 5px;
    transition: transform 0.2s;
}

.add-customer-btn:hover {
    transform: scale(1.1);
}

.manage-users-list .conversation-item.is-removed {
    opacity: 0.6;
    filter: grayscale(1);
}

.request-count-badge {
    background: #ff4d4d;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

.nav-item-rel {
    position: relative;
    width: 40px;
    height: 40px;
    min-width: unset !important;
    display: grid !important;
    place-items: center;
    border-radius: 50% !important;
}

.header-request-badge {
    background: #ff4d4d;
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
    position: absolute;
    top: 2px;
    right: 4px;
    border: 2px solid var(--header-bg);
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.muted-icon {
    font-size: 0.85rem;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0.6;
    color: var(--muted);
}

/* Smooth transition for sidebar and main view switching */
.chatsidebar,
.costomersidebar,
.starredsidebar,
.lockedchatssidebar,
.store-area {
    animation: viewFadeIn 0.3s ease-out;
}

@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

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

.costomersidebar {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e6eee6;
    display: none;
    min-width: 0;
    min-height: 0;
}

.search-box {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8faf7;
}

.search-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #dce3db;
    padding: 12px 16px;
    outline: none;
    font-size: 0.95rem;
    color: var(--text);
    background: white;
}

.conversations-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    /* Allow the list of chats to scroll */
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.conversation-item:hover,
.conversation-item.active {
    background: #eff6ed;
}

.conversation-avatar,
.chat-avatar,
.message-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: white;
    font-weight: 700;
    position: relative;
    /* overflow: hidden removed to allow verified badge visibility */
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #25d366;
    border: 2px solid white;
    border-radius: 50%;
    display: none;
}

.conversation-item.online .online-dot {
    display: block;
}

/* Hotma Order Notification Badge */
.order-notif-badge {
    display: flex;
    position: absolute;
    top: -4px;
    left: -4px;
    background: #ff9800;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border: 1.5px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 5;
    font-size: 0.65rem;
    cursor: default;
    transition: transform 0.2s ease-in-out;
}

@keyframes orderPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.7);
    }
    70% {
        transform: scale(1.15);
        box-shadow: 0 0 0 6px rgba(255, 87, 34, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0);
    }
}

.order-notif-badge.pulse {
    animation: orderPulse 1.5s infinite;
}

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

.conversation-time {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}

.conversation-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    flex: 1;
}

.conversation-name {
    font-weight: 700;
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 0.9rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-online {
    color: var(--brand);
    font-weight: 700;
}

.status-typing {
    color: var(--brand);
    font-weight: 600;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 2px;
}

.unread-badge {
    background: var(--brand);
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    padding: 0 4px;
    font-size: 0.75rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.chat-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow);
    border: 1px solid #e5eee6;
}

/* Selection Mode UI */
.selection-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 83px;
    background: #008069;
    color: white;
    z-index: 200;
    display: none;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

.selection-bar.active {
    display: flex;
}

.selection-actions {
    display: flex;
    gap: 15px;
    margin-left: auto;
}

.selection-bar .action-btn {
    background: transparent;
    color: white;
    box-shadow: none;
}

.selection-bar .action-btn i {
    color: white;
}

.selection-ellipsis-menu {
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.selection-count {
    font-size: 1.1rem;
    font-weight: 500;
}

.pinned-message-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel);
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    z-index: 10;
    animation: slideDown 0.2s ease;
}

.pinned-content {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.pinned-content i {
    color: var(--brand);
    font-size: 0.9rem;
}

.pinned-text-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pinned-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand);
    text-transform: uppercase;
}

.pinned-preview {
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unpin-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.message-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    margin: 0 10px;
    display: none;
    flex-shrink: 0;
    cursor: pointer;
}

.chat-area.select-mode .message-checkbox {
    display: block;
}

.message-group.selected .message-checkbox {
    background: var(--brand);
    border-color: var(--brand);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center;
}

.forward-user-list .conversation-item {
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
}

.forward-user-list .conversation-item.selected {
    background: rgba(0, 168, 132, 0.08);
}

.forward-user-list .conversation-item.selected::after {
    content: "\f058";
    /* Font Awesome Circle Check icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--brand);
    margin-left: auto;
}

.forward-section-header {
    padding: 12px 16px 6px 16px;
    background: #f8faf7;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--brand-dark);
    font-weight: 800;
    letter-spacing: 0.6px;
}

.chat-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--border);
    min-height: 59px;
}

.quick-share-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.quick-share-item {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

.quick-forward-btn {
    display: none;
    /* Controlled by JS select mode */
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    border: 1.5px solid white;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background 0.2s ease;
    padding: 0;
}

.quick-forward-btn:hover {
    transform: scale(1.2);
    background: var(--brand-dark);
}

.quick-share-item:hover {
    transform: scale(1.15);
}

.quick-share-list::-webkit-scrollbar {
    display: none;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
    flex: 1;
    margin-right: 12px;
}

.chat-name-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

.back-btn {
    display: none;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
    padding-right: 10px;
    color: var(--brand-dark);
    font-weight: bold;
    flex-shrink: 0;
}

.chat-name {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

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

.typing-indicator {
    font-size: 0.85rem;
    color: var(--muted);
    margin-left: 6px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background-color: var(--muted);
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.6;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.typing-text {
    margin-right: 4px;
}

.shop-container {
    display: none !important;
    flex: 1;
    flex-direction: column;
    position: absolute;
    top: 83px;
    /* Header height (18+18+46+1) */
    left: 0;
    width: 100%;
    height: calc(100% - 83px);
    z-index: 150;
    background: white;
    overflow-x: hidden;
    overflow-y: auto;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8faf7;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.shop-header-title-container {
    text-align: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    margin: 0 12px;
}

[data-ui="shop-name-display"] {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.shop-search-bar {
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.shop-search-input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    outline: none;
    font-size: 0.9rem;
}

.cart-toggle-btn {
    background: var(--brand);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.cart-count {
    background: white;
    color: var(--brand);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    padding: 0 4px;
}

.shop-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 16px;
}

.add-to-cart-btn {
    width: 100%;
    background: #FFD814;
    border: 1px solid #FCD200;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
}

.scroll-to-top-btn {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    background: var(--brand-dark);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 170;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px);
}

.chat-area.shop-mode-active .scroll-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Cart View */
.cart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 20, 26, 0.4);
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    backdrop-filter: blur(4px);
    padding-top: 60px;
    /* Prevents the handle from reaching the header area */
}

.cart-content {
    background: white;
    width: 100%;
    height: 70vh;
    /* Reduced starting height to stay clear of the header */
    max-height: 100dvh;
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out;
    position: relative;
    transition: height 0.1s ease-out;
}

.cart-drag-handle {
    width: 100%;
    height: 24px;
    cursor: ns-resize;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    touch-action: none;
    z-index: 30;
}

.cart-drag-handle::after {
    content: '';
    width: 40px;
    height: 4px;
    background: #d1d7db;
    border-radius: 2px;
    transition: background 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cart-drag-handle.resizing::after {
    background: var(--brand);
}

.cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    position: sticky;
    top: 0;
    z-index: 20;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.cart-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
}

.cart-tabs {
    display: flex;
    border-bottom: 1px solid var(--panel-soft);
    background: white;
    position: sticky;
    top: 59px;
    /* Matches cart header height */
    z-index: 19;
}

.cart-tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-tab.active {
    color: var(--brand-dark);
    border-bottom: 3px solid var(--brand-dark);
    background: rgba(0, 168, 132, 0.04);
}

.cart-items-list {
    padding: 0;
}

@keyframes cartSlideInLeft {
    from {
        transform: translateX(-15px);
        opacity: 0;
    }

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

@keyframes cartSlideInRight {
    from {
        transform: translateX(15px);
        opacity: 0;
    }

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

.animate-cart-left {
    animation: cartSlideInLeft 0.25s ease-out forwards;
}

.animate-cart-right {
    animation: cartSlideInRight 0.25s ease-out forwards;
}

.cart-item-swipe-wrapper {
    position: relative;
    background-color: #ff4d4d;
    overflow: hidden;
    border-bottom: 1px solid #f0f2f2;
}

.cart-swipe-background {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 1.2rem;
    z-index: 1;
}

.cart-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 20px;
    background: white;
    position: relative;
    z-index: 2;
    touch-action: pan-y;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cart-item.removing {
    transform: translateX(20px);
    opacity: 0;
}

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

.cart-item-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.2;
}

.cart-item-meta {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
    margin: 2px 0;
}

.cart-item-meta small {
    display: block;
    color: #565959;
}

.cart-item-price {
    font-weight: 800;
    color: var(--brand-dark);
    min-width: 65px;
    text-align: right;
    font-size: 0.95rem;
}

.remove-cart-item {
    background: none;
    border: none;
    cursor: pointer;
    color: #ff4d4d;
    font-size: 1.1rem;
}

.add-to-cart-btn.added-success {
    background: #2e7d32 !important;
    border-color: #2e7d32 !important;
    color: white !important;
}

/* Product Details Modal Specifics */
.details-card {
    max-width: 500px !important;
}

.details-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px 0;
}

.details-main-img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    background: #f8f9f9;
    border-radius: 12px;
    border: 1px solid var(--panel-soft);
}

.details-info h2 {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
    color: var(--text);
    font-weight: 800;
}

.details-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.star {
    color: #ffa41c;
    /* Gold/Orange */
    font-size: 1.1rem;
    letter-spacing: -1px;
}

.rating-count {
    font-size: 0.85rem;
    color: #007185;
    /* Link-like blue */
    margin-left: 8px;
    font-weight: 500;
}

.details-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--muted);
    margin: 15px 0;
}

.details-price-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--panel-soft);
}

.details-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--brand-dark);
}

.cart-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--panel-soft);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #fafafa;
    position: sticky;
    bottom: 0;
    z-index: 20;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.cart-total {
    grid-column: span 2;
    font-size: 1.1rem;
    font-weight: 800;
    text-align: right;
    color: var(--text);
    margin-bottom: 2px;
}

.clear-cart-btn {
    background: transparent;
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    padding: 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-cart-btn:hover {
    background: #fff5f5;
}

.checkout-btn {
    background: var(--brand);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

/* Undo Snackbar Styles */
.undo-snackbar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: snackbar-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    font-size: 0.9rem;
}

.undo-btn {
    background: none;
    border: none;
    color: var(--brand);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
}

@keyframes snackbar-in {
    from {
        bottom: -50px;
        opacity: 0;
    }

    to {
        bottom: 30px;
        opacity: 1;
    }
}

.undo-snackbar.fade-out {
    opacity: 0;
    bottom: -50px;
    transition: all 0.3s ease-in;
}

.checkout-btn.success {
    background: #2e7d32 !important;
    transition: background 0.3s ease;
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted);
}

.saved-later-section {
    padding: 10px 0;
    border-top: 8px solid #f0f2f2;
    background: white;
}

.saved-later-title {
    font-weight: 700;
    padding: 0 20px;
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-saved-btn,
.move-all-to-cart-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* Business Registration Wizard Styles */
.wizard-progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--panel-soft);
    border-radius: 3px;
    margin-bottom: 25px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.wizard-progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--brand);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-progress-bar-fill.warning {
    background: #ffc107;
    /* Warning Yellow */
}

.wizard-progress {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 15px;
}

.progress-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--panel-soft);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.progress-step.active {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
    transform: scale(1.1);
}

.progress-step.completed {
    background: var(--brand-dark);
    color: white;
    border-color: var(--brand-dark);
}

.wizard-step {
    display: none;
    /* Hidden by default */
    animation: fadeIn 0.3s ease-out;
}

.wizard-step.active {
    display: block;
}

.wizard-step h4 {
    font-size: 1.2rem;
    color: var(--text);
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.wizard-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

.wizard-navigation .auth-submit-btn {
    flex: 1;
    padding: 4px 8px;
}

.move-all-to-cart-btn {
    color: var(--brand-dark);
}

/* Animation for items moving between lists */
.flying-item {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    transition: all 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.saved-count-badge {
    background: #e7e9ec;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
    vertical-align: middle;
}

.saved-items-list .cart-item {
    border-bottom: 1px solid #f0f0f0;
}

.saved-items-list .cart-item:last-child {
    border-bottom: none;
}

.cart-item-qty-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f0f2f2;
    border-radius: 8px;
    padding: 2px;
    border: 1px solid #d5d9d9;
}

.cart-qty-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    color: var(--muted);
}

.cart-qty-btn:hover {
    color: var(--brand-dark);
}

.cart-qty-value {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-area.shop-mode-active .shop-container {
    display: flex !important;
}

.chat-area.shop-mode-active .messages-container,
.chat-area.shop-mode-active .message-input-area,
.chat-area.shop-mode-active .chat-actions,
.chat-area.shop-mode-active .floating-shop-btn {
    display: none !important;
}

.shop-close-btn {
    background: transparent;
    border: none;
    color: var(--brand-dark);
    font-weight: bold;
    padding: 15px;
    cursor: pointer;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.action-btn,
.input-btn,
.record-btn,
.send-btn {
    border: none;
    background: #ffffff;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.skip-to-review-btn {
    background: var(--panel-soft) !important;
    color: var(--brand-dark) !important;
    border: 1px solid var(--border) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
}

.action-btn i {
    color: var(--brand-dark);
}

.action-btn:hover,
.input-btn:hover,
.record-btn:hover,
.send-btn:hover {
    transform: translateY(-1px);
    background: #f1f6f1;
}

.messages-container {
    position: relative;
    flex: 1;
    padding: 12px 7% 20px;
    background: var(--chat-bg, var(--bg));
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    z-index: 1;
}

.messages-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--chat-custom-bg, url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded51.png'));
    background-size: var(--chat-custom-bg-size, auto);
    background-repeat: var(--chat-custom-bg-repeat, repeat);
    background-position: center;
    background-attachment: fixed;
    opacity: var(--chat-pattern-opacity, 0.4);
    filter: blur(var(--chat-bg-blur, 0px));
    transform: scale(1.1);
    /* Prevents edge bleeding when blur is applied */
    z-index: -1;
    pointer-events: none;
}

/* Date Separator */
.date-separator {
    align-self: center;
    background: #ffffff;
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 0.78rem;
    color: #54656f;
    margin: 12px 0;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}

/* Unread Divider */
.unread-divider {
    width: 100%;
    text-align: center;
    margin: 20px 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unread-divider span {
    background: #ffffff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--brand-dark);
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.unread-divider::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 168, 132, 0.2);
}

.message-group {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    margin-bottom: 2px;
    position: relative;
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    touch-action: pan-y;
}

.message-group::before {
    content: "\f3e5";
    /* Font Awesome Reply Icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: -35px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    color: var(--brand);
    transition: transform 0.2s ease;
}

.message-group.ready-to-reply::before {
    transform: translateY(-50%) scale(1.2);
}

.message-group.received {
    justify-content: flex-start;
}

.message-group.sent {
    justify-content: flex-end;
}

.message-group.sent .message-avatar {
    display: none;
}

.message-bubble {
    max-width: 70%;
    padding: 3px 8px 2px;
    border-radius: 8px;
    position: relative;
    line-height: 1.25;
    font-size: 0.92rem;
    white-space: wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    display: block;
    width: fit-content;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.message-group.received .message-bubble {
    background: var(--wa-received);
    color: var(--text);
}

.message-group.sent .message-bubble {
    background: var(--wa-sent);
    color: var(--text);
}

/* Tails for the first message in a group */
.message-group.has-tail.received .message-bubble {
    border-top-left-radius: 0;
    margin-left: 8px;
}

.message-group.has-tail.sent .message-bubble {
    border-top-right-radius: 0;
    margin-right: 8px;
}

.message-group.has-tail.received .message-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -10px;
    border-style: solid;
    border-width: 10px 10px 0 0;
    border-color: var(--wa-received) transparent transparent transparent;
}

.message-group.has-tail.sent .message-bubble::after {
    content: "";
    position: absolute;
    top: 0;
    right: -10px;
    border-style: solid;
    border-width: 10px 0 0 10px;
    border-color: var(--wa-sent) transparent transparent transparent;
}

/* Hide avatar on consecutive messages to look like WA */
.message-group.consecutive .message-avatar {
    visibility: hidden;
    height: 0;
}

.message-group.has-tail {
    margin-top: 6px;
}

.message-time {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.45);
}

.message-meta {
    float: right;
    margin: 1px -2px -3px 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.starred-indicator {
    color: #8696a0;
    /* Subtle grey star */
    font-size: 0.8rem;
    display: none;
    margin-right: 2px;
}

.message-group.is-starred .starred-indicator {
    display: inline-block;
}

.message-bubble.deleted {
    background: #f0f0f0 !important;
    /* Lighter background */
    color: var(--muted);
    font-style: italic;
    font-size: 0.85rem;
    padding: 6px 10px;
    filter: opacity(0.7);
}

.message-status {
    font-size: 0.85rem;
    line-height: 1;
    color: #8696a0;
    margin-left: 1px;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.message-status.read {
    color: #34b7f1;
    /* WhatsApp Blue */
}

.message-status.read i {
    animation: checkmark-pulse 0.4s ease-out;
}

@keyframes checkmark-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.message-input-area {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: var(--panel-soft);
    border-top: 1px solid var(--border);
    min-height: 62px;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.input-pill {
    display: flex;
    align-items: flex-end;
    /* Align icons to the bottom as text grows */
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 5px 12px;
    border: 1px solid white;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.message-input {
    flex: 1;
    border: none;
    padding: 10px 8px;
    outline: none;
    font-size: 0.95rem;
    background: transparent;
    color: var(--text);
    resize: none;
    /* Disable manual resize handle */
    max-height: 175px;
    /* Limit height to approx 5 lines */
    line-height: 1.55;
    overflow-y: auto;
    font-family: inherit;
}

.input-icon-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    color: var(--muted);
    transition: color 0.2s ease;
}

.input-icon-btn:hover {
    color: var(--brand-dark);
}

.send-btn,
.record-btn {
    background: var(--brand);
    color: white;
    box-shadow: none;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #20c55d;
}

/* Jump to First Unread Button */
.jump-unread-btn {
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #ffffff;
    color: var(--brand-dark);
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 150;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.jump-unread-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.jump-unread-btn:hover {
    background: var(--panel-soft);
}

.scroll-to-bottom-btn {
    position: absolute;
    bottom: 85px;
    right: 18px;
    width: 38px;
    height: 38px;
    background: white;
    color: var(--muted);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px);
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-bottom-btn .unread-badge-mini {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--brand);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* Reply Feature Styles */
.reply-preview {
    flex: 0 0 100%;
    background: #f0f2f5;
    border-left: 4px solid var(--brand);
    padding: 8px 12px;
    margin: 0 0 4px 0;
    border-radius: 8px;
    display: none;
    justify-content: space-between;
    align-items: center;
    animation: slideUp 0.2s ease;
    cursor: pointer;
}

.reply-preview.closing {
    animation: slideDownExit 0.2s ease forwards;
}

.reply-preview-content {
    overflow: hidden;
}

.reply-preview-text {
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-reply-preview {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--muted);
}

.quoted-message {
    background: rgba(0, 0, 0, 0.04);
    border-left: 4px solid var(--brand);
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.quoted-sender {
    font-weight: 700;
    color: var(--brand-dark);
    display: block;
    margin-bottom: 2px;
}

.forwarded-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-style: italic;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Media & Document Messages */
.message-bubble.image,
.message-bubble.video {
    padding: 3.5px;
}

.message-bubble.document {
    padding: 8px;
    /* Slightly more padding for documents */
    max-width: 75%;
    /* Allow documents to be a bit wider */
}

.document-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    /* Inherit text color from message bubble */
}

.document-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--panel-soft);
    /* Light background for the icon */
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    /* Larger emoji icon */
    flex-shrink: 0;
    /* Prevent icon from shrinking */
}

.document-info {
    flex: 1;
    /* Take up remaining space */
    min-width: 0;
    /* Allow content to shrink */
}

.document-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    /* Ensure it takes full width */
}

.pdf-embed-container {
    margin-top: 10px;
    border-radius: 6px;
    overflow: hidden;
    height: 250px;
    background: #f8faf7;
    border: 1px solid var(--border);
}

.pdf-thumbnail-container {
    position: relative;
    margin-top: 10px;
    border-radius: 6px;
    overflow: hidden;
    max-height: 200px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #eee;
}

.pdf-thumbnail {
    width: 100%;
    display: block;
    object-fit: cover;
}

.pdf-thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px;
    font-size: 0.8rem;
    text-align: center;
    backdrop-filter: blur(2px);
}

.pdf-embed-container iframe {
    width: 100%;
    height: 100%;
}

.pdf-viewer-modal .pdf-viewer-content {
    width: 95%;
    height: 95%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pdf-viewer-modal iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-viewer-modal .close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    background: rgba(11, 20, 26, 0.8);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.pdf-viewer-modal .download-modal {
    position: absolute;
    top: 15px;
    right: 65px;
    /* Positioned next to the close button */
    z-index: 100;
    background: rgba(0, 168, 132, 0.9);
    /* Brand color */
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.pdf-viewer-modal .download-modal:hover {
    background: var(--brand-dark);
}

.pdf-viewer-modal .print-modal {
    position: absolute;
    top: 15px;
    right: 115px;
    /* Positioned to the left of the download button */
    z-index: 100;
    background: rgba(52, 183, 241, 0.9);
    /* Info Blue color */
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.pdf-viewer-modal .print-modal:hover {
    background: #027eb5;
}

.pdf-viewer-modal .print-modal {
    position: absolute;
    top: 15px;
    right: 115px;
    /* Positioned to the left of the download button */
    z-index: 100;
    background: rgba(52, 183, 241, 0.9);
    /* Info Blue color */
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.2s;
}

.pdf-viewer-modal .print-modal:hover {
    background: #027eb5;
}

.message-image,
.message-video {
    max-width: 330px;
    width: 100%;
    max-height: 450px;
    border-radius: 5px;
    display: block;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message-bubble.image .message-meta,
.message-bubble.video .message-meta {
    position: absolute;
    bottom: 8px;
    right: 8px;
    margin: 0;
    background: rgba(11, 20, 26, 0.45);
    padding: 2px 7px;
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.message-bubble.image .message-time,
.message-bubble.video .message-time,
.message-bubble.image .message-status,
.message-bubble.video .message-status,
.message-bubble.image .starred-indicator,
.message-bubble.video .starred-indicator,
.message-bubble.image .delete-message-btn,
.message-bubble.video .delete-message-btn {
    color: #ffffff !important;
}

.message-bubble.location {
    background: #ffffff !important;
    padding: 0 !important;
    overflow: hidden;
    max-width: 250px;
    border: 1px solid var(--border);
}

.location-preview {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.location-map-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #e5e5e5;
    display: block;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.location-info {
    padding: 8px 12px 10px;
    background: white;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.location-info strong {
    display: block;
    color: var(--brand-dark);
    font-size: 0.92rem;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-info span {
    color: var(--muted);
    font-size: 0.8rem;
}

.live-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4d4d;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: live-blink 1.5s infinite;
}

@keyframes live-blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.live-location-btn.active {
    color: #ff4d4d;
}

.live-location-header-btn {
    background: #ff4d4d;
    /* Red for stopping */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 15px;
    /* Space it from other header elements */
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
    transition: background 0.2s ease;
    animation: header-pulse 2s infinite;
}

.live-location-header-btn:hover {
    background: #e60000;
    animation: none;
    /* Stop pulsing on hover for cleaner interaction */
}

@keyframes header-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 77, 77, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
    }
}

/* Emoji Picker Popup */
.emoji-picker-content {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    /* Remove padding from main container */
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 1000;
    max-height: 300px;
    /* Increased max height */
    width: 320px;
    /* Increased width */
    overflow: hidden;
    /* Hide scrollbars from main container */
}

.emoji-search-container {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: white;
}

.emoji-search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    outline: none;
    background: var(--panel-soft);
    transition: all 0.2s ease;
}

.emoji-search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
    background: white;
}

.emoji-skin-tones {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: #f8faf7;
    border-bottom: 1px solid var(--border);
}

.skin-tone-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    padding: 0;
}

.skin-tone-btn.active {
    border-color: var(--brand);
    transform: scale(1.2);
}

.skin-tone-btn:hover {
    transform: scale(1.1);
}

/* Skin tone colors */
.tone-default {
    background: #FFDE00;
}

.tone-1f3fb {
    background: #F7D2AB;
}

.tone-1f3fc {
    background: #E3B192;
}

.tone-1f3fd {
    background: #B78D71;
}

.tone-1f3fe {
    background: #915E3F;
}

.tone-1f3ff {
    background: #51362E;
}

.emoji-categories {
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    flex-shrink: 0;
    /* Prevent categories from shrinking */
}

.emoji-category-tab {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--muted);
    transition: background 0.2s, color 0.2s;
}

.emoji-category-tab:hover {
    background: var(--panel-soft);
}

.emoji-category-tab.active {
    color: var(--brand-dark);
    background: var(--panel-soft);
}

.emoji-grid {
    flex: 1;
    /* Allow emoji grid to take remaining space */
    overflow-y: auto;
    /* Scroll emojis within the grid */
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    padding: 12px;
}

/* Attachment Menu Popup */
.attachment-menu {
    position: absolute;
    bottom: 80px;
    right: 70px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 1000;
    min-width: 200px;
    animation: slideUp 0.2s ease;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    border-radius: 10px;
    transition: background 0.2s;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    text-align: left;
}

.attachment-item:hover {
    background: var(--panel-soft);
}

.attachment-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.attachment-icon.media {
    background: #bf59cf;
}

.attachment-icon.camera {
    background: #ff4081;
}

.attachment-icon.doc {
    background: #5f66cd;
}

.attachment-icon.location {
    background: #009688;
}

/* Message Context Menu */
.message-context-menu {
    position: fixed;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    min-width: 220px;
    padding: 8px 0;
    display: none;
    flex-direction: column;
    animation: menuAppear 0.15s cubic-bezier(0, 0, 0.2, 1);
}

/* Reactions row within the context menu */
@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

.reactions-row {
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    border-bottom: 1px solid var(--panel-soft);
    margin-bottom: 4px;
}

.context-reaction-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.reaction-btn:hover {
    background: var(--panel-soft);
    transform: scale(1.2);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text);
    transition: background 0.2s;
    font-family: inherit;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.context-menu-item i {
    width: 16px;
    color: var(--muted);
    font-size: 0.9rem;
}

.context-menu-item.delete {
    color: #e74c3c;
}

.context-menu-item.delete i {
    color: #e74c3c;
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

/* Reaction Picker (floating) */
.reaction-picker {
    position: absolute;
    background: white;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    z-index: 1000;
    display: none;
    /* Hidden by default */
    animation: slideUp 0.2s ease;
}

.reaction-picker-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: transform 0.1s ease, background 0.2s ease;
}

.reaction-picker-btn:hover {
    transform: scale(1.2);
    background: #f0f2f5;
}

/* Displayed Reactions below message bubble */
.message-reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    margin-left: 5px;
    /* Align with bubble content */
}

.message-group.sent .message-reactions-container {
    margin-left: auto;
    /* Push to the right for sent messages */
    margin-right: 5px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    background: #e0e0e0;
    /* Light grey background */
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.reaction-badge:hover {
    background: #d0d0d0;
    transform: translateY(-1px);
}

.reaction-badge span {
    margin-left: 4px;
}

/* Reaction Detail Modal */
.reaction-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.reaction-detail-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.reaction-detail-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text);
}

.reaction-detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--panel-soft);
}

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

.reaction-detail-item .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--brand);
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.reaction-detail-item .name {
    font-weight: 600;
    color: var(--text);
}

.reaction-detail-item .time {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--muted);
}

/* Ephemeral Message Indicator */
.message-bubble.ephemeral .message-text::after {
    content: ' ⏳';
    /* Clock emoji */
    font-size: 0.8em;
    vertical-align: middle;
    margin-left: 5px;
    opacity: 0.7;
}

.ephemeral-timer {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 2px;
    display: block;
    text-align: right;
    opacity: 0.8;
}

.message-group.sent .ephemeral-timer {
    text-align: left;
    /* Align timer to the left for sent messages */
}

/* Ephemeral Expiry Picker Modal */
.ephemeral-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.ephemeral-picker-content {
    background: white;
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.ephemeral-picker-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text);
}

.ephemeral-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ephemeral-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.ephemeral-option-item:hover {
    background: var(--panel-soft);
}

.ephemeral-option-item.active {
    border-color: var(--brand);
    background: rgba(0, 168, 132, 0.05);
}

.ephemeral-option-item input[type="radio"] {
    margin-left: 10px;
    accent-color: var(--brand);
}

.ephemeral-option-item span {
    font-size: 0.95rem;
    color: var(--text);
}

.close-ephemeral-picker-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted);
    position: absolute;
    top: 10px;
    right: 10px;
}

.close-reaction-detail-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted);
    position: absolute;
    top: 10px;
    right: 10px;
}

.pinned-indicator {
    font-size: 0.75rem;
    color: var(--muted);
    margin-right: 4px;
    transform: rotate(45deg);
}

.message-info-item {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--panel-soft);
}

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

.message-info-label {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.95rem;
}

.message-info-value {
    color: var(--text);
    font-size: 0.95rem;
    text-align: right;
}

.location-search-results-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--panel-soft);
    font-size: 0.85rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-search-results-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.location-search-results-item:hover {
    background: var(--panel-soft);
}

.location-search-results-item:last-child {
    border-bottom: none;
}

.location-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.location-option-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: none;
    background: white;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.2s;
    text-align: left;
    width: 100%;
}

.location-option-item:hover {
    background: var(--panel-soft);
}

.nearby-place-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.nearby-place-item:hover {
    background: var(--panel-soft);
}

.location-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.location-icon.live {
    background: #ff4d4d;
}

.location-icon.current {
    background: var(--brand);
}

.location-text {
    display: flex;
    flex-direction: column;
}

.location-text strong {
    font-size: 1rem;
    color: var(--text);
}

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

/* Custom Leaflet Marker */
.custom-map-marker {
    color: var(--brand);
    font-size: 32px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
    display: block;
    text-align: center;
}

.marker-distance-label {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: var(--text);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* Distance Tiers */
.marker-distance-label.very-near {
    background: var(--brand);
    color: white;
    border-color: var(--brand-dark);
}

.marker-distance-label.near {
    background: #ff9800;
    /* Warning/Orange */
    color: white;
    border-color: #e65100;
}

.marker-distance-label.far {
    background: white;
    color: var(--muted);
    border-color: var(--border);
}

/* Map Mode Selector inside Popup */
.map-mode-selector {
    display: flex;
    background: var(--panel-soft);
    padding: 3px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid var(--border);
}

.map-mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 8px;
    /* Slightly increased padding */
    cursor: pointer;
    border-radius: 6px;
    color: var(--muted);
    transition: all 0.2s;
}

.map-mode-btn.active {
    background: white;
    color: var(--brand-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.custom-div-icon {
    background: none !important;
    border: none !important;
}

.emoji-picker span {
    cursor: pointer;
    font-size: 1.3rem;
    transition: transform 0.1s ease;
    text-align: center;
}

.emoji-picker span:hover {
    transform: scale(1.3);
}

/* Voice Note Preview */
.voice-preview {
    position: absolute;
    bottom: 70px;
    right: 18px;
    background: white;
    border-radius: 30px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    z-index: 100;
}

.voice-preview-btn {
    background: var(--brand);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
}

.preview-cancel {
    background: #ff4d4d;
}

.preview-play {
    background: #34b7f1;
}

.preview-send {
    background: var(--brand);
}

.preview-status {
    font-size: 0.85rem;
    color: var(--muted);
    min-width: 40px;
}

/* Floating Shop Button */
.floating-shop-btn {
    position: absolute;
    bottom: 90px;
    right: 25px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 100;
    transition: transform 0.2s ease, background 0.2s ease;
    touch-action: none;
}

.floating-shop-btn:hover {
    transform: scale(1.1);
    background: var(--brand-dark);
}

.shop-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4d4d;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    padding: 0 4px;
    pointer-events: none;
}

/* Audio Message Bubble */
.audio-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.record-btn.recording {
    background: #ff4d4d;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Camera Modal Styles */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 80dvh;
    display: flex;
    flex-direction: column;
}

#camera-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    border-radius: 12px;
}

.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    align-items: center;
}

.camera-action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: grid;
    place-items: center;
    transition: transform 0.2s;
}

.camera-action-btn:active {
    transform: scale(0.9);
}

.cam-close {
    background: #ff4d4d;
    color: white;
}

.cam-video.recording {
    background: #ff4d4d;
    animation: pulse 1.5s infinite;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 8px 10px;
    }

    .app-logo {
        height: 32px;
        width: 32px;
        border-radius: 50%;
    }

    .header-brand {
        gap: 8px;
    }

    .user-profile-summary {
        display: none !important;
    }

    .navbar {
        gap: 4px;
    }

    .nav-item {
        min-width: 48px;
        height: auto;
        padding: 4px 6px;
        border-radius: 8px;
        gap: 2px;
        font-size: 0.65rem;
    }

    .nav-item span {
        display: block !important;
    }

    .nav-item i {
        font-size: 1.1rem;
    }

    .nav-item-rel {
        width: 36px !important;
        height: 36px !important;
        min-width: unset !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }

    .header-ellipsis-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: unset !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }

    .header-request-badge {
        top: 0px !important;
        right: 0px !important;
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
    }

    .chatsidebar,
    .costomersidebar,
    .chat-area {
        border-radius: 0;
        border: none;
        min-height: 0;
    }

    /* Hide Chat Area by default on mobile */
    .chat-area {
        display: none !important;
    }

    /* Toggle View State */
    .container.viewing-chat .chatsidebar,
    .container.viewing-chat .costomersidebar,
    .container.viewing-chat .starredsidebar,
    .container.viewing-chat .callssidebar,
    .container.viewing-chat .archivedsidebar,
    .container.viewing-chat .lockedchatssidebar {
        display: none !important;
    }

    .container.viewing-chat .chat-area {
        display: flex !important;
    }

    .back-btn {
        display: block;
    }

    .chat-actions,
    .input-actions {
        gap: 8px;
    }

    .message-bubble {
        max-width: 80%;
    }

    .store-controls,
    .store-title-bar,
    .store-actions,
    .store-search-overlay,
    .market-filter-drawer,
    .distance-filter-container {
        width: 100%;
        gap: 10px;
    }

    .store-title-bar,
    .store-actions,
    .store-search-overlay,
    .market-filter-drawer {
        flex-wrap: wrap;
    }

    .store-search-input,
    .custom-select-wrapper,
    .custom-select-trigger,
    .custom-select-dropdown,
    .store-actions select,
    .distance-slider,
    .add-product-btn,
    .submit-product-btn,
    .checkout-btn,
    .clear-cart-btn,
    .action-btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    .store-search-input {
        width: 100% !important;
    }

    .shop-product-grid,
    [data-ui="general-market-product-grid"],
    [data-ui="product-grid"],
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .product-card {
        padding: 16px;
    }

    .form-row,
    .img-selector-actions,
    .cart-footer,
    .emoji-grid {
        grid-template-columns: 1fr;
    }

    .cart-footer {
        grid-template-columns: 1fr;
    }

    .cart-total {
        grid-column: auto;
        text-align: left;
    }

    .auth-card,
    .modal-content,
    .reaction-detail-content,
    .ephemeral-picker-content,
    .delete-modal-content {
        width: 100%;
        max-width: none !important;
        padding: 24px 18px;
    }

    .modal-content {
        max-height: calc(100dvh - 24px);
    }

    .details-main-img {
        height: min(42vw, 220px);
    }

    .pdf-embed-container,
    .pdf-thumbnail-container {
        height: min(48vw, 220px);
    }

    .img-preview-box {
        min-height: 100px;
        max-height: 180px;
    }

    .preview-item {
        width: 52px;
        height: 52px;
    }

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

    .camera-controls {
        gap: 16px;
        bottom: 12px;
    }

    .camera-action-btn {
        width: 52px;
        height: 52px;
    }

    .lightbox-img {
        max-width: calc(100vw - 24px);
        max-height: 70dvh;
    }

    .toast,
    .undo-snackbar,
    .message-context-menu,
    .attachment-menu,
    .header-dropdown-menu {
        max-width: calc(100vw - 24px);
    }

    .toast {
        min-width: 0;
        width: calc(100vw - 24px);
    }

    .undo-snackbar {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
        bottom: 12px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .attachment-menu,
    .message-context-menu,
    .header-dropdown-menu {
        width: min(320px, calc(100vw - 24px));
        right: 12px;
        left: auto;
    }

    .call-user-info h2,
    .details-info h2 {
        font-size: 1.4rem;
    }

    .call-user-info p,
    .details-description,
    .cart-item-meta,
    .toast,
    .undo-snackbar {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px;
    }

    .nav-item {
        min-width: 0;
        padding: 4px;
        font-size: 0.62rem;
    }

    .nav-item span {
        display: none !important;
    }

    .nav-item i {
        font-size: 1rem;
    }

    .auth-card,
    .modal-content {
        padding: 18px 14px;
    }

    .details-main-img {
        height: 180px;
    }

    .camera-controls {
        gap: 12px;
    }

    .camera-action-btn {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

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

    .toast,
    .undo-snackbar {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .undo-snackbar {
        left: 8px;
        right: 8px;
        bottom: 8px;
        padding: 10px 14px;
    }

    .store-search-overlay,
    .store-menu-wrapper,
    .market-filter-drawer {
        gap: 8px;
    }

    .store-search-overlay button,
    .store-menu-wrapper button {
        width: 38px;
        height: 38px;
        flex: 0 0 auto;
    }

    .header-dropdown-menu,
    .message-context-menu,
    .attachment-menu {
        width: calc(100vw - 20px);
        right: 10px;
    }
}

.store-area {
    padding: 20px;
    background: #eaeded;
    /* Amazon-like light gray background */
    min-height: 100%;
    width: 100%;
    overflow-y: auto;
    /* Ensure products can scroll */
    grid-column: 1 / -1;
    /* Make it span full width in the grid container */
}

.store-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #d5d9d9;
    flex-wrap: wrap;
    gap: 16px;
}

.store-header {
    font-size: 1.6rem;
    margin: 0;
    color: #0f1111;
}

.store-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-grow: 1;
    justify-content: flex-end;
}

.store-search-input {
    padding: 8px 12px;
    border: 1px solid #D5D9D9;
    border-radius: 8px;
    width: 280px;
    font-size: 0.9rem;
    outline: none;
    box-shadow: 0 1px 2px rgba(15, 17, 17, .15) inset;
}

.add-product-btn {
    background: #FFD814;
    border: 1px solid #FCD200;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 5px 0 rgba(213, 217, 217, .5);
    transition: background 0.2s;
}

.add-product-btn:hover {
    background: #F7CA00;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid #e7e7e7;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.shop-container.cart-open .product-card {
    transform: scale(0.97);
    opacity: 0.75;
    filter: brightness(0.95);
    box-shadow: 0 4px 12px rgba(0, 168, 132, 0.1);
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-card.is-sold-out {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.sold-out-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: rgba(211, 47, 47, 0.9);
    color: white;
    padding: 8px 16px;
    font-weight: 800;
    font-size: 1.2rem;
    border: 3px solid white;
    border-radius: 4px;
    z-index: 15;
    pointer-events: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.product-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.product-card:hover .product-actions {
    opacity: 1;
}

.edit-product-card-btn,
.delete-product-card-btn,
.toggle-sold-out-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #d5d9d9;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.toggle-sold-out-btn .fa-circle-check {
    color: #2e7d32;
}

.toggle-sold-out-btn .fa-ban {
    color: #d32f2f;
}

.edit-product-card-btn:hover {
    background: #f0f7ff;
    color: #007185;
}

.delete-product-card-btn:hover {
    background: #fde8e8;
    color: #c40000;
}

.product-img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 15px;
    transition: opacity 0.2s, transform 0.3s ease;
    transform: scale(1);
}

.product-image-container:hover .product-img {
    cursor: pointer;
    transform: scale(1.1);
}

.product-image-container {
    position: relative;
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
    overflow: hidden;
}

.product-image-container .product-img {
    height: 100%;
    margin-bottom: 0;
}

.gallery-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(15, 17, 17, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5;
    cursor: pointer;
    transition: background 0.2s;
}

.gallery-badge:hover {
    background: rgba(15, 17, 17, 0.9);
}

.product-name {
    font-size: 1rem;
    font-weight: 500;
    color: #007185;
    /* Amazon blue for titles */
    margin: 0 0 8px 0;
    cursor: pointer;
    line-height: 1.3;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-name:hover {
    color: #c45500;
    /* Amazon orange on hover */
}

.product-desc {
    font-size: 0.85rem;
    color: #565959;
    margin-bottom: 12px;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    margin-top: auto;
    /* Pushes the meta info to the bottom of the card */
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    flex: 1 0 100%;
    margin-top: 4px;
    order: 3;
    /* Ensures price stays below the metadata tags */
}

.product-form,
.product-quantity {
    font-size: 0.72rem;
    color: var(--muted);
    background: var(--panel-soft);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.product-currency {
    color: #5fb1e3;
    /* Light Blue */
    margin-right: 2px;
}

/* Add Product Modal */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 16px;
    width: 95%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #0f1111;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #565959;
}

#add-product-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.recent-search-chip {
    background: #f0f2f5;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
    border: 1px solid #d1d7db;
    transition: all 0.2s;
}

.recent-search-chip:hover {
    background: #e9edef;
    color: var(--text);
    border-color: #aebac1;
}

#qr-reader video {
    width: 100% !important;
    object-fit: cover !important;
}

#my-qr-code canvas,
#my-qr-code img {
    max-width: 100%;
    height: auto !important;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #232f30;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #e77600;
    box-shadow: 0 0 3px 2px rgba(228, 121, 17, .5);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.submit-product-btn {
    background: #FFD814;
    border: 1px solid #FCD200;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.submit-product-btn:hover {
    background: #f7ca00;
}

.error-msg {
    color: #d32f2f;
    font-size: 0.75rem;
    margin-top: 4px;
    min-height: 1rem;
    font-weight: 500;
}

/* Enhanced invalid state with red glow */
.invalid {
    border-color: #d32f2f !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.2) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Success state with green glow */
.valid {
    border-color: var(--brand) !important;
    background-color: #f0fdf4 !important;
    box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.2) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.delete-product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2500;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.delete-modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.delete-preview-info {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.delete-preview-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #eee;
}

.delete-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.confirm-delete-btn {
    background: #cc0000;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.cancel-delete-btn {
    background: #f0f2f2;
    color: #0f1111;
    border: 1px solid #d5d9d9;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Settings Modal Specifics */
.settings-menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s;
}

.settings-menu-item:hover {
    background: var(--panel-soft);
}

.settings-menu-item i {
    font-size: 1.2rem;
    color: var(--muted);
    width: 25px;
    /* Fixed width for icons */
    text-align: center;
}

.product-uploads-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f8f9f9;
    border-radius: 12px;
    border: 1px solid #d5d9d9;
}

.upload-progress-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-progress-row .progress-text {
    text-align: left;
    padding: 0;
}

.product-image-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.img-preview-box {
    width: 100%;
    min-height: 120px;
    height: auto;
    max-height: 200px;
    border: 2px dashed #d5d9d9;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    background: #f8f9f9;
}

.img-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.img-preview-box span {
    color: #565959;
    font-size: 0.9rem;
}

.preview-item {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #d5d9d9;
    background: white;
    position: relative;
}

.remove-img-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 77, 77, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 5;
}

.remove-img-btn:hover {
    background: #ff4d4d;
}

.img-selector-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.img-btn {
    padding: 8px;
    border: 1px solid #d5d9d9;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.img-btn:hover {
    background: #f1f1f1;
}

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

/* Lightbox Styles */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 3010;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 4rem;
    padding: 10px 25px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-img {
    max-width: 85vw;
    max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.lightbox-img:hover {
    transform: scale(1.05);
}

/* Loading Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Initial Loading Screen */
.app-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9999;
    /* Highest priority */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.app-loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    color: var(--brand-dark);
}

/* Authentication & Landing Page */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h2 {
    font-size: 1.8rem;
    margin: 0 0 8px 0;
    color: var(--text);
}

.auth-header p {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0;
}

.auth-submit-btn {
    background: var(--brand-dark);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.auth-submit-btn:hover {
    background: #0b6b60;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider span {
    padding: 0 12px;
}

.google-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: white;
    border: 1px solid #dce3db;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.google-auth-btn:hover {
    background: #f8faf7;
}

.auth-footer {
    margin-top: 32px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
}

#auth-toggle-btn {
    background: none;
    border: none;
    color: var(--brand-dark);
    font-weight: 700;
    cursor: pointer;
    padding-left: 5px;
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
}

.remember-me input {
    margin: 0;
    cursor: pointer;
}

.forgot-password-link {
    font-size: 0.85rem;
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 600;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.reset-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5010;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: #323232;
    color: white;
    padding: 12px 16px 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: toast-in 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.toast-close-btn:hover {
    color: white;
    transform: scale(1.1);
}

.toast.error {
    background: #d32f2f;
}

.toast.success {
    background: #2e7d32;
}

.toast.warning {
    background: #ed6c02;
}

.toast.info {
    background: #0288d1;
}

@keyframes toast-in {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

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

@keyframes slideDownExit {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* Message Flash Highlight */
.message-group.flash .message-bubble {
    position: relative;
}

.message-group.flash .message-bubble::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--brand);
    border-radius: inherit;
    pointer-events: none;
    animation: flash-overlay 1.5s ease-out forwards;
    z-index: 1;
}

@keyframes flash-overlay {
    0% {
        opacity: 0.5;
    }

    100% {
        opacity: 0;
    }
}

@keyframes toast-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* Profile Modal Specifics */
.profile-photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
}

#profile-photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--brand);
    background: #f0f0f0;
}

.profile-photo-actions {
    display: flex;
    gap: 10px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5010;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.password-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-group input {
    padding-right: 40px;
    /* Make space for the toggle button */
}

.toggle-password-visibility {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
}

.starredsidebar {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e6eee6;
    display: none;
    min-width: 0;
    min-height: 0;
}

.lockedchatssidebar {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e6eee6;
    display: none;
    min-width: 0;
    min-height: 0;
}

.starred-messages-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    min-width: 0;
    min-height: 0;
}

.starred-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.starred-item-text {
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: 500;
}

.starred-item-date {
    font-size: 0.75rem;
    color: var(--muted);
}

.unstar-all-btn {
    background: none;
    border: none;
    color: var(--brand-dark);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

/* Upload Progress UI */
.upload-progress-container {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--brand);
    width: 0%;
    transition: width 0.2s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.upload-cancel-btn {
    align-self: center;
    background: #f0f2f5;
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--muted);
    font-weight: 600;
    transition: all 0.2s;
}

.upload-cancel-btn:hover {
    background: #ffebeb;
    color: #e74c3c;
    border-color: #ffcfcf;
}

.upload-preview-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin: 0 auto 5px;
    display: block;
    border: 1px solid var(--border);
}

.upload-file-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 5px;
    display: block;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.modal-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: inherit;
    backdrop-filter: blur(2px);
}

.cancel-forward-btn {
    margin-top: 12px;
    background: white;
    border: 1.5px solid #ff4d4d;
    color: #ff4d4d;
    padding: 6px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.cancel-forward-btn:hover {
    background: #fff5f5;
    transform: translateY(-1px);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.delete-confirmation-modal.modal-overlay {
    animation: modalFadeIn 0.2s ease;
}

.delete-confirmation-modal .modal-content {
    animation: modalPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }

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

.delete-confirmation-modal.closing.modal-overlay {
    animation: modalFadeOut 0.2s ease forwards;
}

.delete-confirmation-modal.closing .modal-content {
    animation: modalSlideDown 0.3s cubic-bezier(0.32, 0, 0.67, 0) forwards;
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes modalSlideDown {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.9) translateY(40px);
    }
}

.modal-shake {
    animation: modalShake 0.4s ease-in-out !important;
}

@keyframes modalShake {

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

    20%,
    60% {
        transform: scale(1) translateX(-8px);
    }

    40%,
    80% {
        transform: scale(1) translateX(8px);
    }
}

.search-highlight {
    background-color: rgba(255, 235, 59, 0.6);
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

.message-bubble.active-match {
    box-shadow: 0 0 0 3px #ff9800, var(--shadow);
    /* Orange border highlight */
    transition: box-shadow 0.2s ease;
}

.message-bubble.active-match .search-highlight {
    background-color: #ff9800 !important;
    color: white;
}

/* Voice Call Interface */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: #075e54;
    z-index: 6000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.call-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    height: 80dvh;
    justify-content: space-between;
}

.call-user-info h2 {
    margin: 20px 0 5px;
    font-size: 1.8rem;
}

.call-user-info p {
    opacity: 0.8;
    font-size: 1rem;
}

.call-avatar-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.call-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--brand);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    border: 4px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid white;
    border-radius: 50%;
    animation: callPulse 2s infinite;
}

@keyframes callPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding-bottom: 50px;
}

.call-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.call-btn:active {
    transform: scale(0.9);
}

.call-btn.mute {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.mute.active {
    background: white;
    color: #075e54;
}

.call-btn.add-participant {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.add-participant:hover {
    background: rgba(255, 255, 255, 0.35);
}

.call-btn.screen-share {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.screen-share:hover {
    background: rgba(255, 255, 255, 0.35);
}

.call-btn.screen-share.active {
    background: #4caf50;
    color: white;
}

.call-btn.end {
    background: #ff4d4d;
}

.call-btn.audio-source {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.audio-source.active {
    background: white;
    color: #075e54;
}

.call-btn.speaker {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.speaker.active {
    background: white;
    color: #075e54;
}

.call-btn.cam-mute {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.cam-mute.active {
    background: white;
    color: #075e54;
}

.call-btn.flash {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.flash.active {
    background: #ffd814;
    color: #111b21;
}

.call-btn.flip {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.pip {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.video-switch {
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.retry {
    background: #34b7f1;
}

.call-btn.accept {
    background: #25d366;
}

.incoming .call-content {
    justify-content: space-around;
}

.waiting-call-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.waiting-call-badge i {
    color: #25d366;
}

.switch-call-btn {
    background: #25d366;
    color: white;
    border: none;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    margin-left: 8px;
    text-transform: uppercase;
    transition: background 0.2s;
}

.switch-call-btn:hover {
    background: #1fae56;
}

.reject-waiting-call-btn {
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    margin-left: 5px;
    text-transform: uppercase;
    transition: background 0.2s;
}

.reject-waiting-call-btn:hover {
    background: #e60000;
}

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 5;
    display: none;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-mute-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 27, 33, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 6;
    color: white;
    backdrop-filter: blur(8px);
}

.remote-mute-overlay i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    color: #ff4d4d;
}

.remote-mute-overlay p {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
}

#local-video {
    position: absolute;
    bottom: 120px;
    right: 20px;
    width: 100px;
    height: 150px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
    z-index: 10;
    background: #222;
    background-size: cover;
    background-position: center;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

#local-video.muted-blur {
    filter: blur(15px);
    opacity: 0.7;
    background-color: #1c1c1c;
}

.call-overlay.video-mode .call-avatar-wrapper,
.call-overlay.video-mode .pulse-ring {
    display: none;
}

.call-overlay.video-mode .call-user-info {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 15;
    pointer-events: none;
}

.call-overlay.video-mode .call-controls {
    z-index: 15;
}

@keyframes flipRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(180deg);
    }
}

.call-btn.flip i.flipping {
    animation: flipRotate 0.4s ease-out;
}

/* Minimized Call Bar for Voice */
.minimized-call-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #075e54;
    z-index: 5500;
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    animation: slideDown 0.3s ease-out;
}

.minimized-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.minimized-info i {
    color: #25d366;
}

.minimized-timer {
    font-family: monospace;
    opacity: 0.9;
}

.minimized-actions {
    display: flex;
    gap: 10px;
}

.min-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.min-action-btn.end {
    background: #ff4d4d;
}

/* Video PiP (In-App) */
.call-overlay.minimized {
    top: auto;
    left: auto;
    bottom: 20px;
    right: 20px;
    width: 160px;
    height: 240px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 7000;
}

.call-overlay.minimized .call-content {
    opacity: 0;
    pointer-events: none;
}

.call-overlay.minimized #local-video {
    width: 50px;
    height: 75px;
    bottom: 10px;
    right: 10px;
}

.call-overlay.minimized .minimize-call-btn {
    display: none;
}

.pip-end-call-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255, 77, 77, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 25;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.call-overlay.minimized .pip-end-call-btn {
    display: flex;
}

.pip-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 30px;
    cursor: nesw-resize;
    z-index: 30;
    display: none;
}

.pip-resize-handle::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 12px;
    height: 12px;
    border-left: 3px solid rgba(255, 255, 255, 0.8);
    border-bottom: 3px solid rgba(255, 255, 255, 0.8);
}

.call-overlay.minimized .pip-resize-handle {
    display: block;
}

.pip-mute-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    color: #ff4d4d;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 25;
    backdrop-filter: blur(4px);
}

.call-overlay.minimized .pip-mute-indicator.active {
    display: flex;
}

.audio-source-menu {
    position: absolute;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 220px;
}

.audio-source-item {
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #111b21;
    font-family: inherit;
}

.audio-source-item:hover {
    background: #f0f2f5;
}

.audio-source-item.active {
    color: #00a884;
    font-weight: 700;
}

.callssidebar {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e6eee6;
    min-width: 0;
    min-height: 0;
}

.call-type-icon {
    margin-right: 5px;
    font-size: 0.8rem;
}

.call-type-icon.outgoing {
    color: var(--brand);
}

.call-type-icon.incoming {
    color: var(--brand);
}

.call-type-icon.missed {
    color: #ff4d4d;
}

.conversation-name.missed {
    color: #ff4d4d;
}

.redial-btn {
    background: var(--brand);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}

.redial-btn:hover {
    background: var(--brand-dark);
    transform: scale(1.1);
}

/* Chat Call Log Bubbles */
.message-group.call-log {
    justify-content: center;
    margin: 12px 0;
    pointer-events: none;
}

.message-bubble.call {
    background: #fff !important;
    color: var(--muted);
    font-size: 0.82rem;
    padding: 6px 16px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    max-width: 100%;
    cursor: pointer;
    pointer-events: auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message-bubble.call i {
    font-size: 0.9rem;
}

.message-bubble.call.missed {
    color: #ff4d4d;
}

.message-bubble.call .dir-icon {
    font-size: 0.65rem;
    opacity: 0.7;
}

.call-back-btn {
    background: none;
    border: none;
    color: var(--brand);
    font-weight: 800;
    font-size: 0.7rem;
    margin-left: 10px;
    padding: 2px 0 2px 12px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.call-back-btn:hover {
    color: var(--brand-dark);
}

.customer-toggle-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--brand);
    color: white;
    transition: filter 0.2s;
    white-space: nowrap;
}

.customer-toggle-btn:hover {
    filter: brightness(0.9);
}

.call-log-delete-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.8rem;
    margin-left: 8px;
    padding: 2px 5px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s, color 0.2s;
    flex-shrink: 0;
}

.call-log-delete-btn:hover {
    opacity: 1;
    color: #ff4d4d;
}

.message-group.system-message {
    justify-content: center;
    margin: 10px 0;
}

.system-message-bubble {
    background: #e1f5fe;
    color: #54656f;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 85%;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Animation for Business Registration View */
#business-registration-view {
    animation: fadeInScaleUp 0.5s ease-out forwards;
}

@keyframes fadeInScaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

/* Custom Searchable Select Styles */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.custom-select-trigger:hover {
    border-color: var(--brand);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

.custom-select-dropdown.active {
    display: flex;
}

.options-list {
    max-height: 250px;
    overflow-y: auto;
}

.option-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.option-item:hover {
    background: var(--panel-soft);
    color: var(--brand-dark);
}

.option-item.selected {
    background: #e6f6f3;
    color: var(--brand-dark);
    font-weight: 600;
}

/* Multi-select Chips */
.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-height: 24px;
    align-items: center;
}

.chip {
    background: var(--brand-dark);
    color: white;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chip-remove {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.8;
}

.chip-remove:hover {
    opacity: 1;
}

.multi-select-item .checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-item.selected .checkbox {
    background: var(--brand);
    border-color: var(--brand);
}

.option-item.selected .checkbox::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: white;
    font-size: 0.7rem;
}

.input-shake {
    animation: inputShake 0.4s ease-in-out;
}

@keyframes inputShake {

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

    25% {
        transform: translateX(-6px);
    }

    50% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-6px);
    }
}

/* Distance Filter Styles */
.distance-filter-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: var(--text);
}

.distance-filter-container label {
    font-weight: 600;
    white-space: nowrap;
}

.distance-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--panel-soft);
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    border-radius: 2px;
}

.distance-slider:hover {
    opacity: 1;
}

.distance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--brand);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--brand-dark);
}

.distance-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--brand);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--brand-dark);
}

.distance-value {
    min-width: 60px;
    text-align: right;
    font-weight: 700;
    color: var(--brand-dark);
}

.chat-bg-preview-box {
    width: 100%;
    height: 120px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    margin-top: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-soft);
}

.chat-bg-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gradient-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.gradient-preset {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s;
}

.gradient-preset:hover {
    transform: scale(1.15);
    border-color: var(--brand);
}

.gradient-preset.animated-preset {
    background: linear-gradient(-45deg, #075e54, #128c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: chatGradientAnim 3s ease infinite;
    border: 2px solid var(--brand);
}

.messages-container.animated-bg {
    background: linear-gradient(-45deg, #075e54, #128c7e, #23a6d5, #23d5ab) !important;
    background-size: 400% 400% !important;
    animation: chatGradientAnim 15s ease infinite !important;
}

@keyframes chatGradientAnim {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.verified-badge,
.verified-badge-inline {
    background: white;
    color: #25d366;
    /* WhatsApp verified green */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    z-index: 5;
    cursor: help;
}

.verified-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    font-size: 0.95rem;
}

.verified-badge-inline {
    display: inline-flex;
    width: 16px;
    height: 16px;
    font-size: 0.8rem;
    margin-left: 5px;
    vertical-align: middle;
}

/* Tooltip Box */
.verified-badge::after,
.verified-badge-inline::after {
    content: "Hotma has confirmed this business's identity and registration documents.";
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #111b21;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    width: 180px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

/* Tooltip Arrow */
.verified-badge::before,
.verified-badge-inline::before {
    content: "";
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #111b21;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
}

.verified-badge:hover::after,
.verified-badge:hover::before,
.verified-badge-inline:hover::after,
.verified-badge-inline:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.why-restricted-link {
    background: none;
    border: none;
    color: var(--brand-dark);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.why-restricted-link:hover {
    color: var(--brand);
}

.toast-suppress-container {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.toast-suppress-container input {
    cursor: pointer;
    accent-color: var(--brand);
}

.blocked-reason-badge {
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    cursor: help;
    opacity: 0.8;
}

/* Privacy Modal Specific Styles */
.privacy-modal .modal-content {
    max-width: 500px;
    /* Slightly wider for better layout */
}

.privacy-form .settings-group {
    margin-bottom: 20px;
    /* Spacing between setting groups */
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Space between label/description and input */
}

.privacy-form .settings-group label {
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.privacy-form .settings-group label i {
    color: var(--brand-dark);
    font-size: 1.1rem;
    width: 20px;
    /* Fixed width for icons */
    text-align: center;
}

.privacy-form .form-control {
    /* For select elements */
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    background: var(--panel);
    color: var(--text);
    width: 100%;
    appearance: none;
    /* Remove default select arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23667781'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.privacy-form .form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
}

/* Settings Section Title for Modals */
.settings-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.privacy-form .form-text.muted {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 5px;
    display: block;
    /* Ensure it takes its own line */
}

.privacy-form .form-actions {
    margin-top: 30px;
}

/* Specific styling for Read Receipts toggle group */
.settings-toggle-group {
    flex-direction: row;
    /* Align label and checkbox horizontally */
    align-items: center;
    justify-content: space-between;
}

.settings-toggle-label-wrapper {
    flex: 1;
    padding-right: 15px;
}

.settings-toggle-label {
    margin-bottom: 0 !important;
    /* Override default label margin */
}

.settings-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--brand);
}

/* Excluded Contacts Modal */
.excluded-contacts-modal .conversation-item .customer-toggle-btn {
    background: var(--panel-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

/* App Lock Overlay and Lock Card */
.app-lock-screen {
    display: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.app-lock-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.lock-card {
    animation: lockCardEntrance 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes lockCardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

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

/* Keypad Button Active States */
.keypad-btn {
    transition: background 0.15s ease, transform 0.1s ease !important;
}

.keypad-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.keypad-btn:active {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(0.9) !important;
}

.keypad-btn.action:hover {
    color: white !important;
}

/* PIN Dot styling */
.pin-dot {
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.pin-dot.filled {
    background: var(--brand, #00a884) !important;
    border-color: var(--brand, #00a884) !important;
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--brand, #00a884);
}

/* Error shaking animation */
.lock-card.shake {
    animation: lockCardShake 0.4s ease-in-out;
}

@keyframes lockCardShake {

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

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

/* Storage and Data Settings Styling */
.chat-storage-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 15px;
}

.storage-media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.storage-media-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.storage-media-item img,
.storage-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.storage-media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--muted);
    gap: 6px;
    padding: 10px;
    text-align: center;
}

.storage-media-placeholder span {
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.storage-media-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.storage-media-item.selected {
    outline: 3px solid var(--brand);
    outline-offset: -3px;
}

.storage-media-item.selected::after {
    content: "\f058";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 6px;
    right: 6px;
    color: var(--brand);
    background: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.network-usage-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
}

.network-usage-card i {
    font-size: 1.3rem;
    color: var(--brand-dark);
    width: 30px;
    text-align: center;
}

.network-usage-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.network-usage-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.network-usage-stats-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    margin-top: 4px;
}

.network-usage-sent-bar {
    background: #4caf50;
}

.network-usage-received-bar {
    background: #2196f3;
}

.network-usage-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--muted);
}

/* Chat Storage size badge in settings */
.chat-storage-size-label {
    margin-left: auto;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.dark-theme .storage-media-badge {
    background: rgba(0, 0, 0, 0.8);
}

.dark-theme .storage-media-placeholder {
    color: var(--muted);
}

.dark-theme .network-usage-stats-bar {
    background: #2a3942;
}

[data-ui="store-menu-wrapper"],
[data-ui="market-menu-wrapper"],
[data-ui="market-filter-drawer"],
[data-ui="market-search-overlay"] {
    display: none;
}

@media (max-width: 768px) {
    .shop-close-btn {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 0.72rem;
        padding: 6px 8px;
        line-height: 1.1;
        flex-shrink: 0;
    }

    .shop-close-btn i {
        font-size: 1.15rem;
    }

    [data-ui="shop-pickup-locations-list"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-top: 8px !important;
    }

    .shop-pickup-location-item {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 8px 10px !important;
        padding: 10px !important;
        border-bottom: none !important;
        border: 1.5px solid var(--border) !important;
        background: var(--panel) !important;
    }

    .shop-pickup-location-item.selected {
        border-color: var(--brand) !important;
        background: rgba(0, 168, 132, 0.08) !important;
    }

    .shop-pickup-location-item a {
        width: 100% !important;
        text-align: center !important;
        margin-top: 4px !important;
        background: var(--panel-soft) !important;
        color: var(--brand-dark) !important;
        border: 1px solid var(--border) !important;
    }

    /* All Product Grids (Shop, General Market, and Store) 1-Column layout for Mobile */
    .shop-product-grid,
    [data-ui="general-market-product-grid"],
    [data-ui="product-grid"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 12px !important;
    }

    .shop-product-grid .product-card,
    [data-ui="general-market-product-grid"] .product-card,
    [data-ui="product-grid"] .product-card {
        padding: 16px !important;
        border-radius: 12px !important;
    }

    .shop-product-grid .product-img,
    .shop-product-grid .product-image-container,
    [data-ui="general-market-product-grid"] .product-img,
    [data-ui="general-market-product-grid"] .product-image-container,
    [data-ui="product-grid"] .product-img,
    [data-ui="product-grid"] .product-image-container {
        height: 200px !important;
        border-radius: 8px !important;
    }

    /* Admin product actions positioning on mobile */
    .product-actions {
        opacity: 1 !important;
        /* Always visible without hover on touch screens */
        top: 4px !important;
        right: 4px !important;
        gap: 4px !important;
    }

    .edit-product-card-btn,
    .delete-product-card-btn,
    .toggle-sold-out-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.65rem !important;
    }

    /* Store Management Header Ellipsis Menu styles for small screen */
    .store-title-bar {
        width: 100% !important;
    }

    [data-ui="store-menu-wrapper"] {
        display: flex !important;
    }

    /* Hide standalone buttons and search container in store actions on mobile */
    .store-actions [data-ui="add-product-btn"],
    .store-actions [data-ui="update-business-info-btn"],
    .store-actions [data-ui="store-search-container"] {
        display: none !important;
    }

    /* Expand category filter on mobile */
    .store-actions [data-ui="store-category-filter"] {
        width: 100% !important;
    }

    /* General Market Header styling overrides on mobile */
    [data-ui="market-menu-wrapper"] {
        display: flex !important;
    }

    [data-ui="general-market-area"] .store-actions {
        display: none !important;
        /* Hide original action layout on mobile */
    }

    [data-ui="shop-locations-map"],
    [data-ui="business-location-map"],
    [data-ui="link-device-scanner"] {
        height: min(55vw, 260px) !important;
    }

    [data-ui="market-search-overlay"] {
        display: flex !important;
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
        margin-right: 0;
    }

    [data-ui="market-search-overlay"] .store-search-input,
    [data-ui="market-search-overlay"] .action-btn,
    [data-ui="market-menu-wrapper"] .action-btn,
    [data-ui="general-market-category-trigger"],
    [data-ui="market-category-mobile-trigger"],
    [data-ui="general-market-sort-select"],
    [data-ui="market-sort-select-mobile"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    .location-search-results,
    .custom-select-dropdown {
        max-width: calc(100vw - 24px) !important;
    }
}