/* =====================================================
   WAHA Mobile PWA - Midnight Glass Theme (2026)
   Aesthetic: Deep Space, Neon, Glassmorphism
   ===================================================== */

/* 1. Design Tokens & Variables */
:root {
    /* WhatsApp Dark Mode Palette */
    --wa-bg: #0b141a;
    --wa-surface: #111b21;
    --wa-header: #202c33;
    --wa-nav: #111b21;
    --wa-green: #00a884;
    --wa-teal: #005c4b;
    --wa-blue: #34b7f1;
    --wa-white: #e9edef;
    --wa-grey: #8696a0;
    --wa-grey-muted: #667781;
    --wa-border: rgba(134, 150, 160, 0.15);

    /* Functional Colors */
    --success: #00a884;
    --warning: #ffd279;
    --error: #f15c6d;

    /* Text */
    --text-primary: var(--wa-white);
    --text-secondary: var(--wa-grey);
    --text-muted: var(--wa-grey-muted);

    /* Layout */
    --header-height: 60px;
    --nav-height: 65px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;

    /* Animation */
    --transition: 0.2s ease-out;
}

/* 2. Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--wa-bg);
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    user-select: none;
}

/* Header (WhatsApp Flat Style) */
.header {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    height: var(--header-height);
    background: rgba(32, 44, 51, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.header-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--wa-white);
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.header-title:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Double arrow fix: Removed ::after */

.header-title.open::after {
    transform: rotate(180deg);
}

/* Custom Session Dropdown */
.session-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    display: none;
}

.session-dropdown-menu {
    position: fixed;
    top: 60px;
    left: 16px;
    background: var(--wa-surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 280px;
    padding: 8px 0;
    z-index: 1002;
    transform-origin: top left;
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.session-dropdown-menu.active {
    display: block;
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.session-dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.session-dropdown-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.session-dropdown-item.selected {
    background: rgba(0, 168, 132, 0.1);
}

.session-dropdown-item .check-icon {
    margin-left: auto;
    color: var(--wa-green);
    opacity: 0;
}

.session-dropdown-item.selected .check-icon {
    opacity: 1;
}

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

.header-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--wa-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

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

.header-icon-btn svg {
    width: 22px;
    height: 22px;
}

/* Main Content Area */
/* Main Content Area */
.main-content {
    flex: 1;
    padding-top: calc(var(--header-height) + 24px);
    margin-top: 0;
    padding-bottom: calc(var(--nav-height) + 40px); /* Extra space for floating footer */
    overflow-y: auto;
    background: var(--wa-bg);
}

/* Bottom Navigation (Floating Island Style) */
.bottom-nav {
    position: fixed;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    height: 64px; /* Slightly taller for floating look */
    background: rgba(32, 44, 51, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05); /* Subtle border */
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1001;
    /* padding-bottom removed as it's floating */
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--wa-grey);
    cursor: pointer;
    position: relative;
    padding-top: 0; /* Centered */
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.nav-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-btn.active {
    color: var(--wa-white);
}

.nav-btn.active::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 36px;
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.3), rgba(0, 168, 132, 0.1));
    border: 1px solid rgba(0, 168, 132, 0.3);
    box-shadow: 0 0 15px rgba(0, 168, 132, 0.2);
    border-radius: 18px;
    z-index: -1;
    margin-top: -8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn.active svg {
    color: #fff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

/* 6. Cards & Containers */
/* WhatsApp Row Item (List Style) */
.card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 12px 16px;
    margin-bottom: 0;
    box-shadow: none;
    transition: background 0.2s;
    cursor: pointer;
    border-bottom: 1px solid var(--wa-border);
}

.card:active {
    background: rgba(255, 255, 255, 0.05);
}

/* 7. Session Cards */
.session-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.session-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.3);
}

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

.session-info {
    flex: 1;
}

/* Page Section Header (WhatsApp Style) */
.page-section-header {
    padding: 16px;
    border-bottom: 1px solid var(--wa-border);
}

.page-section-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--wa-white);
    margin-bottom: 4px;
}

.page-section-header p {
    font-size: 0.85rem;
    color: var(--wa-grey);
}

.linked-devices-page {
    padding: 0;
}

.linked-devices-page .mb-4 {
    padding: 16px;
}

.session-name {
    font-weight: 500;
    font-size: 1rem;
    color: var(--wa-white);
}

.session-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.status-working {
    background: rgba(0, 168, 132, 0.15);
    color: var(--wa-green);
}

.status-stopped {
    background: rgba(134, 150, 160, 0.15);
    color: var(--wa-grey);
}

.status-scan_qr_code, .status-starting {
    background: rgba(255, 210, 121, 0.15);
    color: var(--warning);
}

/* 8. Buttons */
/* Standard WhatsApp Buttons */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--wa-green);
    color: var(--wa-bg);
}

.btn-primary:active {
    background: #008f6f;
}

.btn-secondary {
    background: var(--wa-header);
    color: var(--wa-white);
    border: 1px solid var(--wa-border);
}

.btn-secondary:active {
    background: #2a3942;
}

.btn-icon {
    border-radius: 50%;
    padding: 0;
    width: 36px;
    height: 36px;
}

/* Status Indicators (WhatsApp Updates Style) */
.session-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 4px;
    display: inline-block;
}

.status-working {
    color: var(--wa-green);
    background: rgba(0, 168, 132, 0.1);
}

.status-scan_qr_code {
    color: var(--warning);
    background: rgba(255, 210, 121, 0.1);
}

.status-stopped {
    color: var(--wa-grey);
    background: rgba(134, 150, 160, 0.1);
}

/* 9. Inputs */
.settings-input {
    width: 100%;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.settings-input:focus {
    border-color: #4facfe;
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.settings-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
    display: block;
    margin-left: 4px;
}

/* 10. Modals (WhatsApp Style) */
/* 10. Modals (Popup Style) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 20, 26, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none; /* Keep display toggling for JS compatibility but use opacity for anim */
}

/* When not hidden, override opacity/pointer-events */
.modal:not(.hidden) {
    display: flex; /* Ensure flex is active */
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--wa-header);
    border: 1px solid var(--wa-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 360px;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    border-bottom: 1px solid var(--wa-border);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--wa-white);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--wa-grey);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.modal-header {
    border-bottom: 1px solid var(--wa-border);
    padding: 20px;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 500;
}

.qr-container {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 20px;
}

/* Connection Method Tabs */
.connection-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--wa-border);
}

.connection-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 20px;
    color: var(--wa-grey);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.connection-tab.active {
    background: var(--wa-green);
    color: var(--wa-bg);
}

.connection-tab:hover:not(.active) {
    background: rgba(134, 150, 160, 0.1);
}

/* --- Broadcast UI & Contact Picker --- */
.broadcast-card {
    background: rgba(30,30,30,0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.broadcast-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--wa-teal);
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-action-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.contact-picker-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: flex-end; /* Bottom sheet on mobile */
}

.contact-picker-modal {
    background: #1e1e1e;
    width: 100%;
    max-width: 500px;
    height: 80vh;
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid rgba(255,255,255,0.1);
}

@media (min-width: 768px) {
    .contact-picker-overlay { align-items: center; }
    .contact-picker-modal { height: 70vh; border-radius: 20px; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.contact-item:hover { background: rgba(255,255,255,0.05); }
.contact-item.selected { background: rgba(0, 168, 132, 0.1); }

.contact-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
    color: #888;
    overflow: hidden;
}

.contact-info { flex: 1; }
.contact-name { font-weight: 500; color: var(--text-primary); }
.contact-number { font-size: 0.8rem; color: var(--text-secondary); }

.contact-checkbox {
    width: 20px; height: 20px;
    border: 2px solid #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.contact-item.selected .contact-checkbox {
    background: var(--wa-green);
    border-color: var(--wa-green);
}

.contact-item.selected .contact-checkbox::after {
    content: '✓'; color: white; font-size: 14px;
}

/* Glass Inputs */
.glass-area {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    color: white;
    padding: 12px;
    font-family: inherit;
    resize: none;
}
.glass-area:focus { outline: none; border-color: var(--wa-teal); }

/* 11. Toast (Simple & Flat) */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--wa-header);
    color: var(--wa-white);
    border: 1px solid var(--wa-border);
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    text-align: center;
    backdrop-filter: blur(10px);
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    display: block !important; /* Override generic hidden */
    pointer-events: none;
}

.toast.success { background: var(--wa-green); }
.toast.error { background: var(--error); }

/* Chat List Layout (WhatsApp Style) */
.chat-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
}

.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-row-top, .chat-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-time.active {
    color: var(--success);
    font-weight: 500;
}

/* Group Label Badge */
.group-label {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--wa-grey);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
}

/* Unified Avatar Style (Official Circle) */
.chat-avatar, .session-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3d4a52; /* Default Avatar Gray */
    color: var(--wa-grey);
}

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

.chat-badge {
    background: var(--wa-green);
    color: var(--wa-bg);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* 12. Chat Elements (WhatsApp Style) */

/* Messages Page Layout */
.messages-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--nav-height) - 48px);
    overflow: hidden;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--wa-header);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--wa-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.page-title h2 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--wa-white);
}

.page-title p {
    font-size: 0.75rem;
    color: var(--wa-grey);
}

/* Messages Container (With Wallpaper) */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 80px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: var(--wa-bg);
    background-image: 
        linear-gradient(rgba(11, 20, 26, 0.94), rgba(11, 20, 26, 0.94)),
        url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); /* Classic WA Wallpaper */
    background-blend-mode: overlay;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}
.messages-container::-webkit-scrollbar-thumb {
    background: rgba(134, 150, 160, 0.2);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
    margin-bottom: 2px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.message-sent {
    align-self: flex-end;
    background: #005c4b; /* WhatsApp Dark Green */
    color: #e9edef;
    border-top-right-radius: 0;
}

.message-sent::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 10px solid #005c4b;
    border-top: 10px solid transparent;
    border-bottom: 0 solid transparent;
}

.message-received {
    align-self: flex-start;
    background: #202c33; /* WhatsApp Dark Grey */
    color: #e9edef;
    border-top-left-radius: 0;
}

.message-received::after {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 10px solid #202c33;
    border-top: 10px solid transparent;
    border-bottom: 0 solid transparent;
}

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

.message-time {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: right;
    margin-top: 2px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.message-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--wa-header);
    border-top: 1px solid var(--wa-border);
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.message-input {
    flex: 1;
    padding: 10px 16px;
    background: #2a3942;
    border: none;
    border-radius: 20px;
    color: var(--wa-white);
    font-size: 0.95rem;
    outline: none;
}

.message-input::placeholder {
    color: var(--wa-grey);
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--wa-green);
    color: #0b141a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

/* 13. Loading Overlay & Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 168, 132, 0.15);
    border-top-color: var(--wa-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto; /* Center spinner */
}

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

/* Utilities */
.hidden {
    display: none !important;
}
.mb-4 {
    margin-bottom: 24px;
}
.mt-4 {
    margin-top: 24px;
}
/* Chat List Enhancements */
.chat-item {
    position: relative;
    border-bottom: 0.5px solid var(--wa-border);
    padding: 12px 16px;
}

.chat-item:active {
    background-color: rgba(255, 255, 255, 0.03);
}

.chat-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--wa-green);
    color: #111b21;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Colorful Avatars */
.chat-avatar-text {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--avatar-color, #667781), #444);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: 50%;
}

.session-select-container {
    display: none; /* Hide old selector */
}
.group-label {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--wa-border);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
/* Premium Settings List Style */
.settings-section-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 16px 8px 16px;
    font-weight: 500;
}

.settings-list {
    background: rgba(32, 44, 51, 0.6);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--wa-border);
    border-bottom: 1px solid var(--wa-border);
}

.settings-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wa-border);
    gap: 12px;
}

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

.settings-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wa-green);
}

.settings-row-content {
    flex: 1;
}

.settings-row-title {
    font-size: 1rem;
    color: var(--text-primary);
    display: block;
}

.settings-row-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.glass-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
    outline: none;
    padding: 4px 0;
}

.glass-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}
/* Broadcast Nav Icon */
/* Adding styles for log if needed, mostly inline used for simplicity in component */
/* Helper colors for broadcast logs */
:root {
    --success: #25d366;
    --error: #f15c6d;
    --text-muted: #8696a0;
}

/* Contact Picker Modal - Fixed Layout */
.contact-picker-modal {
    background: #1f2c34;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh; /* Ensure it fits on screen */
    overflow: hidden; /* Prevent modal itself from scrolling */
}

/* Ensure the contact list takes available space and scrolls internally */
.contact-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    min-height: 200px; /* Minimum height */
}

/* Footer should sit at the bottom */
.contact-picker-footer {
    padding: 16px; 
    border-top: 1px solid rgba(255,255,255,0.1); 
    display: flex; 
    gap: 10px;
    background: #1f2c34; /* Ensure it's opaque */
    z-index: 10;
}

/* Other Contact Styles */
.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.contact-item:hover {
    background: rgba(255,255,255,0.05);
}

.contact-item.selected {
    background: rgba(0, 168, 132, 0.1);
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    overflow: hidden;
}
.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

.contact-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
}

.contact-item.selected .contact-checkbox {
    background: var(--wa-green);
    border-color: var(--wa-green);
    color: #000;
} 
/* End Contact Picker Styles */

/* Force Overlay to be on top of everything (z-index 9999) and centered */
.contact-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none; /* Toggled by JS */
    justify-content: center;
    align-items: center;
    z-index: 9999 !important; /* Force on top of footer (z-index 1000) */
    padding-bottom: 50px; /* Slight offset to move it up a bit if needed */
}
/* Skeleton UI */
.skeleton-item {
    pointer-events: none;
}

.skeleton-avatar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.skeleton-text {
    background: rgba(255, 255, 255, 0.05);
    height: 16px;
    border-radius: 4px;
}

.skeleton-avatar, .skeleton-text {
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

@keyframes skeleton-pulse {
    0% { opacity: 0.3; }
    50% { opacity: 0.6; }
    100% { opacity: 0.3; }
}
