/* EF WA CRM - WhatsApp-Style Dark Mode Design */
:root {
    --primary-color: #00a884;
    --primary-dark: #008f72;
    --primary-light: #25d366;
    --surface-color: #242626;
    --surface-dark: #1e1e1e;
    --surface-light: #3b4147;
    --background-color: #0b141a;
    --background-secondary: #1e1e1e;
    --border-color: #333335;
    --border-light: #242626;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    --accent-color: #54656f;
    --success-color: #25d366;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.3);
}

.ef-wa-crm-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background-color);
    max-width: 100%;
    margin: 0 auto;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.ef-wa-crm-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    height: 60px;
    box-sizing: border-box;
}

.ef-wa-crm-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ef-wa-crm-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.ef-wa-crm-logo h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-studio-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.ef-wa-crm-studio-id {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    background: var(--background-color);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

/* Navigation - Hidden for WhatsApp style */
.ef-wa-crm-nav {
    display: none;
}

/* Main Content Area - WhatsApp Split Layout */
.ef-wa-crm-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--background-color);
}

/* Left Sidebar - Contact List */
.ef-wa-crm-sidebar {
    width: 30%;
    min-width: 300px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ef-wa-crm-sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
    flex-shrink: 0;
}

.ef-wa-crm-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.ef-wa-crm-sidebar-search {
    position: relative;
    margin-bottom: 10px;
}

.ef-wa-crm-sidebar-search input {
    width: 100%;
    padding: 8px 35px 8px 12px;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.ef-wa-crm-sidebar-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--surface-light);
}

.ef-wa-crm-sidebar-search::after {
    content: '🔍';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.ef-wa-crm-sidebar-stats {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.ef-wa-crm-sidebar-stat {
    flex: 1;
    background: var(--surface-dark);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border-color);
}

.ef-wa-crm-sidebar-stat-number {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.ef-wa-crm-sidebar-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ef-wa-crm-sidebar-contacts {
    flex: 1;
    overflow-y: auto;
    background: var(--surface-color);
}

/* Right Panel - Details */
.ef-wa-crm-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background-secondary);
    overflow: hidden;
}

.ef-wa-crm-main-panel-header {
    padding: 15px 20px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ef-wa-crm-main-panel-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ef-wa-crm-main-panel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.ef-wa-crm-main-panel-details h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-main-panel-details p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.ef-wa-crm-main-panel-actions {
    display: flex;
    gap: 10px;
}

.ef-wa-crm-main-panel-action {
    padding: 8px 12px;
    background: var(--surface-dark);
    border: 1px solid #333333;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.ef-wa-crm-main-panel-action:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.ef-wa-crm-main-panel-action.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.ef-wa-crm-main-panel-content {
    flex: 1;
    overflow-y: auto;
    background: var(--background-secondary);
}

/* Welcome/Empty State */
.ef-wa-crm-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.ef-wa-crm-welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.ef-wa-crm-welcome-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.ef-wa-crm-welcome-text {
    font-size: 14px;
    line-height: 1.4;
    max-width: 400px;
}

/* Contact Info View */
.ef-wa-crm-contact-info-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--background-secondary);
}

.ef-wa-crm-contact-info-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.ef-wa-crm-contact-info-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    border: 1px solid #333335;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-md);
}

.ef-wa-crm-contact-info-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ef-wa-crm-contact-info-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 32px;
    flex-shrink: 0;
}

.ef-wa-crm-contact-info-details h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-contact-info-details p {
    margin: 4px 0;
    font-size: 14px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* KPI Section */
.ef-wa-crm-contact-kpis {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ef-wa-crm-contact-kpis h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ef-wa-crm-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.ef-wa-crm-kpi-item {
    background: var(--surface-dark);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ef-wa-crm-kpi-item.success {
    border-color: var(--success-color);
    background: rgba(37, 211, 102, 0.1);
}

.ef-wa-crm-kpi-item.pending {
    border-color: var(--warning-color);
    background: rgba(243, 156, 18, 0.1);
}

.ef-wa-crm-kpi-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ef-wa-crm-kpi-icon {
    font-size: 24px;
    opacity: 0.8;
    flex-shrink: 0;
}

.ef-wa-crm-kpi-title {
    flex: 1;
}

.ef-wa-crm-kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ef-wa-crm-kpi-status {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.ef-wa-crm-kpi-item.success .ef-wa-crm-kpi-status {
    color: var(--success-color);
}

.ef-wa-crm-kpi-item.pending .ef-wa-crm-kpi-status {
    color: var(--warning-color);
}

/* KPI Scoring Integration */
.ef-wa-crm-kpi-scoring {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.ef-wa-crm-kpi-score-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ef-wa-crm-kpi-score-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.ef-wa-crm-kpi-score-value::after {
    content: '%';
    font-size: 12px;
    color: var(--text-muted);
}

.ef-wa-crm-kpi-score-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.ef-wa-crm-kpi-score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--error-color) 0%, var(--warning-color) 50%, var(--success-color) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

/* High Score Styling */
.ef-wa-crm-kpi-item.high-score .ef-wa-crm-kpi-score-value {
    color: var(--success-color);
}

.ef-wa-crm-kpi-item.medium-score .ef-wa-crm-kpi-score-value {
    color: var(--warning-color);
}

.ef-wa-crm-kpi-item.low-score .ef-wa-crm-kpi-score-value {
    color: var(--error-color);
}

.ef-wa-crm-contact-info-stats {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ef-wa-crm-contact-info-stats h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.ef-wa-crm-info-stat {
    background: var(--surface-dark);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
}

.ef-wa-crm-info-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.ef-wa-crm-info-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    word-wrap: break-word;
    line-height: 1.3;
}

/* Scoring Details Section */
.ef-wa-crm-contact-scoring {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ef-wa-crm-contact-scoring h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-scoring-info {
    background: var(--surface-dark);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ef-wa-crm-scoring-detail {
    margin-bottom: 12px;
}

.ef-wa-crm-scoring-detail:last-child {
    margin-bottom: 0;
}

.ef-wa-crm-scoring-detail-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.ef-wa-crm-scoring-detail-value {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Customer Insights */
.ef-wa-crm-customer-insights {
    margin-bottom: 30px;
}

.ef-wa-crm-customer-insights h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-insights-content {
    background: var(--surface-dark);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ef-wa-crm-insight-item {
    margin-bottom: 16px;
}

.ef-wa-crm-insight-item:last-child {
    margin-bottom: 0;
}

.ef-wa-crm-insight-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ef-wa-crm-insight-value {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 8px 12px;
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.ef-wa-crm-contact-info-actions {
    display: flex;
    gap: 15px;
}

.ef-wa-crm-info-action-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ef-wa-crm-info-action-btn.primary {
    background: var(--primary-color);
    color: white;
}

.ef-wa-crm-info-action-btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.ef-wa-crm-info-action-btn.secondary {
    background: var(--surface-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.ef-wa-crm-info-action-btn.secondary:hover {
    background: var(--surface-light);
    transform: translateY(-1px);
}

/* Loading & Error States */
.ef-wa-crm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.ef-wa-crm-loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: ef-wa-crm-spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes ef-wa-crm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ef-wa-crm-loading-text {
    font-size: 14px;
    font-weight: 500;
}

.ef-wa-crm-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.ef-wa-crm-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ef-wa-crm-error-text {
    font-size: 16px;
    margin-bottom: 20px;
}

.ef-wa-crm-retry-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.ef-wa-crm-retry-btn:hover {
    background: var(--primary-dark);
}

/* Stats Grid - hidden in WhatsApp mode (moved to sidebar) */
.ef-wa-crm-stats {
    display: none;
}

/* Filters - hidden in WhatsApp mode (moved to sidebar) */
.ef-wa-crm-filters {
    display: none;
}

/* View Toggle - hidden in WhatsApp mode */
.ef-wa-crm-view-toggle {
    display: none;
}

/* WhatsApp-Style Contact List */
.ef-wa-crm-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-color);
    gap: 12px;
}

.ef-wa-crm-contact-item:hover {
    background: var(--surface-light);
}

.ef-wa-crm-contact-item.active {
    background: var(--surface-light);
    border-right: 3px solid var(--primary-color);
}

/* Special highlighting for high-value contacts */
.ef-wa-crm-contact-item:has(.ef-wa-crm-contact-badge.contract) {
    border-left: 2px solid var(--success-color);
}

.ef-wa-crm-contact-item:has(.ef-wa-crm-contact-badge.trial) {
    border-left: 2px solid #3498db;
}

.ef-wa-crm-contact-item:last-child {
    border-bottom: none;
}

.ef-wa-crm-contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.ef-wa-crm-contact-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.ef-wa-crm-contact-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.ef-wa-crm-contact-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ef-wa-crm-contact-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.ef-wa-crm-contact-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ef-wa-crm-contact-status {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-weight: 500;
}

/* Enhanced status colors */
.ef-wa-crm-contact-item:has(.ef-wa-crm-contact-badge.contract) .ef-wa-crm-contact-status {
    color: var(--success-color);
    font-weight: 600;
}

.ef-wa-crm-contact-item:has(.ef-wa-crm-contact-badge.trial) .ef-wa-crm-contact-status {
    color: #3498db;
    font-weight: 600;
}

.ef-wa-crm-contact-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
    align-items: center;
}

.ef-wa-crm-contact-badge {
    color: white;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Priority badges */
.ef-wa-crm-contact-badge.contract {
    background: var(--success-color);
    font-size: 12px;
    animation: ef-wa-crm-pulse-success 2s infinite;
}

.ef-wa-crm-contact-badge.trial {
    background: #3498db;
    font-size: 12px;
    animation: ef-wa-crm-pulse-info 2s infinite;
}

/* Pipeline badges */
.ef-wa-crm-contact-badge.pipeline {
    background: var(--accent-color);
    font-size: 10px;
    padding: 2px 5px;
}

.ef-wa-crm-contact-badge.hot {
    background: var(--warning-color);
    animation: ef-wa-crm-pulse-warning 2s infinite;
}

.ef-wa-crm-contact-badge.converted {
    background: var(--success-color);
}

/* Specific pipeline status colors */
.ef-wa-crm-contact-badge.pipeline.converted {
    background: var(--success-color);
}

.ef-wa-crm-contact-badge.pipeline.trial {
    background: #3498db;
}

.ef-wa-crm-contact-badge.pipeline.warm {
    background: var(--warning-color);
}

.ef-wa-crm-contact-badge.pipeline.cold {
    background: var(--error-color);
}

.ef-wa-crm-contact-badge.pipeline.new {
    background: var(--text-muted);
}

/* Pulse animations for important badges */
@keyframes ef-wa-crm-pulse-success {
    0%, 100% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 4px rgba(37, 211, 102, 0);
    }
}

@keyframes ef-wa-crm-pulse-info {
    0%, 100% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    50% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 4px rgba(52, 152, 219, 0);
    }
}

@keyframes ef-wa-crm-pulse-warning {
    0%, 100% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 0 rgba(243, 156, 18, 0.7);
    }
    50% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 4px rgba(243, 156, 18, 0);
    }
}

/* Legacy grid styles - hidden in WhatsApp mode */
.ef-wa-crm-contacts-grid {
    display: none;
}

/* Legacy contact header styles - hidden in WhatsApp mode */
.ef-wa-crm-contact-header,
.ef-wa-crm-contact-body {
    display: none;
}



/* Legacy pipeline badge styles - replaced by contact badges */
.ef-wa-crm-pipeline-badge {
    display: none;
}

/* Legacy list view elements - hidden in WhatsApp mode */
.ef-wa-crm-list-scores,
.ef-wa-crm-list-meta,
.ef-wa-crm-list-actions {
    display: none;
}

/* Legacy score and meta styles - hidden in WhatsApp mode */
.ef-wa-crm-contact-scores,
.ef-wa-crm-score-item,
.ef-wa-crm-contact-meta,
.ef-wa-crm-contact-actions {
    display: none;
}

.ef-wa-crm-action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    line-height: 32px;
    text-align: center;
}

.ef-wa-crm-action-btn:hover {
    border-color: var(--primary-color);
    background: rgba(175, 202, 11, 0.1);
}

.ef-wa-crm-action-icon {
    font-size: 16px;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    line-height: 1;
}

/* Legacy table styles - hidden in WhatsApp mode */
.ef-wa-crm-contacts-table-container {
    display: none;
}

/* Messages View - WhatsApp Style */
.ef-wa-crm-messages-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--background-secondary);
}

.ef-wa-crm-messages-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ef-wa-crm-messages-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.ef-wa-crm-messages-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ef-wa-crm-messages-header-info p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* Legacy view header - hidden */
.ef-wa-crm-view-header {
    display: none;
}

.ef-wa-crm-back-btn {
    display: none;
}

.ef-wa-crm-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--background-secondary);
    /* Fixed height to prevent page scrolling */
    height: calc(100vh - 180px); /* Subtract header heights */
    max-height: calc(100vh - 180px);
    min-height: 400px;
}

.ef-wa-crm-message-item {
    display: flex;
    margin: 0;
}

.ef-wa-crm-message-item[data-direction="inbound"] {
    justify-content: flex-start;
}

.ef-wa-crm-message-item[data-direction="outbound"] {
    justify-content: flex-end;
}

.ef-wa-crm-message-content {
    max-width: 75%;
    position: relative;
    word-wrap: break-word;
}

.ef-wa-crm-message-item[data-direction="inbound"] .ef-wa-crm-message-content {
    background: var(--surface-color);
    color: var(--text-primary);
    border-radius: 12px 12px 12px 2px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

.ef-wa-crm-message-item[data-direction="outbound"] .ef-wa-crm-message-content {
    background: var(--primary-color);
    color: white;
    border-radius: 12px 12px 2px 12px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    position: relative;
}

.ef-wa-crm-message-item[data-direction="inbound"] .ef-wa-crm-message-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -6px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-right-color: var(--surface-color);
    border-bottom-color: var(--surface-color);
    border-left: none;
    border-top: none;
}

.ef-wa-crm-message-item[data-direction="outbound"] .ef-wa-crm-message-content::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -6px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-left-color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    border-right: none;
    border-top: none;
}

.ef-wa-crm-message-text {
    margin: 0 0 4px 0;
    line-height: 1.4;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ef-wa-crm-message-meta {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
    margin-top: 2px;
}

.ef-wa-crm-message-time {
    font-weight: 400;
}

.ef-wa-crm-message-type {
    display: none;
}

/* Message date separators - WhatsApp style */
.ef-wa-crm-message-date-separator {
    text-align: center;
    margin: 15px 0 10px 0;
}

.ef-wa-crm-message-date-text {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

/* Empty state */
.ef-wa-crm-messages-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
}

.ef-wa-crm-messages-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.ef-wa-crm-messages-empty-text {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.ef-wa-crm-messages-empty-subtext {
    font-size: 14px;
    opacity: 0.7;
    max-width: 300px;
    line-height: 1.4;
}

/* Scoring View - WhatsApp Style */
.ef-wa-crm-scoring-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--background-secondary);
}

.ef-wa-crm-scoring-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    /* Fixed height to prevent page scrolling */
    height: calc(100vh - 180px); /* Subtract header heights */
    max-height: 600px;
    min-height: 400px;
}

.ef-wa-crm-scoring-item {
    background: var(--surface-color);
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.ef-wa-crm-scoring-item:hover {
    background: var(--surface-light);
}

.ef-wa-crm-scoring-item:last-child {
    margin-bottom: 0;
}

.ef-wa-crm-scoring-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ef-wa-crm-scoring-timestamp {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.ef-wa-crm-scoring-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ef-wa-crm-scoring-value {
    background: var(--surface-dark);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border-color);
}

.ef-wa-crm-scoring-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ef-wa-crm-scoring-score {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ef-wa-crm-scoring-trend {
    font-size: 12px;
    font-weight: 500;
}

.ef-wa-crm-scoring-trend.up {
    color: var(--success-color);
}

.ef-wa-crm-scoring-trend.down {
    color: var(--error-color);
}

.ef-wa-crm-scoring-trend.stable {
    color: var(--text-secondary);
}

.ef-wa-crm-scoring-trend.new {
    color: var(--primary-color);
}

/* Responsive Design - WhatsApp Style */
@media (max-width: 1024px) {
    .ef-wa-crm-sidebar {
        width: 35%;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .ef-wa-crm-content {
        flex-direction: column;
    }
    
    .ef-wa-crm-sidebar {
        width: 100%;
        min-width: unset;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .ef-wa-crm-main-panel {
        flex: 1;
        min-height: 400px;
    }
    
    .ef-wa-crm-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        height: auto;
        padding: 12px 16px;
    }
    
    .ef-wa-crm-studio-info {
        justify-content: center;
    }
    
    .ef-wa-crm-sidebar-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .ef-wa-crm-sidebar-stat {
        padding: 6px 8px;
    }
    
    .ef-wa-crm-sidebar-stat-number {
        font-size: 14px;
    }
    
    .ef-wa-crm-sidebar-stat-label {
        font-size: 9px;
    }
    
    .ef-wa-crm-contact-item {
        padding: 10px 16px;
    }
    
    .ef-wa-crm-contact-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .ef-wa-crm-messages-container {
        padding: 16px;
        height: calc(100vh - 250px);
    }
    
    .ef-wa-crm-scoring-container {
        height: calc(100vh - 250px);
    }
    
    .ef-wa-crm-message-content {
        max-width: 85%;
    }
    
    .ef-wa-crm-scoring-values {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .ef-wa-crm-contact-info-container {
        padding: 20px;
    }
    
    .ef-wa-crm-contact-info-card {
        padding: 20px;
    }
    
    .ef-wa-crm-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ef-wa-crm-kpi-grid {
        grid-template-columns: 1fr;
    }
    
    
    .ef-wa-crm-contact-info-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .ef-wa-crm-sidebar {
        height: 250px;
    }
    
    .ef-wa-crm-sidebar-header {
        padding: 12px 16px;
    }
    
    .ef-wa-crm-sidebar-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ef-wa-crm-contact-item {
        padding: 8px 16px;
    }
    
    .ef-wa-crm-contact-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .ef-wa-crm-contact-name {
        font-size: 15px;
    }
    
    .ef-wa-crm-contact-status {
        font-size: 12px;
    }
    
    .ef-wa-crm-main-panel-header {
        padding: 12px 16px;
    }
    
    .ef-wa-crm-main-panel-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .ef-wa-crm-messages-container {
        padding: 12px;
        height: calc(100vh - 280px);
    }
    
    .ef-wa-crm-scoring-container {
        height: calc(100vh - 280px);
    }
    
    .ef-wa-crm-message-content {
        max-width: 90%;
    }
    
    .ef-wa-crm-contact-info-container {
        padding: 15px;
    }
    
    .ef-wa-crm-contact-info-card {
        padding: 15px;
    }
    
    .ef-wa-crm-contact-info-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .ef-wa-crm-contact-info-avatar {
        width: 60px;
        height: 60px;
        font-size: 24px;
        align-self: center;
    }
    
    .ef-wa-crm-kpi-item {
        padding: 16px;
        gap: 12px;
    }
    
    .ef-wa-crm-kpi-score-value {
        font-size: 18px;
    }
    
    .ef-wa-crm-insights-content {
        padding: 16px;
    }
}

/* Utilities */
.ef-wa-crm-hidden {
    display: none !important;
}

.ef-wa-crm-text-center {
    text-align: center;
}

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

/* Animations */
@keyframes ef-wa-crm-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ef-wa-crm-fade-in {
    animation: ef-wa-crm-fade-in 0.3s ease-out;
}

/* Scrollbar Styling */
.ef-wa-crm-messages-container::-webkit-scrollbar {
    width: 6px;
}

.ef-wa-crm-messages-container::-webkit-scrollbar-track {
    background: var(--background-color);
}

.ef-wa-crm-messages-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.ef-wa-crm-messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}