﻿/* reports.css - Reports page */

/* ==================== REPORTS PAGE STYLES ==================== */
.reports-page {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 2rem;
    border-radius: 1rem;
    min-height: calc(100vh - 200px);
    min-height: calc(100dvh - 200px);
}

.reports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(25, 135, 84, 0.1);
}

.reports-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reports-header h2 i {
    color: #198754;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    padding: 0.75rem;
    border-radius: 0.75rem;
    -webkit-text-fill-color: #198754;
}

.reports-toolbar {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.04);
}

.reports-toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.reports-toolbar-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

.reports-filter-select {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    min-width: 140px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.reports-filter-select:focus {
    outline: none;
    border-color: #198754;
    box-shadow: 0 0 0 4px rgba(25, 135, 84, 0.1);
}

.reports-filter-select:hover {
    border-color: #cbd5e1;
}

.reports-toolbar-actions {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

.reports-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.reports-action-btn:hover {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: #198754;
    color: #198754;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.15);
}

.reports-action-btn.primary {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
}

.reports-action-btn.primary:hover {
    background: linear-gradient(135deg, #157347 0%, #0f5132 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

/* Column Manager */
.column-manager {
    position: relative;
}

.column-manager-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 280px;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    z-index: 100;
    display: none;
    max-height: 400px;
    overflow: hidden;
}

.column-manager-dropdown.show {
    display: block;
}

.column-manager-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-manager-header h6 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.column-manager-body {
    padding: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.column-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.column-item:hover {
    background: #f0fdf4;
}

.column-item input[type="checkbox"] {
    accent-color: #198754;
}

.column-item label {
    flex: 1;
    cursor: pointer;
    font-size: 0.85rem;
    margin: 0;
}

.column-item .drag-handle {
    color: #9ca3af;
    cursor: grab;
}

.column-manager-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Export Options Modal */
.export-options-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;
}

.export-options-modal.show {
    display: flex;
}

.export-options-content {
    background: #fff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.export-options-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-options-header h5 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-options-body {
    padding: 1.5rem;
}

.export-format-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.export-format-option {
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.export-format-option:hover {
    border-color: #198754;
}

.export-format-option.selected {
    border-color: #198754;
    background: #f0fdf4;
}

.export-format-option i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.export-format-option i.fa-file-csv { color: #22c55e; }
.export-format-option i.fa-file-excel { color: #16a34a; }
.export-format-option i.fa-file-pdf { color: #ef4444; }
.export-format-option i.fa-print { color: #3b82f6; }

.export-format-option span {
    font-size: 0.85rem;
    font-weight: 500;
}

.export-options-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Reports Table */
.reports-table-container {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.04);
}

.reports-table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.reports-table-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #166534;
}

.reports-table-header h5 i {
    background: #fff;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.reports-table-info {
    font-size: 0.85rem;
    color: #166534;
    font-weight: 500;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.reports-table-wrap {
    overflow-x: auto;
    max-height: 600px;
}

.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.reports-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.reports-table th.sortable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.reports-table th.sortable:hover {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
}

.reports-table th.sorted {
    color: #198754;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.reports-table th i.sort-icon {
    margin-left: 0.35rem;
    font-size: 0.7rem;
}

.reports-table td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    transition: all 0.15s ease;
}

.reports-table tr {
    transition: all 0.2s ease;
}

.reports-table tbody tr:hover {
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    cursor: pointer;
}

.reports-table tbody tr:hover td {
    color: #166534;
}

.claim-link {
    color: #198754;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.claim-link:hover {
    color: #166534;
    text-decoration: underline;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-badge.funded {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.mini-badge.in-process {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.mini-badge.closed {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
}

.mini-badge.withdrawn {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.reports-table tr:hover {
    background: #f8fafc;
}

.reports-table tr.selected {
    background: #f0fdf4;
}

.reports-table .claim-link {
    color: #198754;
    font-weight: 600;
    text-decoration: none;
}

.reports-table .claim-link:hover {
    text-decoration: underline;
}

.reports-table .mini-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.reports-table .mini-badge.funded { background: #dcfce7; color: #16a34a; }
.reports-table .mini-badge.in-process { background: #dbeafe; color: #2563eb; }
.reports-table .mini-badge.closed { background: #f3f4f6; color: #6b7280; }
.reports-table .mini-badge.withdrawn { background: #fee2e2; color: #dc2626; }

.reports-table .compact-cell {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pagination */
.reports-pagination {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.8rem;
}

.pagination-btn:hover:not(:disabled) {
    background: #f0fdf4;
    border-color: #198754;
    color: #198754;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.per-page-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
}

.analytics-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.analytics-kpi-grid.extended {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1400px) {
    .analytics-kpi-grid.extended {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .analytics-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .analytics-kpi-grid.extended {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .analytics-kpi-grid {
        grid-template-columns: 1fr;
    }
    .analytics-kpi-grid.extended {
        grid-template-columns: 1fr;
    }
}

.analytics-kpi-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analytics-kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.analytics-kpi-card:hover::after {
    content: '\f35d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.9rem;
    color: #9ca3af;
    opacity: 1;
}

.analytics-kpi-card::after {
    content: '\f35d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.9rem;
    color: #d1d5db;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.analytics-kpi-card .kpi-drilldown-hint {
    position: absolute;
    bottom: 0.75rem;
    right: 1rem;
    font-size: 0.7rem;
    color: #9ca3af;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.analytics-kpi-card:hover .kpi-drilldown-hint {
    opacity: 1;
}

.analytics-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.analytics-kpi-card.primary::before { background: #198754; }
.analytics-kpi-card.warning::before { background: #f59e0b; }
.analytics-kpi-card.info::before { background: #3b82f6; }
.analytics-kpi-card.success::before { background: #10b981; }
.analytics-kpi-card.danger::before { background: #ef4444; }
.analytics-kpi-card.purple::before { background: #8b5cf6; }

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.kpi-icon.primary { background: #dcfce7; color: #198754; }
.kpi-icon.warning { background: #fef3c7; color: #f59e0b; }
.kpi-icon.info { background: #dbeafe; color: #3b82f6; }
.kpi-icon.success { background: #d1fae5; color: #10b981; }
.kpi-icon.danger { background: #fee2e2; color: #ef4444; }
.kpi-icon.purple { background: #ede9fe; color: #8b5cf6; }

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.kpi-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.kpi-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.kpi-trend.up { color: #10b981; }
.kpi-trend.down { color: #ef4444; }

.chart-container {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.chart-header h5 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-header h5 i {
    color: #198754;
}

.chart-toggle-group {
    display: flex;
    gap: 0.5rem;
}

.chart-toggle-btn {
    padding: 0.4rem 1rem;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-toggle-btn:hover {
    border-color: #198754;
    color: #198754;
}

.chart-toggle-btn.active {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.chart-toggle-btn[data-mode="count"].active {
    background: #3b82f6;
    border-color: #3b82f6;
}

.chart-body {
    min-height: 300px;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem 0;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.chart-bar {
    width: 100%;
    max-width: 60px;
    border-radius: 0.5rem 0.5rem 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.chart-bar:hover {
    opacity: 0.8;
    transform: scaleY(1.02);
}

.chart-bar.primary { background: linear-gradient(180deg, #198754 0%, #20c997 100%); }
.chart-bar.secondary { background: linear-gradient(180deg, #6b7280 0%, #9ca3af 100%); }
.chart-bar.info { background: linear-gradient(180deg, #3b82f6 0%, #60a5fa 100%); }

.chart-bar-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

.chart-bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
}

/* Donut Chart */
.donut-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
}

.donut-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-center {
    position: absolute;
    width: 100px;
    height: 100px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-center-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.donut-center-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.donut-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.donut-legend-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.donut-legend-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin-left: auto;
}

/* Line Chart */
.line-chart {
    position: relative;
    height: 250px;
    display: flex;
    align-items: flex-end;
}

.line-chart-grid {
    position: absolute;
    top: 0;
    left: 50px;
    right: 0;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.line-chart-grid-line {
    border-bottom: 1px dashed #e5e7eb;
    position: relative;
}

.line-chart-grid-line span {
    position: absolute;
    left: -50px;
    top: -8px;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Reports Table */
.reports-table {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.reports-table-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.reports-table-header h5 {
    margin: 0;
    font-weight: 600;
}
