﻿/*
 * (c) 2026 guardfolio.live / David Purand. All rights reserved.
 * Unauthorized copying, modification, distribution, or sale of this file is strictly prohibited.
 * Proprietary and confidential.
 */

/* ===================================
   Reports Module System (Mobile First)
   =================================== */

/* 1. Filter Bar */
.report-filter-bar {
    margin-bottom: var(--space-xl);
    background: var(--gtj-bg-card);
    border: 1px solid var(--gtj-border);
    border-radius: 8px;
    padding: var(--container-pad);
}

.report-filter-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.report-filter-title {
    margin: 0;
    color: var(--gtj-text-primary);
    font-weight: 600;
    font-size: var(--fs-h4);
}

.report-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.report-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--btn-pad-y) var(--btn-pad-x);
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--gtj-text-secondary);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.report-filter-btn:hover {
    background: var(--gtj-bg-dark);
    color: var(--gtj-text-primary);
}

.report-filter-btn.active {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
    font-weight: 600;
}

/* Layout Grids */
.report-grid {
    display: grid;
    /* Auto-fit replaces media queries */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

/* Desktop: 3 Columns */
@media (min-width: 1024px) {
    .report-grid.three-col {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* 3. KPI Grids (Auto-Fit) */
.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    /* Fluid Responsive */
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

/* 4. Widget Containers */
.report-widget {
    background: var(--gtj-bg-card);
    border: 1px solid var(--gtj-border);
    border-radius: 12px;
    overflow: hidden;
    /* transition: transform 0.2s; Optional hover effect */
}

/* Full Width Span on Desktop */
@media (min-width: 768px) {
    .report-widget.full-width {
        grid-column: 1 / -1;
    }
}

/* 5. Chart Containers (Aspect Ratio) */
.report-chart-container {
    position: relative;
    width: 100%;
    /* Fluid height handling */
    height: clamp(300px, 40vh, 400px);
}

/* Large modifier */
.report-chart-container.large {
    height: clamp(400px, 50vh, 500px);
}

/* 6. Monte Carlo Specifics */
.mc-simulation-box {
    border: 1px solid var(--gtj-border);
    background: #fafafa;
}

.mc-header-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
}

@media (min-width: 640px) {
    .mc-header-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.mc-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
    .mc-results-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* 7. Heatmap */
.heatmap-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
    /* Scrollbar space */
}

.heatmap-grid {
    display: grid;
    grid-template-columns: 60px repeat(24, minmax(28px, 1fr));
    /* Label + 24 hours */
    gap: 4px;
    min-width: 750px;
    /* Ensure non-squished on mobile */
    padding: var(--space-sm);
}

.heatmap-header-cell {
    text-align: center;
    font-size: 10px;
    color: var(--gtj-text-secondary);
    padding-bottom: 4px;
    font-family: 'Urbanist', sans-serif;
}

.heatmap-row-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gtj-text-primary);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background-color: #f3f4f6;
    /* Default empty */
    position: relative;
    transition: all 0.15s ease;
    cursor: default;
}

.heatmap-cell:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Utility to ensure tooltip works nicely */
.heatmap-cell[title] {
    cursor: help;
}

/* Utilities for cleanup */
.text-muted {
    color: #9ca3af;
}

/* Target Filters */
.target-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.filter-col {
    flex: 1;
    min-width: 150px;
}

.filter-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.filter-select {
    width: 100%;
    padding: var(--input-pad);
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.filter-action {
    display: flex;
    align-items: flex-end;
}

.btn-reset {
    padding: var(--btn-pad-y) var(--btn-pad-x);
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.filter-icon {
    font-size: 14px;
    margin-right: 4px;
}

.padding-16-top {
    padding-top: 16px;
}

.custom-border-spacing {
    border-collapse: separate;
    border-spacing: 0;
}

.stats-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.grid-span-all {
    grid-column: 1 / -1;
}

.padding-24 {
    padding: 24px;
}

.mc-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

.mc-loading-icon {
    font-size: 32px;
    color: #3b82f6;
    width: 32px;
    height: 32px;
}

/* Report Table Overrides (Specific) */
#guardfolio-content-reports .report-td-pad {
    padding: var(--space-sm);
}

#guardfolio-content-reports .report-td-center {
    padding: var(--space-sm);
    text-align: center;
}

#guardfolio-content-reports .report-th-pad {
    padding: var(--space-sm);
}

#guardfolio-content-reports .report-th-center {
    padding: var(--space-sm);
    text-align: center;
}

#guardfolio-content-reports .report-table-auto {
    table-layout: auto;
}

.mc-chart-desc {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: #f0f9ff;
    border-radius: 6px;
    color: #0369a1;
    font-size: 13px;
}

.min-h-100 {
    min-height: 100px;
}

.chart-scale-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.chart-scale-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.chart-scale-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
}

.chart-scale-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    margin: 0;
}

.chart-scale-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.chart-scale-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.chart-scale-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.chart-scale-input:checked+.chart-scale-slider {
    background-color: #2563eb;
}

.chart-scale-input:checked+.chart-scale-slider:before {
    transform: translateX(14px);
}

.strat-color-indicator {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.modal-header-flex {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.modal-body-bg {
    background: #f9fafb;
    padding: var(--space-xl);
}

/* Force override with ID */
#guardfolio-content-reports .widget-no-margin {
    margin: 0;
}

.widget-body-scroll {
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.table-no-border {
    width: 100%;
    border: none;
}

.flex-col-gap-16 {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.stat-card-white {
    background: white;
    padding: var(--space-lg);
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.stat-label-gray {
    color: #6b7280;
    display: block;
}

.stat-val-lg-green {
    font-size: 18px;
    color: #10b981;
    font-weight: 700;
}

.stat-val-lg-red {
    font-size: 18px;
    color: #ef4444;
    font-weight: 700;
}

.heatmap-desc {
    margin: 4px 0 0;
    color: var(--gtj-text-secondary);
    font-size: 12px;
}

.scrollable-table-300 {
    max-height: 300px;
    overflow-y: auto;
}