/* Analytics Dashboard Styling for T-ARE Trading & Consultancy */

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #f8f9fa;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-color: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #2c5aa0 0%, #1e3a5f 100%);
}

/* Layout */
body {
    font-family: 'Roboto', sans-serif;
    background-color: #f5f7fa;
    margin: 0;
    padding: 0;
}

.main-content {
    margin-top: 76px;
    padding: 2rem 0;
    min-height: calc(100vh - 76px);
}

/* Dashboard Header */
.dashboard-header {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-header .lead {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.last-updated {
    text-align: right;
}

/* Metric Cards */
.metric-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    align-items: center;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.metric-icon i {
    font-size: 1.5rem;
    color: white;
}

.metric-content {
    flex: 1;
}

.metric-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--dark-color);
}

.metric-content p {
    margin-bottom: 0.25rem;
    color: #666;
    font-weight: 500;
}

.metric-change {
    font-weight: 600;
}

.metric-change.positive {
    color: var(--success-color);
}

.metric-change.negative {
    color: var(--danger-color);
}

/* Chart Cards */
.chart-card, .table-card, .insights-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
    height: 100%;
    overflow: hidden;
}

.chart-header, .table-header, .insights-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h5, .table-header h5, .insights-header h5 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
}

.chart-container {
    padding: 1.5rem;
    height: 350px;
    position: relative;
}

/* Table Styling */
.table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table td {
    vertical-align: middle;
}

.lead-score-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.lead-score-high {
    background-color: #d4edda;
    color: #155724;
}

.lead-score-medium {
    background-color: #fff3cd;
    color: #856404;
}

.lead-score-low {
    background-color: #f8d7da;
    color: #721c24;
}

/* Insights Card */
.insights-content {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.insight-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.insight-icon i {
    font-size: 0.875rem;
    color: white;
}

.insight-content h6 {
    margin-bottom: 0.25rem;
    color: var(--primary-color);
    font-weight: 600;
}

.insight-content p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Navigation Enhancements */
.navbar-dark .navbar-brand .brand-text {
    font-weight: 700;
    font-size: 1.25rem;
}

.time-filter.active {
    background-color: var(--primary-color);
    color: white;
}

/* Chart Specific Styling */
.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-controls .btn {
    font-size: 0.875rem;
}

/* Loading States */
#loadingSpinner {
    color: var(--primary-color);
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    .dashboard-header {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
    
    .metric-card {
        margin-bottom: 1rem;
    }
    
    .chart-container {
        height: 250px;
        padding: 1rem;
    }
    
    .chart-header, .table-header, .insights-header {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .metric-card {
        flex-direction: column;
        text-align: center;
    }
    
    .metric-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .metric-content h3 {
        font-size: 1.75rem;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.slide-up {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.6s ease forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Chart Tooltip Customization */
.chartjs-tooltip {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    color: white;
    font-family: 'Roboto', sans-serif;
    padding: 8px 12px;
    font-size: 0.875rem;
}

/* Custom Scrollbar */
.table-responsive::-webkit-scrollbar,
.insights-content::-webkit-scrollbar {
    width: 6px;
}

.table-responsive::-webkit-scrollbar-track,
.insights-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb,
.insights-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.insights-content::-webkit-scrollbar-thumb:hover {
    background: #1e3a5f;
}

/* Print Styles */
@media print {
    .navbar, .chart-controls, .table-header .btn {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    .chart-card, .metric-card, .table-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    .dashboard-header {
        background: white !important;
        color: black !important;
        border: 1px solid #ddd !important;
    }
}