/* AI Sales Agent - Styles */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #1e293b;
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e8f0fe;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --gradient-green: linear-gradient(135deg, #16a34a, #22c55e);
    --gradient-blue: linear-gradient(135deg, #2563eb, #60a5fa);
    --gradient-purple: linear-gradient(135deg, #7c3aed, #a78bfa);
    --gradient-red: linear-gradient(135deg, #ef4444, #f87171);
    --bg-tertiary: #f1f5f9;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-green);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

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

.logo-text .brand {
    font-weight: 700;
    font-size: 18px;
}

.logo-text .version {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
}

.nav-menu {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 8px 12px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.connection-status {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* User Profile Sidebar Component */
.user-profile {
    transition: all 0.3s ease;
    cursor: default;
}

.user-profile:hover {
    background: var(--bg-hover) !important;
    border-color: var(--primary) !important;
}

.user-profile button {
    transition: all 0.2s;
    opacity: 0.7;
}

.user-profile button:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 26px;
    font-weight: 700;
}

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

.incoming-badge {
    background: var(--danger);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    animation: bounce 1s infinite;
}

@keyframes bounce {

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

    50% {
        transform: scale(1.05);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
}

.stat-card.gradient-green {
    background: var(--gradient-green);
    border: none;
}

.stat-card.gradient-blue {
    background: var(--gradient-blue);
    border: none;
}

.stat-card.gradient-purple {
    background: var(--gradient-purple);
    border: none;
}

.stat-card.gradient-red {
    background: var(--gradient-red);
    border: none;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
}

.stat-info p {
    font-size: 13px;
    opacity: 0.9;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* Content Sections */
.content-section {
    display: none;
    animation: fadeIn 0.3s;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* QR Section */
.qr-section {
    margin-bottom: 24px;
}

.qr-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    border: 1px solid var(--border);
}

.qr-card h2 {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qr-card h2 i {
    color: var(--primary);
}

.qr-card>p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.qr-container {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-container img {
    border-radius: 12px;
}

.qr-placeholder {
    color: var(--text-muted);
    text-align: center;
}

.qr-placeholder i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input[type="date"],
.form-group input[type="time"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

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

.input-with-btn {
    display: flex;
    gap: 10px;
}

.input-with-btn input {
    flex: 1;
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

/* Phone Mockup */
.phone-mockup {
    background: #e5ddd5;
    border-radius: 20px;
    overflow: hidden;
}

.phone-header {
    background: var(--primary-dark);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.phone-header .contact-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.phone-header .avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.phone-body {
    padding: 16px;
    min-height: 300px;
    background-size: 400px;
}

.message-bubble {
    background: #dcf8c6;
    padding: 8px 12px;
    border-radius: 8px;
    border-top-right-radius: 0;
    max-width: 85%;
    margin-left: auto;
    color: #303030;
    font-size: 14px;
}

.message-bubble .time {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
}

/* Progress */
.progress-section {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-green);
    width: 0%;
    transition: width 0.3s;
}

.progress-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.data-table tr:hover {
    background: var(--bg-hover);
}

.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Contact table specific column widths */
#contactsTable td:nth-child(1),
#contactsSection th:nth-child(1) {
    width: 40px;
}

#contactsTable td:nth-child(2),
#contactsSection th:nth-child(2) {
    width: 25%;
}

#contactsTable td:nth-child(3),
#contactsSection th:nth-child(3) {
    width: 20%;
}

#contactsTable td:nth-child(4),
#contactsSection th:nth-child(4) {
    width: 15%;
}

#contactsTable td:nth-child(5),
#contactsSection th:nth-child(5) {
    width: 120px;
}

/* Pagination */
#contactsPagination {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    margin-top: 0;
}

/* Templates Grid */
.templates-grid,
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px;
}

.template-card,
.group-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.template-card:hover,
.group-card:hover {
    border-color: var(--primary);
}

.template-card h4 {
    color: var(--primary);
    margin-bottom: 8px;
}

.template-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Activity Log */
.activity-log {
    max-height: 350px;
    overflow-y: auto;
    padding: 16px;
}

.log-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg-secondary);
    font-size: 13px;
}

.log-item.success {
    border-left: 3px solid var(--success);
}

.log-item.error {
    border-left: 3px solid var(--danger);
}

.log-item.info {
    border-left: 3px solid var(--info);
}

.log-item i {
    font-size: 14px;
}

.log-item.success i {
    color: var(--success);
}

.log-item.error i {
    color: var(--danger);
}

.log-item.info i {
    color: var(--info);
}

.log-item .msg {
    flex: 1;
}

.log-item .time {
    color: var(--text-muted);
    font-size: 11px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* Settings */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

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

.setting-item.danger {
    color: var(--danger);
}

.setting-info h4 {
    margin-bottom: 4px;
}

.setting-info p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Switch */
.switch {
    position: relative;
    width: 48px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 26px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked+.slider {
    background: var(--primary);
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalIn 0.3s;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s;
    min-width: 280px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

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

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--info);
}

.toast i {
    font-size: 18px;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.info i {
    color: var(--info);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(0, 200, 83, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(241, 92, 109, 0.15);
    color: var(--danger);
}

.badge-warning {
    background: rgba(247, 201, 75, 0.15);
    color: var(--warning);
}

.badge-info {
    background: rgba(83, 189, 235, 0.15);
    color: var(--info);
}

/* Text utilities */
.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-muted {
    color: var(--text-muted);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive */
@media (max-width: 1200px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .logo-text,
    .nav-label,
    .nav-item span,
    .connection-status span {
        display: none;
    }

    .nav-item {
        justify-content: center;
    }

    .main-content {
        margin-left: 70px;
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== PROFESSIONAL INBOX ==================== */
.wa-inbox {
    display: flex;
    height: calc(100vh - 100px);
    background: #0a0e13;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* --- Sidebar --- */
.wa-sidebar {
    width: 380px;
    min-width: 320px;
    background: linear-gradient(180deg, #0f1923 0%, #0a1118 100%);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
}

.wa-sidebar-header {
    height: 64px;
    background: rgba(32,44,51,0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.wa-profile { display: flex; align-items: center; }

.wa-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #00a884 0%, #00d4a8 100%);
    position: relative;
}

.wa-avatar.gradient-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.wa-avatar.gradient-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.wa-avatar.gradient-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.wa-avatar.gradient-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.wa-avatar.gradient-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.wa-avatar.gradient-6 { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.wa-avatar.gradient-7 { background: linear-gradient(135deg, #fccb90 0%, #d57eeb 100%); }

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

.wa-avatar i {
    font-size: 18px;
    color: rgba(255,255,255,0.85);
}

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

.wa-icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: #8696a0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.25s ease;
}

.wa-icon-btn:hover {
    background: rgba(0,168,132,0.15);
    color: #00d4a8;
    transform: scale(1.05);
}

/* --- Filter Tabs --- */
.wa-filter-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(15,25,35,0.5);
}

.wa-filter-tab {
    padding: 5px 14px;
    border-radius: 20px;
    border: none;
    background: rgba(255,255,255,0.05);
    color: #8696a0;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.wa-filter-tab:hover {
    background: rgba(0,168,132,0.12);
    color: #00d4a8;
}

.wa-filter-tab.active {
    background: linear-gradient(135deg, #00a884 0%, #00d4a8 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,168,132,0.4);
}

/* --- Search --- */
.wa-search {
    padding: 8px 14px;
    background: transparent;
}

.wa-search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 0 14px;
    height: 38px;
    transition: border-color 0.3s ease;
}

.wa-search-box:focus-within {
    border-color: rgba(0,168,132,0.4);
    background: rgba(0,168,132,0.04);
}

.wa-search-box i {
    color: #5a6b75;
    font-size: 14px;
    margin-right: 12px;
    transition: color 0.3s;
}

.wa-search-box:focus-within i { color: #00a884; }

.wa-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: #e9edef;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
}

.wa-search-box input::placeholder { color: #5a6b75; }

/* --- Chat List --- */
.wa-chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.wa-chat-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    margin: 1px 6px;
    border-radius: 10px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.wa-chat-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.04);
}

.wa-chat-item.active {
    background: rgba(0,168,132,0.1);
    border-color: rgba(0,168,132,0.2);
}

.wa-chat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    background: linear-gradient(180deg, #00a884, #00d4a8);
    border-radius: 0 3px 3px 0;
}

.wa-chat-item .wa-avatar {
    width: 48px;
    height: 48px;
    margin-right: 12px;
    font-size: 16px;
}

.wa-chat-content { flex: 1; min-width: 0; }

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

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

.wa-chat-time {
    font-size: 11.5px;
    color: #5a6b75;
    flex-shrink: 0;
    margin-left: 8px;
}

.wa-chat-item.active .wa-chat-time,
.wa-chat-item:has(.wa-unread) .wa-chat-time {
    color: #00d4a8;
}

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

.wa-chat-preview {
    font-size: 13px;
    color: #6b7c85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    line-height: 1.3;
}

.wa-unread {
    background: linear-gradient(135deg, #00a884 0%, #00d4a8 100%);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    margin-left: 8px;
    box-shadow: 0 2px 6px rgba(0,168,132,0.35);
}

/* --- Main Chat Area --- */
.wa-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #060b10;
}

.wa-chat-header {
    height: 64px;
    background: rgba(32,44,51,0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.wa-chat-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wa-chat-details h4 {
    font-size: 16px;
    color: #e9edef;
    font-weight: 600;
    margin: 0;
}

.wa-chat-details span {
    font-size: 12.5px;
    color: #5a6b75;
}

.wa-chat-details .typing-indicator {
    color: #00d4a8;
    font-style: italic;
}

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

/* --- Messages Area --- */
.wa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 48px;
    background-color: #060b10;
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(0,168,132,0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(66,133,244,0.02) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='dots' patternUnits='userSpaceOnUse' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='0.5' fill='%23ffffff08'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23dots)' width='100%25' height='100%25'/%3E%3C/svg%3E");
    position: relative;
}

/* --- Welcome Screen --- */
.wa-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #5a6b75;
    position: relative;
    z-index: 1;
}

.wa-welcome h2 {
    color: #e9edef;
    font-weight: 300;
    font-size: 28px;
    margin: 20px 0 10px;
    background: linear-gradient(135deg, #e9edef 0%, #8696a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wa-welcome p { font-size: 14px; color: #5a6b75; }

.wa-welcome img { filter: grayscale(1) brightness(0.5); opacity: 0.6; }

/* --- Message Bubbles --- */
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.wa-msg {
    display: flex;
    margin-bottom: 3px;
    position: relative;
    z-index: 10;
    animation: msgSlideIn 0.25s ease-out;
}

.wa-msg.out { justify-content: flex-end; }
.wa-msg.in { justify-content: flex-start; }

.wa-msg-bubble {
    max-width: 60%;
    padding: 7px 9px 8px 10px;
    border-radius: 12px;
    position: relative;
    z-index: 10;
}

.wa-msg.out .wa-msg-bubble {
    background: linear-gradient(135deg, #005c4b 0%, #00503f 100%);
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,92,75,0.3);
}

.wa-msg.in .wa-msg-bubble {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.05);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.wa-msg-author {
    font-size: 12px;
    font-weight: 600;
    color: #00d4a8;
    margin-bottom: 2px;
}

.wa-msg-text {
    font-size: 14px;
    color: #e9edef;
    line-height: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.wa-msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    margin-left: 10px;
    float: right;
}

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

.wa-msg-status {
    font-size: 13px;
    color: #53bdeb;
}

/* Date separator inside messages */
.wa-date-separator {
    display: flex;
    justify-content: center;
    margin: 16px 0;
    position: relative;
    z-index: 10;
}

.wa-date-separator span {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.05);
    color: #8696a0;
    padding: 4px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

/* --- Input Area --- */
.wa-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(32,44,51,0.7);
    backdrop-filter: blur(12px);
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.wa-input-box {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 10px 14px;
    transition: all 0.3s ease;
}

.wa-input-box:focus-within {
    border-color: rgba(0,168,132,0.3);
    background: rgba(0,168,132,0.04);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.08);
}

.wa-input-box input {
    width: 100%;
    border: none;
    background: transparent;
    color: #e9edef;
    font-size: 14.5px;
    outline: none;
    font-family: inherit;
}

.wa-input-box input::placeholder { color: #5a6b75; }

.wa-send-btn {
    color: #5a6b75;
    transition: all 0.3s ease;
}

.wa-send-btn:hover {
    color: #fff;
    background: linear-gradient(135deg, #00a884 0%, #00d4a8 100%);
    box-shadow: 0 2px 12px rgba(0,168,132,0.4);
    transform: scale(1.1);
}

/* --- Empty State --- */
.wa-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #5a6b75;
    text-align: center;
    padding: 20px;
}

.wa-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
    background: linear-gradient(135deg, #00a884, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wa-empty p {
    font-size: 14px;
    max-width: 240px;
    line-height: 1.5;
}

/* --- Scrollbar --- */
.wa-chat-list::-webkit-scrollbar,
.wa-messages::-webkit-scrollbar {
    width: 5px;
}

.wa-chat-list::-webkit-scrollbar-track,
.wa-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wa-chat-list::-webkit-scrollbar-thumb,
.wa-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.wa-chat-list::-webkit-scrollbar-thumb:hover,
.wa-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,168,132,0.3);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .wa-sidebar { width: 280px; min-width: 240px; }
    .wa-messages { padding: 16px 20px; }
    .wa-msg-bubble { max-width: 80%; }
}

@media (max-width: 600px) {
    .wa-inbox { flex-direction: column; border-radius: 0; }
    .wa-sidebar { width: 100%; min-width: unset; height: 50%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
    .wa-messages { padding: 12px; }
}

:root {
    --primary-alpha: rgba(0, 168, 132, 0.15);
}

/* ==================== VOICE AI SECTION ==================== */
.vai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: var(--text-muted);
}

.vai-status-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0,200,83,0.4);
    animation: vaiPulse 2s infinite;
}

@keyframes vaiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.vai-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.vai-info-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.vai-info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.vai-info-item > div:last-child {
    font-size: 14px;
    font-weight: 500;
}

/* Call list items */
.vai-call-item {
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    border: 1px solid transparent;
}

.vai-call-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.vai-call-item.active {
    background: var(--primary-alpha);
    border-color: rgba(0,168,132,0.3);
}

.vai-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.vai-call-name {
    font-size: 14px;
    font-weight: 600;
}

.vai-call-time {
    font-size: 12px;
    color: var(--text-muted);
}

.vai-call-phone {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.vai-call-summary {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vai-call-badges {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.vai-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.vai-badge.duration {
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
}

.vai-badge.status {
    background: rgba(0,200,83,0.12);
    color: var(--success);
}

.vai-badge.direction {
    background: rgba(59,130,246,0.12);
    color: #3b82f6;
}

/* Transcript bubbles */
.vai-transcript-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.vai-transcript-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.vai-transcript-avatar.ai {
    background: rgba(0,168,132,0.15);
}

.vai-transcript-avatar.user {
    background: rgba(59,130,246,0.15);
}

.vai-transcript-bubble {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.vai-transcript-bubble.ai {
    background: rgba(0,168,132,0.06);
    border: 1px solid rgba(0,168,132,0.12);
}

.vai-transcript-bubble.user {
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.12);
}

.vai-transcript-role {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Setup results */
.vai-setup-step {
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-bottom: 6px;
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.5;
}

.vai-setup-step.success {
    border-color: rgba(0,200,83,0.2);
    background: rgba(0,200,83,0.05);
}

.vai-setup-step.error {
    border-color: rgba(239,68,68,0.2);
    background: rgba(239,68,68,0.05);
}

/* Booking status badges */
.bk-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.bk-status.pending { background: rgba(245,158,11,0.12); color: #f59e0b; }
.bk-status.confirmed { background: rgba(34,197,94,0.12); color: #22c55e; }
.bk-status.completed { background: rgba(59,130,246,0.12); color: #3b82f6; }
.bk-status.cancelled { background: rgba(239,68,68,0.12); color: #ef4444; }

.btn-group { display: flex; gap: 4px; }
.btn-group .btn.active { background: var(--primary); color: white; border-color: var(--primary); }