/**
 * CRM Dashboard Styles
 * ====================
 * Styles for the CRM Sales Dashboard page.
 * Uses .is-crm-* prefix for all classes.
 */

/* =============================================
   Quick Stats Row
   ============================================= */
.is-crm-quick-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1280px) {
    .is-crm-quick-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .is-crm-quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .is-crm-quick-stats {
        grid-template-columns: 1fr;
    }
}

.is-crm-stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s, transform 0.2s;
}

.is-crm-stat-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.dark .is-crm-stat-card {
    background: rgb(30, 41, 59);
    border-color: rgb(51, 65, 85);
}

.is-crm-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.is-crm-stat-icon svg {
    color: #ffffff;
}

.is-crm-stat-icon-primary {
    background: linear-gradient(135deg, #5DC2D3 0%, #4aa8b8 100%);
}

.is-crm-stat-icon-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.is-crm-stat-icon-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.is-crm-stat-icon-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.is-crm-stat-icon-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.is-crm-stat-icon-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.is-crm-stat-icon-teal {
    background: linear-gradient(135deg, #5DC2D3 0%, #0d9488 100%);
}

.is-crm-stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.is-crm-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.dark .is-crm-stat-value {
    color: #f1f5f9;
}

.is-crm-stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
    font-weight: 500;
}

.dark .is-crm-stat-label {
    color: #94a3b8;
}

.is-crm-stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.is-crm-stat-change.is-positive {
    color: #10b981;
}

.is-crm-stat-change.is-negative {
    color: #ef4444;
}

/* =============================================
   Lead Trend Chart
   ============================================= */
.is-crm-trend-row {
    margin-bottom: 1.5rem;
}

.is-crm-trend-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    height: 120px;
    padding: 1rem 0;
}

.is-crm-trend-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.is-crm-trend-bar-inner {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(180deg, #5DC2D3 0%, #4aa8b8 100%);
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.5rem;
    min-height: 24px;
    transition: height 0.3s ease;
}

.dark .is-crm-trend-bar-inner {
    background: linear-gradient(180deg, #5DC2D3 0%, #3d8a96 100%);
}

.is-crm-trend-bar-inner.is-crm-trend-bar-empty {
    height: 28px !important;
    background: #e5e7eb;
    border-radius: 6px;
    align-items: center;
    padding-top: 0;
}

.dark .is-crm-trend-bar-inner.is-crm-trend-bar-empty {
    background: rgb(51, 65, 85);
}

.is-crm-trend-bar-empty .is-crm-trend-value {
    color: #9ca3af;
}

.dark .is-crm-trend-bar-empty .is-crm-trend-value {
    color: #64748b;
}

.is-crm-trend-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
}

.is-crm-trend-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    margin-top: 0.5rem;
}

.dark .is-crm-trend-label {
    color: #94a3b8;
}

/* =============================================
   Main Dashboard Grid
   ============================================= */
.is-crm-dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .is-crm-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.is-crm-dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.is-crm-dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* =============================================
   Cards
   ============================================= */
.is-crm-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.dark .is-crm-card {
    background: rgb(30, 41, 59);
    border-color: rgb(51, 65, 85);
}

.is-crm-card-full {
    width: 100%;
}

.is-crm-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.dark .is-crm-card-header {
    background: rgb(15, 23, 42);
    border-color: rgb(51, 65, 85);
}

.is-crm-card-header span {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1f2937;
}

.dark .is-crm-card-header span {
    color: #f1f5f9;
}

.is-crm-card-body {
    padding: 1.25rem;
}

/* =============================================
   Badges
   ============================================= */
.is-crm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

.is-crm-badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.dark .is-crm-badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.is-crm-badge-success {
    background: #d1fae5;
    color: #047857;
}

.dark .is-crm-badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.is-crm-badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.dark .is-crm-badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.is-crm-badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.dark .is-crm-badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.is-crm-badge-gray {
    background: #f3f4f6;
    color: #4b5563;
}

.dark .is-crm-badge-gray {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.is-crm-badge-purple {
    background: #ede9fe;
    color: #6d28d9;
}

.dark .is-crm-badge-purple {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

/* =============================================
   Leads by Source
   ============================================= */
.is-crm-source-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.is-crm-source-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.is-crm-source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.is-crm-source-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.dark .is-crm-source-name {
    color: #e2e8f0;
}

.is-crm-source-count {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1f2937;
}

.dark .is-crm-source-count {
    color: #f1f5f9;
}

.is-crm-source-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.dark .is-crm-source-bar {
    background: rgb(51, 65, 85);
}

.is-crm-source-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* =============================================
   Conversion Funnel
   ============================================= */
.is-crm-funnel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.is-crm-funnel-stage {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.is-crm-funnel-bar {
    background: #f3f4f6;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    min-width: 80px;
    transition: width 0.3s ease;
}

.dark .is-crm-funnel-bar {
    background: rgb(51, 65, 85);
}

.is-crm-funnel-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 80px;
}

.is-crm-funnel-count {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

.dark .is-crm-funnel-count {
    color: #f1f5f9;
}

.is-crm-funnel-pct {
    font-size: 0.8125rem;
    color: #6b7280;
}

.dark .is-crm-funnel-pct {
    color: #94a3b8;
}

/* =============================================
   Team Performance Table
   ============================================= */
.is-crm-team-table {
    display: flex;
    flex-direction: column;
}

.is-crm-team-header {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .is-crm-team-header {
    border-color: rgb(51, 65, 85);
    color: #94a3b8;
}

.is-crm-team-row {
    display: flex;
    padding: 0.875rem 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

.is-crm-team-row:hover {
    background: #f9fafb;
}

.dark .is-crm-team-row {
    border-color: rgb(51, 65, 85);
}

.dark .is-crm-team-row:hover {
    background: rgb(15, 23, 42);
}

.is-crm-team-col {
    flex: 1;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #374151;
}

.dark .is-crm-team-col {
    color: #e2e8f0;
}

.is-crm-team-col-name {
    flex: 2;
    gap: 0.75rem;
}

.is-crm-team-avatar {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #5DC2D3 0%, #4aa8b8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    flex-shrink: 0;
    overflow: hidden;
}

.is-crm-team-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =============================================
   Follow-up Items
   ============================================= */
.is-crm-followup-item,
.is-crm-overdue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem;
    margin: -0.25rem -0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s;
}

.is-crm-followup-item:hover,
.is-crm-overdue-item:hover {
    background: #f3f4f6;
}

.dark .is-crm-followup-item:hover,
.dark .is-crm-overdue-item:hover {
    background: rgb(51, 65, 85);
}

.is-crm-followup-content,
.is-crm-overdue-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.is-crm-followup-name,
.is-crm-overdue-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .is-crm-followup-name,
.dark .is-crm-overdue-name {
    color: #f1f5f9;
}

.is-crm-followup-phone {
    font-size: 0.8125rem;
    color: #6b7280;
}

.dark .is-crm-followup-phone {
    color: #94a3b8;
}

.is-crm-overdue-assigned {
    font-size: 0.8125rem;
    color: #6b7280;
}

.dark .is-crm-overdue-assigned {
    color: #94a3b8;
}

.is-crm-followup-meta,
.is-crm-overdue-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
}

.is-crm-followup-time {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #3b82f6;
}

.is-crm-overdue-days {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #ef4444;
}

/* =============================================
   Consultation Items
   ============================================= */
.is-crm-consultation-stats {
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.is-crm-consultation-item,
.is-crm-upcoming-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem;
    margin: -0.25rem -0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.is-crm-consultation-item {
    border-left-color: #8b5cf6;
}

.is-crm-upcoming-item {
    border-left-color: #5DC2D3;
}

.is-crm-consultation-item:hover,
.is-crm-upcoming-item:hover {
    background: #f3f4f6;
}

.dark .is-crm-consultation-item:hover,
.dark .is-crm-upcoming-item:hover {
    background: rgb(51, 65, 85);
}

.is-crm-consultation-content,
.is-crm-upcoming-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.is-crm-consultation-name,
.is-crm-upcoming-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .is-crm-consultation-name,
.dark .is-crm-upcoming-name {
    color: #f1f5f9;
}

.is-crm-consultation-consultant,
.is-crm-upcoming-consultant {
    font-size: 0.8125rem;
    color: #6b7280;
}

.dark .is-crm-consultation-consultant,
.dark .is-crm-upcoming-consultant {
    color: #94a3b8;
}

.is-crm-consultation-meta,
.is-crm-upcoming-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
}

.is-crm-consultation-time {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #8b5cf6;
}

.is-crm-upcoming-date {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
}

.dark .is-crm-upcoming-date {
    color: #94a3b8;
}

.is-crm-upcoming-date.is-crm-date-today {
    color: #8b5cf6;
    font-weight: 600;
}

.is-crm-upcoming-date.is-crm-date-tomorrow {
    color: #3b82f6;
    font-weight: 600;
}

/* =============================================
   Recent Activities
   ============================================= */
.is-crm-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.is-crm-activity-item:last-child {
    border-bottom: none;
}

.dark .is-crm-activity-item {
    border-color: rgb(51, 65, 85);
}

.is-crm-activity-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.is-crm-activity-lead {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .is-crm-activity-lead {
    color: #f1f5f9;
}

.is-crm-activity-subject {
    font-size: 0.8125rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .is-crm-activity-subject {
    color: #94a3b8;
}

.is-crm-activity-time {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

.dark .is-crm-activity-time {
    color: #64748b;
}

/* =============================================
   Quick Actions
   ============================================= */
.is-crm-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.is-crm-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.is-crm-action-btn:hover {
    background: #5DC2D3;
    border-color: #5DC2D3;
    color: #ffffff;
}

.is-crm-action-btn:hover svg {
    color: #ffffff;
}

.dark .is-crm-action-btn {
    background: rgb(30, 41, 59);
    border-color: rgb(51, 65, 85);
    color: #e2e8f0;
}

.dark .is-crm-action-btn:hover {
    background: #5DC2D3;
    border-color: #5DC2D3;
    color: #ffffff;
}

.is-crm-action-btn svg {
    color: #5DC2D3;
    transition: color 0.15s;
}

/* =============================================
   Empty States
   ============================================= */
.is-crm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #9ca3af;
    font-size: 0.875rem;
    text-align: center;
}

.dark .is-crm-empty {
    color: #64748b;
}

.is-crm-empty-success {
    color: #10b981;
    gap: 0.5rem;
}

.is-crm-empty-success svg {
    width: 32px;
    height: 32px;
}

/* =============================================
   Utility Classes
   ============================================= */
.is-text-success {
    color: #10b981 !important;
}

.is-text-warning {
    color: #f59e0b !important;
}

.is-text-danger {
    color: #ef4444 !important;
}

.is-font-semibold {
    font-weight: 600 !important;
}
