/* Customer Lookup Dashboard Styles */
/* Location: /assets/css/pages/customer-lookup.css */

/* Search Section */
.search-section {
    background: var(--myceo-surface-1);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-field {
    display: flex;
    flex-direction: column;
}

.search-field label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--myceo-text-primary);
}

.search-field input {
    padding: 0.75rem;
    border: 1px solid var(--myceo-border-mid);
    border-radius: 4px;
    font-size: 0.95rem;
}

.search-field input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: var(--myceo-surface-2);
    color: var(--myceo-text-primary);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--myceo-surface-1);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.75rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--myceo-surface-1);
}

/* Customer Profile */
.customer-profile {
    animation: fadeIn 0.3s ease-in;
}

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

.profile-header {
    background: linear-gradient(135deg, var(--myceo-surface-2) 0%, #1a3a7f 100%);
    color: var(--myceo-text-primary);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.profile-contact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0.9;
}

.profile-badges {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.badge-segment {
    background: var(--myceo-accent-blue);
    color: var(--myceo-text-primary);
}

.badge-status {
    color: var(--myceo-text-primary);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--myceo-border-mid);
    margin: 2rem 0 1rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--myceo-text-secondary);
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: var(--myceo-accent-blue);
}

.tab-button.active {
    color: var(--myceo-accent-blue);
    border-bottom-color: var(--myceo-accent-blue);
}

.tab-content {
    display: none !important;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block !important;
}

/* Segment Progression */
.segment-progression {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    padding: 1rem 0;
}

.segment-year {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 1rem;
    background: var(--myceo-surface-1);
    border-radius: 4px;
}

.segment-year-label {
    font-size: 0.85rem;
    color: var(--myceo-text-secondary);
    margin-bottom: 0.5rem;
}

.segment-year-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.segment-arrow {
    font-size: 1.5rem;
    color: var(--myceo-text-dim);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--myceo-surface-2);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--myceo-surface-2);
    border: 3px solid var(--myceo-border-mid);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-date {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.timeline-order {
    background: var(--myceo-surface-1);
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid var(--myceo-accent-blue);
}

.order-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.order-id {
    font-weight: 600;
    color: var(--myceo-text-primary);
}

.order-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.order-items {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--myceo-border-mid);
}

.order-items.expanded {
    display: block;
}

.item-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--myceo-border-mid);
}

/* Source Systems */
.source-systems {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.source-card {
    background: var(--myceo-surface-1);
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
}

.source-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--myceo-text-secondary);
    margin-bottom: 0.5rem;
}

.source-id {
    font-weight: 600;
    color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--myceo-text-dim);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Search Results */
.search-results {
    background: var(--myceo-surface-1);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.result-item {
    padding: 1rem;
    border: 1px solid var(--myceo-border-mid);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.result-item:hover {
    background: var(--myceo-surface-1);
    border-color: var(--primary-color);
}

/* Analytics Section - CRITICAL FOR CHART RENDERING */
.analytics-section {
    margin-top: 2rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.analytics-grid .chart-container {
    background: var(--myceo-surface-1);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 350px; /* CRITICAL: Ensures container has height */
    display: flex;
    flex-direction: column;
}

.analytics-grid .chart-container h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Chart Placeholders - CRITICAL FOR CHART RENDERING */
.chart-placeholder {
    min-height: 300px; /* CRITICAL: Chart.js needs this */
    width: 100%;
    height: 100%;
    position: relative;
    flex: 1; /* Takes remaining space in flex container */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Specific chart container fixes */
#spending-chart {
    min-height: 300px;
    width: 100%;
    position: relative;
}

#frequency-chart {
    min-height: 300px;
    width: 100%;
    position: relative;
}

#category-chart {
    min-height: 400px; /* Taller for pie chart */
    width: 100%;
    position: relative;
}

/* Ensure canvas elements get proper sizing */
.chart-placeholder canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Loading state for charts */
.chart-placeholder .loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
    }

    .profile-badges {
        align-items: flex-start;
        margin-top: 1rem;
    }

    .search-grid {
        grid-template-columns: 1fr;
    }

    .segment-progression {
        flex-direction: column;
    }

    .segment-arrow {
        transform: rotate(90deg);
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-grid .chart-container {
        min-height: 300px; /* Slightly shorter on mobile */
    }
}