/* Historic Trends Viewer Styles - css/htv-style.css */

/* Scoped Variables under the component class for better isolation */
.historic-trends-viewer-component {
    --htv-font-primary: 'Inter', sans-serif;

    /* Brand Colors & Accents */
    --htv-brand-primary-green: #00D084;
    --htv-brand-secondary-green: #00A060;
    --htv-brand-accent-orange: #FF9500;
    --htv-brand-light-green-accent: #A0F0D0;
    --htv-brand-moderate-green-accent: #50E0A8;

    /* Color Palette for Historical Discount Intensity */
    --htv-historical-high-discount-bg: var(--htv-brand-primary-green);
    --htv-historical-moderate-discount-bg: var(--htv-brand-moderate-green-accent);
    --htv-historical-limited-discount-bg: var(--htv-brand-light-green-accent);
    --htv-historical-regular-week-bg: #e5e7eb; /* Tailwind gray-200 */
    /* --htv-historical-regular-week-bg-dark: #4b5563; REMOVED */

    --htv-current-week-indicator-color: var(--htv-brand-primary-green);

    --htv-container-bg: #ffffff;
    --htv-brand-subtle-border: #e5e7eb; /* Tailwind gray-200 for a lighter border */

    /* UI Element Colors */
    --htv-text-primary: #111827; /* Tailwind gray-900 for primary text */
    --htv-text-secondary: #4b5563; /* Tailwind gray-600 */
    --htv-text-tertiary: #6b7280; /* Tailwind gray-500 */
    --htv-text-on-accent: #ffffff;
    --htv-text-on-orange: #ffffff;

    --htv-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); /* Tailwind shadow-md */
    --htv-border-radius-md: 0.5rem; /* Tailwind rounded-lg */
    --htv-border-radius-lg: 0.75rem; /* Tailwind rounded-xl */

    /* REMOVED Dark Mode Variables Section */
    /*
    --htv-container-bg-dark: #0f172a;
    --htv-content-bg-dark: #1e293b;
    --htv-text-primary-dark: #f1f5f9;
    --htv-text-secondary-dark: #94a3b8;
    --htv-text-tertiary-dark: #64748b;
    --htv-brand-subtle-border-dark: #334155;
    */
}

.historic-trends-viewer-component {
    font-family: var(--htv-font-primary);
    background-color: var(--htv-container-bg);
    color: var(--htv-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
	padding-bottom: 20px; 
}

/* --- REMOVED All .dark ... rules --- */
/* Example of removed section:
.dark .historic-trends-viewer-component { ... }
.dark .historic-trends-viewer-component .htv-header, ... { ... }
etc.
*/


/* --- Header Refinement --- */
.historic-trends-viewer-component .htv-header {
    /* Padding and border are handled by Tailwind classes in PHP */
}
.historic-trends-viewer-component .htv-header h1 {
    line-height: 1.1;
}
.historic-trends-viewer-component .htv-header p {
    max-width: 45em;
}
@media (max-width: 1023px) { /* lg breakpoint */
    .historic-trends-viewer-component .htv-mobile-sticky-header {
        position: sticky; top: 0; z-index: 40;
        background-color: var(--htv-container-bg); /* Ensure light mode bg */
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    /* Removed .dark .historic-trends-viewer-component .htv-mobile-sticky-header rule */
    .historic-trends-viewer-component .htv-header h1 {
        font-size: 1.75rem;
    }
     .historic-trends-viewer-component .htv-header {
        padding: 1rem 1.25rem;
    }
}

/* --- Custom Scrollbar --- */
.historic-trends-viewer-component .htv-custom-scrollbar::-webkit-scrollbar { width: 6px; }
.historic-trends-viewer-component .htv-custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.historic-trends-viewer-component .htv-custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
/* Removed .dark ... scrollbar thumb rule */
.historic-trends-viewer-component .htv-custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #a0aec0; }
/* Removed .dark ... scrollbar thumb hover rule */

/* --- Timeline & Info Line --- */
.historic-trends-viewer-component .htv-timeline-week-segment {
    transition: all 0.15s ease-in-out; cursor: pointer; color: var(--htv-text-on-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; text-align: center; position: relative;
}
.historic-trends-viewer-component .htv-timeline-week-segment:hover {
    filter: brightness(1.15); transform: scale(1.03); z-index: 10;
}
.historic-trends-viewer-component .htv-timeline-week-segment.htv-intensity-high { background-color: var(--htv-historical-high-discount-bg); }
.historic-trends-viewer-component .htv-timeline-week-segment.htv-intensity-moderate { background-color: var(--htv-historical-moderate-discount-bg); }
.historic-trends-viewer-component .htv-timeline-week-segment.htv-intensity-limited { background-color: var(--htv-historical-limited-discount-bg); color: var(--htv-text-secondary); }
.historic-trends-viewer-component .htv-timeline-week-segment.htv-intensity-regular { background-color: var(--htv-historical-regular-week-bg); color: var(--htv-text-secondary); }
/* Removed .dark rules for .htv-timeline-week-segment.htv-intensity-regular and .htv-intensity-limited */

.historic-trends-viewer-component .htv-timeline-week-segment.htv-past-week { opacity: 0.6; }
.historic-trends-viewer-component .htv-timeline-week-segment.htv-current-week {
    border: 2px solid var(--htv-current-week-indicator-color);
    box-shadow: 0 0 6px color-mix(in srgb, var(--htv-current-week-indicator-color) 70%, transparent);
    opacity: 1 !important; z-index: 5;
    background-color: color-mix(in srgb, var(--htv-historical-regular-week-bg) 70%, var(--htv-current-week-indicator-color) 30%);
}
/* Removed .dark rule for .htv-timeline-week-segment.htv-current-week background */
.historic-trends-viewer-component .htv-timeline-week-segment.htv-current-week .htv-week-number-label {
    font-weight: bold; color: var(--htv-text-primary);
}
/* Removed .dark rule for .htv-timeline-week-segment.htv-current-week .htv-week-number-label color */
.historic-trends-viewer-component .htv-timeline-week-segment .htv-week-number-label {
    font-size: 0.6rem; line-height: 0.8rem;
}
.historic-trends-viewer-component .htv-timeline-week-segment.htv-intensity-high .htv-week-number-label,
.historic-trends-viewer-component .htv-timeline-week-segment.htv-intensity-moderate .htv-week-number-label {
    color: var(--htv-text-on-accent);
}

.historic-trends-viewer-component .htv-timeline-info-line {
    max-height: 0; opacity: 0; overflow: hidden;
    transition: max-height 0.35s ease-in-out, opacity 0.35s ease-in-out, padding-top 0.35s ease-in-out, padding-bottom 0.35s ease-in-out, margin-top 0.35s ease-in-out, border-color 0.35s ease-in-out;
    border-top: 1px solid transparent; border-bottom: 1px solid transparent;
    padding-left: 0.75rem; padding-right: 0.75rem; margin-top: 0;
    background-color: color-mix(in srgb, var(--htv-container-bg) 95%, var(--htv-brand-primary-green) 5%);
    border-radius: var(--htv-border-radius-md);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    font-size: 0.875rem; line-height: 1.4; color: var(--htv-text-secondary);
}
/* Removed .dark rule for .htv-timeline-info-line background and color */
.historic-trends-viewer-component .htv-timeline-info-line.htv-visible {
    max-height: 120px; opacity: 1;
    border-top-color: var(--htv-brand-subtle-border);
    border-bottom-color: var(--htv-brand-subtle-border);
    padding-top: 0.75rem; padding-bottom: 0.75rem; margin-top: 0.75rem;
}
/* Removed .dark rule for .htv-timeline-info-line.htv-visible border colors */
.historic-trends-viewer-component .htv-timeline-info-line strong {
    color: var(--htv-brand-secondary-green); font-weight: 600;
}
/* Removed .dark rule for .htv-timeline-info-line strong color */
.historic-trends-viewer-component .htv-timeline-info-line em {
    font-style: normal; color: var(--htv-text-tertiary);
}
/* Removed .dark rule for .htv-timeline-info-line em color */


/* --- General Accordion Styles --- */
.historic-trends-viewer-component .htv-accordion-header {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; padding: 0.75rem; text-align: left;
    font-weight: 500; border-radius: var(--htv-border-radius-md);
    transition: background-color 0.2s ease-in-out; cursor: pointer;
    border: 1px solid transparent;
    box-sizing: border-box;
}
.historic-trends-viewer-component .htv-accordion-header:focus { outline: none; }
.historic-trends-viewer-component .htv-accordion-header:focus-visible {
    box-shadow: 0 0 0 2px var(--htv-container-bg), 0 0 0 4px var(--htv-brand-primary-green);
}
.historic-trends-viewer-component .htv-accordion-header[aria-expanded="true"] .htv-accordion-arrow {
    transform: rotate(180deg);
}
.historic-trends-viewer-component .htv-accordion-arrow {
    transition: transform 0.3s ease; font-size: 0.75rem;
}
.historic-trends-viewer-component .htv-accordion-header > span {
    background-color: transparent; flex-grow: 1;
    display: flex; align-items: center;
}

/* --- Intensity Legend & Buttons --- */
.historic-trends-viewer-component .htv-intensity-box {
    width: 1em; height: 1em; display: inline-block; margin-right: 0.5em; border-radius: 3px;
    vertical-align: middle;
}
.historic-trends-viewer-component .htv-button-brand {
    background-color: var(--htv-brand-primary-green); color: var(--htv-text-on-accent);
    transition: background-color 0.2s ease;
}
.historic-trends-viewer-component .htv-button-brand:hover {
    background-color: var(--htv-brand-secondary-green);
}
.historic-trends-viewer-component .htv-button-orange-brand {
    background-color: var(--htv-brand-accent-orange); color: var(--htv-text-on-orange);
    transition: background-color 0.2s ease;
}
.historic-trends-viewer-component .htv-button-orange-brand:hover { background-color: #E67E22; }
/* Removed .dark rules for .htv-button-orange-brand */

/* --- Mobile Specific Accordions --- */
.historic-trends-viewer-component .htv-accordion-header-brand {
    background-color: var(--htv-brand-secondary-green);
    color: var(--htv-text-on-accent);
}
.historic-trends-viewer-component .htv-accordion-header-brand:hover {
    background-color: var(--htv-brand-primary-green);
}
.historic-trends-viewer-component .htv-mobile-week-item {
    padding: 0.375rem 0.25rem; border-bottom: 1px solid var(--htv-brand-subtle-border);
    cursor: pointer;
}
.historic-trends-viewer-component .htv-mobile-week-item:last-child { border-bottom: none; }
/* Removed .dark rule for .htv-mobile-week-item border */
.historic-trends-viewer-component .htv-mobile-week-item .htv-intensity-icon { margin-right: 0.35rem; }
.historic-trends-viewer-component .htv-mobile-week-item.htv-current-week-mobile-entry {
    background-color: rgba(0, 208, 132, 0.08);
    border-left: 3px solid var(--htv-current-week-indicator-color);
    padding-left: calc(0.25rem + 3px); margin-left: -3px;
}
/* Removed .dark rule for .htv-mobile-week-item.htv-current-week-mobile-entry background */


/* --- Traditional Tooltip (Mobile) --- */
.htv-tooltip-popup {
    position: absolute; background-color: #262626; color: #f0f0f0;
    padding: 8px 12px; border-radius: var(--htv-border-radius-md);
    font-size: 0.875rem; z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0; visibility: hidden;
    transition: opacity 0.15s ease, visibility 0s linear 0.15s;
    max-width: 280px; pointer-events: none;
}
.htv-tooltip-popup.htv-visible { opacity: 1; visibility: visible; transition: opacity 0.15s ease; }
.htv-tooltip-popup strong { font-weight: 600; color: #ffffff; }
.htv-tooltip-popup br { margin-bottom: 2px; display: block; content: ""; }

/* --- Sidebar Item Highlight --- */
.historic-trends-viewer-component .htv-sidebar-period-item.htv-highlighted-by-timeline {
    background-color: var(--htv-brand-light-green-accent) !important;
    transition: background-color 0.3s ease-out;
    border-radius: var(--htv-border-radius-md);
}
/* Removed .dark rule for .htv-sidebar-period-item.htv-highlighted-by-timeline */

/* --- Loading State --- */
.historic-trends-viewer-component .htv-loading-state {
    min-height: 200px; display: flex; align-items: center; justify-content: center;
}

/* --- Disclaimer Accordion (Desktop & Mobile - ENHANCED) --- */
/* Uses common class: htv-styled-disclaimer-accordion */
.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-item {
    width: 100%;
    box-sizing: border-box;
}
.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    border-radius: var(--htv-border-radius-lg);
    background-color: #f9fafb; /* gray-50 */
    color: var(--htv-text-primary);
    box-shadow: var(--htv-card-shadow);
    border: 1px solid var(--htv-brand-subtle-border);
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}
/* Removed .dark rule for .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header */

.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header:hover {
    background-color: #f3f4f6; /* gray-100 */
    border-color: color-mix(in srgb, var(--htv-brand-subtle-border) 70%, black);
    box-shadow: 0 4px 8px -2px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}
/* Removed .dark rule for .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header:hover */

.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header[aria-expanded="true"] {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background-color: var(--htv-container-bg);
    border-bottom-color: transparent;
    box-shadow: var(--htv-card-shadow);
}
/* Removed .dark rule for .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header[aria-expanded="true"] */

.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header .htv-accordion-arrow {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    font-size: 0.85rem;
    color: var(--htv-text-tertiary);
}
/* Removed .dark rule for .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header .htv-accordion-arrow */
.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-header[aria-expanded="true"] .htv-accordion-arrow {
    transform: rotate(180deg);
    color: var(--htv-brand-primary-green);
}

.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.35s ease-in-out 0.05s, padding-top 0.35s ease-in-out, padding-bottom 0.35s ease-in-out;
    padding: 0 1.25rem;
    border: 1px solid var(--htv-brand-subtle-border);
    border-top: none;
    border-bottom-left-radius: var(--htv-border-radius-lg);
    border-bottom-right-radius: var(--htv-border-radius-lg);
    background-color: var(--htv-container-bg);
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--htv-text-secondary);
    box-shadow: var(--htv-card-shadow);
    margin-top: -1px;
}
/* Removed .dark rule for .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-content */

.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-content.htv-visible {
    max-height: 300px;
    opacity: 1;
    padding-top: 1rem;
    padding-bottom: 1rem;
}
.historic-trends-viewer-component .htv-styled-disclaimer-accordion .htv-disclaimer-accordion-content p {
    margin: 0;
}
