/* ===================================================================
   P&L TRENDS ANALYSIS — 5-View Tabbed Architecture
   Design: Editorial luxury, data density, aligned with profitability module
   =================================================================== */

.pl-trends-module {
    font-family: var(--liq-font-body);
    background: var(--liq-bg);
    padding: 0;
}

/* ===================================================================
   HEADER
   =================================================================== */

.pl-trends-header {
    background: linear-gradient(to bottom, #FFFFFF 0%, #FAFAF9 100%);
    border-bottom: 1px solid var(--liq-border);
    padding: 1.5rem 1.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.pl-trends-title-section h2 {
    font-family: var(--liq-font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--liq-text);
    margin: 0 0 0.4rem 0;
    letter-spacing: -0.03em;
}

.pl-trends-period {
    font-size: 0.875rem;
    color: var(--liq-text-secondary);
    font-family: var(--liq-font-mono);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.pl-trends-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ===================================================================
   VIEW TABS
   =================================================================== */

.plt-view-tabs {
    display: flex;
    gap: 0;
    padding: 0 1.75rem;
    background: #FAFAF9;
    border-bottom: 1px solid var(--liq-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.plt-view-tabs::-webkit-scrollbar { display: none; }

.plt-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    font-family: var(--liq-font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.plt-tab:hover {
    color: var(--liq-text-secondary);
    background: rgba(0, 0, 0, 0.02);
}

.plt-tab.active {
    color: var(--liq-accent, #4a9080);
    border-bottom-color: var(--liq-accent, #4a9080);
    font-weight: 600;
}

.plt-tab svg {
    opacity: 0.5;
    flex-shrink: 0;
}

.plt-tab.active svg {
    opacity: 1;
}

/* ===================================================================
   CONTENT AREA
   =================================================================== */

.plt-content-area {
    padding: 0;
}

.plt-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

/* ===================================================================
   MESSAGE NOTE
   =================================================================== */

.plt-message-note {
    margin: 0.75rem 1.75rem;
    font-family: var(--liq-font-body);
    font-size: 0.8125rem;
    color: var(--liq-text-secondary);
    background: rgba(202, 138, 4, 0.06);
    border: 1px solid rgba(202, 138, 4, 0.15);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--liq-warning, #CA8A04);
}

/* ===================================================================
   HERO
   =================================================================== */

.pl-trends-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #283548 100%);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    margin: 1.25rem 1.75rem 0;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.pl-trends-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -5%;
    width: 40%;
    height: 180%;
    background: radial-gradient(ellipse at 80% 20%, rgba(74, 144, 128, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.pl-trends-hero-main { position: relative; z-index: 1; }

.pl-trends-hero-label {
    font-family: var(--liq-font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.pl-trends-hero-value {
    font-family: var(--liq-font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.pl-trends-hero-context {
    font-family: var(--liq-font-body);
    font-size: 0.875rem;
    opacity: 0.7;
    line-height: 1.5;
}

.pl-trends-hero-context strong { opacity: 1; color: #6EE7B7; }
.pl-trends-hero-context .positive { color: #6EE7B7; }
.pl-trends-hero-context .negative { color: #FCA5A5; }

.pl-trends-hero-visual {
    position: relative;
    z-index: 1;
    text-align: center;
    min-width: 100px;
}

.pl-trends-hero-visual-value {
    font-family: var(--liq-font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1;
}

.pl-trends-hero-visual-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.5;
    margin-top: 0.35rem;
}

/* ===================================================================
   METRIC CARDS GRID
   =================================================================== */

.plt-metrics-grid {
    display: grid;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
}

.plt-metrics-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.plt-metrics-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.plt-metric-card {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-top: 3px solid var(--liq-accent);
    border-radius: 10px;
    padding: 1rem 1.125rem;
    transition: all 0.2s ease;
}

.plt-metric-card:hover {
    box-shadow: var(--liq-shadow-md);
    transform: translateY(-1px);
}

.plt-metric-label {
    font-family: var(--liq-font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--liq-text-muted);
    margin-bottom: 0.625rem;
}

.plt-metric-value {
    font-family: var(--liq-font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--liq-text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}

.plt-metric-sub {
    font-family: var(--liq-font-body);
    font-size: 0.75rem;
    color: var(--liq-text-secondary);
    line-height: 1.4;
}

.plt-metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-family: var(--liq-font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1875rem 0.5rem;
    border-radius: 100px;
    line-height: 1;
    white-space: nowrap;
    margin-top: 0.5rem;
}

.plt-metric-trend.positive { color: var(--liq-profit); background: rgba(4, 120, 87, 0.08); }
.plt-metric-trend.negative { color: var(--liq-loss); background: rgba(190, 18, 60, 0.08); }

/* ===================================================================
   CHART CARDS
   =================================================================== */

.plt-chart-card {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 12px;
    overflow: hidden;
    margin: 0 1.75rem 1.25rem;
    transition: box-shadow 0.2s ease;
}

.plt-chart-card:hover {
    box-shadow: var(--liq-shadow-md);
}

.plt-chart-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--liq-border-light);
}

.plt-chart-title {
    font-family: var(--liq-font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--liq-text);
    margin: 0;
}

.plt-chart-subtitle {
    font-family: var(--liq-font-body);
    font-size: 0.75rem;
    color: var(--liq-text-muted);
    margin-top: 0.2rem;
}

.plt-chart-host {
    padding: 1rem 1.25rem;
}

.plt-chart-host .liq-apex-host {
    width: 100%;
}

/* ===================================================================
   INSIGHTS PANEL
   =================================================================== */

.plt-insights {
    margin: 0 1.75rem 1.5rem;
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 12px;
    overflow: hidden;
}

.plt-insights-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--liq-border-light);
    font-family: var(--liq-font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--liq-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.plt-insight-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background 0.15s ease;
}

.plt-insight-row:hover { background: rgba(0, 0, 0, 0.015); }
.plt-insight-row:last-child { border-bottom: none; }

.plt-insight-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.4rem;
}

.plt-insight-dot.positive { background: var(--liq-profit); }
.plt-insight-dot.negative { background: var(--liq-loss); }
.plt-insight-dot.neutral  { background: var(--liq-text-muted); }

.plt-insight-text {
    font-family: var(--liq-font-body);
    font-size: 0.8125rem;
    color: var(--liq-text-secondary);
    line-height: 1.55;
}

.plt-insight-text strong { color: var(--liq-text); font-weight: 600; }

/* ===================================================================
   QUARTERLY SUMMARY (Seasonality)
   =================================================================== */

.plt-quarter-summary {
    margin: 0 1.75rem 1.25rem;
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 12px;
    padding: 1.25rem;
}

.plt-quarter-summary-title {
    font-family: var(--liq-font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--liq-text);
    margin-bottom: 1rem;
}

.plt-quarter-bars {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.plt-qbar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plt-qbar-label {
    font-family: var(--liq-font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--liq-text-secondary);
    width: 2rem;
    flex-shrink: 0;
}

.plt-qbar-track {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 100px;
    overflow: hidden;
}

.plt-qbar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #2563EB);
    border-radius: 100px;
    transition: width 0.6s ease;
}

.plt-qbar-value {
    font-family: var(--liq-font-mono);
    font-size: 0.75rem;
    color: var(--liq-text-secondary);
    width: 5rem;
    text-align: right;
    flex-shrink: 0;
}

/* ===================================================================
   COMPARISON TABLE (YoY)
   =================================================================== */

.plt-comparison-table {
    margin: 0 1.75rem 1.25rem;
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 12px;
    overflow: hidden;
}

.plt-comparison-table table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--liq-font-body);
    font-size: 0.8125rem;
}

.plt-comparison-table thead th {
    padding: 0.75rem 1rem;
    text-align: right;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--liq-text-muted);
    border-bottom: 1px solid var(--liq-border);
    background: rgba(0, 0, 0, 0.015);
}

.plt-comparison-table thead th:first-child {
    text-align: left;
}

.plt-comparison-table tbody td {
    padding: 0.625rem 1rem;
    text-align: right;
    color: var(--liq-text-secondary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    font-family: var(--liq-font-mono);
    font-size: 0.8125rem;
}

.plt-comparison-table tbody tr:last-child td {
    border-bottom: none;
}

.plt-comparison-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.015);
}

.plt-row-label {
    text-align: left !important;
    font-family: var(--liq-font-body) !important;
    font-weight: 500;
    color: var(--liq-text) !important;
}

.plt-row-highlight td {
    font-weight: 600;
    color: var(--liq-text) !important;
    background: rgba(74, 144, 128, 0.03);
}

.plt-change.positive { color: var(--liq-profit) !important; }
.plt-change.negative { color: var(--liq-loss) !important; }

/* ===================================================================
   FISCAL NOTE
   =================================================================== */

.pl-trends-fiscal-note {
    text-align: center;
    padding: 0 1.75rem 1.5rem;
    font-family: var(--liq-font-body);
    font-size: 0.75rem;
    color: var(--liq-text-muted);
    font-style: italic;
    line-height: 1.5;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 1024px) {
    .plt-metrics-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .plt-metrics-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .pl-trends-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    .plt-view-tabs {
        padding: 0 1rem;
    }
    .plt-tab span { display: none; }
    .plt-tab { padding: 0.75rem 0.875rem; }
    .plt-metrics-grid.cols-4,
    .plt-metrics-grid.cols-3 { grid-template-columns: 1fr; padding: 1rem; }
    .pl-trends-hero {
        margin: 1rem;
        padding: 1.25rem;
        flex-direction: column;
        gap: 1rem;
    }
    .pl-trends-hero-value { font-size: 2rem; }
    .plt-chart-card { margin: 0 1rem 1rem; }
    .plt-insights { margin: 0 1rem 1.25rem; }
    .plt-quarter-summary { margin: 0 1rem 1rem; }
    .plt-comparison-table { margin: 0 1rem 1rem; overflow-x: auto; }
}

/* ===================================================================
   PRINT
   =================================================================== */

@media print {
    .pl-trends-module { background: white; }
    .plt-view-tabs { display: none; }
    .pl-trends-hero {
        background: #1E293B;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .plt-chart-card,
    .plt-metric-card {
        box-shadow: none;
        border: 1px solid var(--liq-border);
    }
    .plt-chart-card:hover,
    .plt-metric-card:hover {
        box-shadow: none;
        transform: none;
    }
}
