/* ==================== CORE VARIABLES & RESET ==================== */
:root {
    --bg-app: #111b21;
    --panel-bg: #111b21;
    --panel-header-bg: #202c33;
    --search-bg: #202c33;
    --search-input-bg: #202c33;
    --border-color: #222e35;
    
    --primary-green: #00a884;
    --primary-green-hover: #008f72;
    --accent-blue: #53bdeb;
    
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    --text-green: #00a884;
    
    --chat-bg: #0b141a;
    --bubble-sent: #005c4b;
    --bubble-received: #202c33;
    --bubble-text: #e9edef;
    
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-title: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: #0c1317;
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.16);
    border-radius: 3px;
}
::-webkit-scrollbar-track {
    background-color: transparent;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Spinners */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-green);
    animation: spin 1s ease-in-out infinite;
}

.spinner-small {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-green);
    animation: spin 1s ease-in-out infinite;
}

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

/* ==================== LAYOUT CONTAINER ==================== */
.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    overflow: hidden;
    background-color: var(--bg-app);
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background-color: #f0f2f5;
}

.login-header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 222px;
    background-color: #00a884;
    z-index: 1;
}

.login-card-container {
    position: relative;
    z-index: 2;
    background-color: #ffffff;
    border-radius: 3px;
    width: 95%;
    max-width: 1000px;
    min-height: 580px;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,.06), 0 2px 5px 0 rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 0;
}

.login-card-header {
    padding: 25px 60px 25px 60px;
    border-bottom: none;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 38px;
    color: #00a884;
}

.logo-text {
    font-family: var(--font-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
    font-size: 16px;
    color: #54656f;
}

.login-card-body {
    padding: 20px 60px 60px 60px;
    display: flex;
    flex: 1;
    gap: 60px;
    align-items: flex-start;
}

.login-instructions {
    flex: 1.3;
    display: flex;
    flex-direction: column;
}

.login-instructions h2 {
    font-family: var(--font-primary);
    font-size: 28px;
    font-weight: 300;
    color: #41525d;
    margin-bottom: 30px;
}

.login-instructions ol {
    list-style-type: decimal;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    color: #54656f;
    font-size: 18px;
    line-height: 1.6;
}

.login-instructions ol li {
    padding-left: 5px;
}

.login-instructions ol li strong {
    color: #3b4a54;
    font-weight: 600;
}

.qr-container-box {
    flex: 0.7;
    background-color: #ffffff;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
}

.qr-status-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #54656f;
    font-size: 14px;
    text-align: center;
    min-height: 264px;
    justify-content: center;
}

.qr-status-msg .spinner {
    border: 3px solid rgba(0, 0, 0, 0.05);
    border-top-color: #00a884;
}

.qr-code-wrapper {
    position: relative;
    width: 264px;
    height: 264px;
    background-color: #ffffff;
    padding: 12px;
    border-radius: 2px;
    border: 1px solid #e9edef;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #3b4a54;
    font-weight: 500;
    gap: 10px;
    border-radius: 2px;
}

.reload-icon {
    font-size: 32px;
    color: #00a884;
    animation: spin 3s linear infinite paused;
}

.qr-overlay:hover .reload-icon {
    animation-play-state: running;
}

.pairing-badge {
    margin-top: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8696a0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pairing-badge i {
    color: #8696a0;
    font-size: 14px;
}

/* ==================== DASHBOARD SCREEN ==================== */
.dashboard-screen {
    display: flex;
}

.panel-left {
    width: 30%;
    min-width: 340px;
    max-width: 450px;
    height: 100%;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
}

.panel-header {
    height: 60px;
    background-color: var(--panel-header-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-avatar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-container img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--border-color);
}

.user-name-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.header-actions button, .chat-header-actions button, .input-actions-left button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.header-actions button:hover, .chat-header-actions button:hover, .input-actions-left button:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

/* Search Box Container */
.search-container {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    flex: 1;
    background-color: var(--search-input-bg);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 35px;
}

.search-icon {
    font-size: 14px;
    color: var(--text-secondary);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

.list-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
    user-select: none;
}

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

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

.chat-item img {
    width: 49px;
    height: 49px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    background-color: var(--border-color);
    flex-shrink: 0;
}

.chat-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Ensures text truncates inside Flex */
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.chat-item-header h4 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.chat-item-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-body p {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-item.unread .chat-item-time {
    color: var(--primary-green);
    font-weight: 600;
}

.unread-badge {
    background-color: var(--primary-green);
    color: #111b21;
    font-weight: 700;
    font-size: 12px;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 8px;
}

/* ==================== CONVERSATION PANEL (RIGHT) ==================== */
.panel-right {
    flex: 1;
    height: 100%;
    background-color: var(--chat-bg);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #222e35;
    text-align: center;
    padding: 30px;
    position: relative;
}

.empty-state-content {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-illustration {
    width: 150px;
    height: 150px;
    background-color: rgba(255,255,255,0.02);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    border: 1px solid rgba(255,255,255,0.05);
}

.illustration-icon {
    font-size: 80px;
    color: var(--text-muted);
}

.empty-state h1 {
    font-family: var(--font-title);
    font-size: 32px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.empty-state-footer {
    position: absolute;
    bottom: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Active Chat */
.active-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    height: 60px;
    background-color: var(--panel-header-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    z-index: 5;
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    min-width: 0;
}

.chat-contact-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--border-color);
}

.chat-meta {
    min-width: 0;
}

.chat-meta h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

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

/* Message Board */
.message-board {
    flex: 1;
    padding: 20px 5%;
    overflow-y: auto;
    background-color: #0b141a;
    background-image: radial-gradient(circle at top left, #121c24, #0b141a 70%);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-date-separator {
    align-self: center;
    background-color: #182229;
    padding: 6px 12px;
    border-radius: 6.5px;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* Message Bubbles */
.msg-bubble {
    max-width: 65%;
    padding: 6px 10px 8px 10px;
    border-radius: 8px;
    font-size: 14.2px;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 1px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.15s ease-out;
}

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

.msg-bubble.sent {
    align-self: flex-end;
    background-color: var(--bubble-sent);
    color: var(--bubble-text);
    border-top-right-radius: 0;
}

.msg-bubble.received {
    align-self: flex-start;
    background-color: var(--bubble-received);
    color: var(--bubble-text);
    border-top-left-radius: 0;
}

.msg-text {
    margin-bottom: 2px;
    margin-right: 50px; /* Space for the floating timestamp */
    white-space: pre-wrap;
}

.msg-meta {
    position: absolute;
    bottom: 3px;
    right: 7px;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

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

.msg-status-icon {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

.msg-bubble.sent .msg-status-icon.read {
    color: var(--accent-blue);
}

/* Chat Input Footer */
.chat-input-footer {
    height: 62px;
    background-color: var(--panel-header-bg);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 5;
}

.input-actions-left {
    display: flex;
    gap: 8px;
}

.message-form {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-form input {
    flex: 1;
    background-color: #2a3942;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    color: var(--text-primary);
    font-size: 14.5px;
    height: 42px;
    outline: none;
}

.message-form input::placeholder {
    color: var(--text-muted);
}

#btn-send-msg {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

#btn-send-msg:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary-green);
}

/* ==================== CUSTOM MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(11, 20, 26, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    background-color: #222e35;
    border-radius: 3px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

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

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    font-family: var(--font-primary);
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.modal-body p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-modal {
    border: none;
    border-radius: 3px;
    padding: 10px 24px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    outline: none;
}

.btn-cancel {
    background-color: transparent;
    color: var(--primary-green);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.btn-confirm {
    background-color: var(--primary-green);
    color: #111b21;
}

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

.btn-unlink {
    background-color: #ea4c4c;
    color: #ffffff;
}

.btn-unlink:hover {
    background-color: #d13636;
}

.modal-footer-auth {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.modal-footer-auth .btn-modal {
    width: 100%;
    text-align: center;
}

.msg-sender {
    font-size: 12.5px;
    font-weight: 600;
    color: #53bdeb;
    margin-bottom: 3px;
    display: block;
    user-select: none;
}

.history-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    width: 100%;
}

.system-msg {
    text-transform: none !important;
    background-color: rgba(24, 34, 41, 0.85) !important;
    max-width: 85%;
    text-align: center;
    color: #ffd279 !important;
    font-size: 12px !important;
    border-radius: 7px !important;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    margin: 8px auto !important;
    display: inline-block !important;
    align-self: center !important;
}

/* ==================== UNSAVED CONTACT ~NAME STYLE ==================== */
/* Real WhatsApp shows ~Name in a slightly muted color for unsaved contacts */
.unsaved-name {
    color: var(--text-primary);
    font-style: normal;
}

/* In chat header, unsaved name is shown slightly dimmer */
.header-unsaved {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Avatar wrapper — keeps image sizing consistent and allows skeleton loading */
.avatar-wrap {
    flex-shrink: 0;
    width: 49px;
    height: 49px;
    border-radius: 50%;
    margin-right: 15px;
    background-color: var(--border-color);
    overflow: hidden;
    position: relative;
}

.avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    transition: opacity 0.2s ease;
}

/* Skeleton shimmer while avatar loads */
.avatar-wrap img[src=""] {
    opacity: 0;
}

/* ==================== FILTER TABS BAR ==================== */
.filter-tabs-bar {
    display: flex;
    gap: 6px;
    padding: 8px 12px 6px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: none;
    flex-shrink: 0;
}
.filter-tabs-bar::-webkit-scrollbar { display: none; }

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}
.filter-tab i { font-size: 11px; }
.filter-tab:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.filter-tab.active {
    background: var(--primary-green);
    color: #111b21;
    border-color: var(--primary-green);
    font-weight: 600;
}

/* ==================== LABEL CHIPS (chat item) ==================== */
.label-chip {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid;
    opacity: 0.9;
    white-space: nowrap;
}

.chat-item-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chat-fav-icon {
    font-size: 11px;
    color: #ffd279;
    margin-right: 3px;
}

/* ==================== RIGHT-CLICK CONTEXT MENU ==================== */
.context-menu {
    position: fixed;
    z-index: 9999;
    background: #233138;
    border: 1px solid #304048;
    border-radius: 8px;
    min-width: 210px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: fadeIn 0.1s ease-out;
}
.ctx-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 8px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid #304048;
}
.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    position: relative;
}
.ctx-item:hover { background: rgba(255,255,255,0.07); }
.ctx-item-active { color: var(--primary-green); }
.ctx-item-active i { color: var(--primary-green); }
.ctx-item-new { color: #53bdeb; }
.ctx-item-new i { color: #53bdeb; }
.ctx-item-danger i { color: #ffd279; }
.ctx-badge {
    margin-left: auto;
    font-size: 12px;
    color: var(--primary-green);
    font-weight: 700;
}
.ctx-empty {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}
.ctx-divider {
    border-top: 1px solid #304048;
    margin: 2px 0;
}

/* ==================== LABEL MODAL ==================== */
.label-modal-card {
    max-width: 400px !important;
    padding: 0 !important;
}
.label-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.label-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.label-modal-header h3 i { color: var(--primary-green); }
.label-modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}
.label-modal-close-btn:hover { background: rgba(255,255,255,0.07); }

.label-modal-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 8px 0;
}
.label-modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}
.label-modal-item:hover { background: rgba(255,255,255,0.05); }
.label-modal-item.active { background: rgba(0,168,132,0.08); }
.label-modal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.label-modal-name { flex: 1; }
.label-check-on { color: var(--primary-green); font-size: 16px; }
.label-check-off { color: var(--text-muted); font-size: 16px; }
.label-modal-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}
.label-modal-create {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}
.label-modal-create input {
    flex: 1;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}
.label-modal-create input::placeholder { color: var(--text-muted); }
.label-modal-create button {
    background: var(--primary-green);
    color: #111b21;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
}
.label-modal-create button:hover { background: var(--primary-green-hover); }

/* ==================== SELECTION MODE ==================== */

/* Header groups */
#header-normal-actions, #header-select-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* New Category button — subtle tag color highlight */
#btn-new-category {
    color: var(--primary-green) !important;
}
#btn-new-category:hover {
    background-color: rgba(0, 168, 132, 0.12) !important;
}

.select-count-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-green);
    padding: 0 8px;
    white-space: nowrap;
}

/* Checkbox circle replacing avatar */
.select-checkbox {
    width: 49px;
    height: 49px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--search-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 15px;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}
.select-checkbox i {
    font-size: 18px;
    color: transparent;
    transition: color 0.12s;
}
.select-checkbox.checked {
    background: var(--primary-green);
    border-color: var(--primary-green);
}
.select-checkbox.checked i {
    color: #111b21;
}

/* Selected chat item highlight */
.chat-item.selecting-active {
    background-color: rgba(0, 168, 132, 0.12) !important;
}

/* Selection Action Bar — slides up from bottom */
.selection-action-bar {
    background: #1d2d36;
    border-top: 1px solid var(--border-color);
    padding: 14px 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: slideUp 0.2s ease-out;
    flex-shrink: 0;
}

.select-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}
.select-bar-info i { color: var(--primary-green); }

.select-bar-input-row {
    display: flex;
    gap: 8px;
}

.select-bar-input-row input {
    flex: 1;
    background: #2a3942;
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    font-family: var(--font-primary);
}
.select-bar-input-row input:focus {
    border-color: var(--primary-green);
}
.select-bar-input-row input.input-error {
    border-color: #e74c3c !important;
    animation: shake 0.3s ease-out;
}
.select-bar-input-row button {
    background: var(--primary-green);
    color: #111b21;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
    font-family: var(--font-primary);
}
.select-bar-input-row button:hover { background: var(--primary-green-hover); }
.select-bar-input-row button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    60%       { transform: translateX(6px); }
}

/* Toast notification */
.wa-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #233138;
    color: var(--text-primary);
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 99999;
    white-space: nowrap;
    border: 1px solid #304048;
}
.wa-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== USER AUTH PORTAL SCREEN ==================== */
.auth-portal-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background-color: #f0f2f5;
}

.auth-card-container {
    position: relative;
    z-index: 2;
    background-color: #ffffff;
    border-radius: 3px;
    width: 95%;
    max-width: 450px;
    min-height: 480px;
    box-shadow: 0 1px 1px 0 rgba(0,0,0,.06), 0 2px 5px 0 rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 30px;
    align-items: center;
}

.auth-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.auth-logo-icon {
    font-size: 55px;
    color: #00a884;
}

.auth-card-header h2 {
    font-family: var(--font-title);
    font-size: 26px;
    font-weight: 500;
    color: #41525d;
}

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.input-group label {
    font-size: 14px;
    font-weight: 600;
    color: #54656f;
}

.input-group input {
    width: 100%;
    height: 45px;
    border: 1px solid #e9edef;
    border-radius: 4px;
    padding: 10px 15px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s;
    font-family: var(--font-primary);
}

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

.btn-auth {
    width: 100%;
    height: 45px;
    background-color: #00a884;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
    font-family: var(--font-primary);
    margin-top: 10px;
}

.btn-auth:hover {
    background-color: #008f72;
}

.auth-switch {
    font-size: 14px;
    color: #54656f;
    text-align: center;
    margin-top: 15px;
}

.auth-switch span {
    color: #00a884;
    font-weight: 600;
    cursor: pointer;
}

.auth-switch span:hover {
    text-decoration: underline;
}

.auth-error-msg {
    color: #e74c3c;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}
