﻿/* analytics.css - Analytics page */

/* ==================== ANALYTICS PAGE ==================== */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.analytics-header h2 {
    margin: 0;
}

.analytics-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Advanced Filters Toolbar */
.analytics-toolbar {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    border: 1px solid #e2e8f0;
}

.analytics-toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-toolbar-divider {
    width: 1px;
    height: 32px;
    background: #cbd5e1;
    margin: 0 0.5rem;
}

.filter-select {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    min-width: 140px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: #198754;
}

.filter-select:focus {
    outline: none;
    border-color: #198754;
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15);
}

/* Date Range Picker */
.date-range-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-range-picker:hover {
    border-color: #198754;
}

.date-range-picker i {
    color: #198754;
}

.date-range-picker span {
    font-size: 0.85rem;
    color: #374151;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
}

.export-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #198754;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-dropdown-btn:hover {
    background: #157347;
}

.export-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    min-width: 200px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.export-dropdown.active .export-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.export-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.export-dropdown-item:hover {
    background: #f0fdf4;
    color: #198754;
}

.export-dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.export-dropdown-item i.fa-file-csv { color: #22c55e; }
.export-dropdown-item i.fa-file-excel { color: #16a34a; }
.export-dropdown-item i.fa-file-pdf { color: #ef4444; }
.export-dropdown-item i.fa-print { color: #3b82f6; }

.export-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.25rem 0;
}

/* Quick Actions in Toolbar */
.toolbar-quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: #f0fdf4;
    border-color: #198754;
    color: #198754;
}

.toolbar-btn.active {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

/* Chart Bar Hover Effects */
.chart-bar {
    transition: all 0.2s ease;
    position: relative;
}

.chart-bar:hover {
    transform: scaleY(1.02);
    filter: brightness(1.1);
}

.chart-bar-group {
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-bar-group:hover .chart-bar-value {
    opacity: 1;
    transform: translateY(-5px);
}

.chart-bar-value {
    opacity: 1;
    transition: all 0.2s ease;
}

/* Donut Chart Hover */
.donut-legend-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.donut-legend-item:hover {
    background: #f0fdf4;
}

/* KPI Drill-down Modal */
.kpi-drilldown-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.kpi-drilldown-modal.show {
    display: flex;
}

.kpi-drilldown-content {
    background: #fff;
    border-radius: 1rem;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-drilldown-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-drilldown-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kpi-drilldown-header h4 i {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.kpi-drilldown-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.kpi-drilldown-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.kpi-drilldown-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 120px);
}

.kpi-drilldown-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-summary-card {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
}

.kpi-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.kpi-summary-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.kpi-drilldown-table {
    width: 100%;
    border-collapse: collapse;
}

.kpi-drilldown-table th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.kpi-drilldown-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
}

.kpi-drilldown-table tr:hover {
    background: #f0fdf4;
}

/* Comparison Period Badge */
.comparison-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.comparison-badge.up {
    background: #dcfce7;
    color: #16a34a;
}

.comparison-badge.down {
    background: #fee2e2;
    color: #dc2626;
}

.comparison-badge.neutral {
    background: #f3f4f6;
    color: #6b7280;
}

/* Refresh Animation */
.refresh-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
