/* site.css */

/* 1. BRANDING & THEME */
:root {
    --pico-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --pico-color: hsl(210, 15%, 25%); /* Darker text for better readability */
    
    /* Four Pillars Holdings Palette */
    --fp-primary: #0D2C54;      /* Dark Navy Blue */
    --fp-secondary: #F1F1F1;    /* Light Grey Background */
    --fp-accent: #D4AF37;       /* Gold/Brass Accent */
    --fp-text-light: #F5F7FA;
    --fp-success: #28a745;
    --fp-danger: #dc3545;

    /* Override Pico Colors */
    --pico-primary: var(--fp-primary);
    --pico-primary-hover: hsl(214, 71%, 25%);
    --pico-primary-focus: var(--fp-primary); /* Remove default box-shadow */
    --pico-primary-inverse: var(--fp-text-light);
    --pico-card-background-color: #ffffff;
    --pico-card-border-color: #e1e4e8;
    --pico-background-color: var(--fp-secondary);
}

[data-theme="dark"] {
    --fp-primary: #2A9D8F;      /* Teal for dark mode */
    --fp-secondary: #1A1A1A;    /* Very dark grey */
    --fp-accent: #E9C46A;       /* Softer gold */
    --pico-card-background-color: #242424;
}

/* 2. BASE & LAYOUT */

.identity-panel {
    max-width: 480px; /* A good width for login forms */
    margin: 2rem auto; /* Centers the panel horizontally */
}


body {
    padding-bottom: 5rem;
}

nav.container-fluid {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--pico-card-border-color);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

[data-theme="dark"] nav.container-fluid {
    background-color: var(--pico-card-background-color);
}

main {
    padding-top: 2rem;
}

footer.container {
    padding-top: 2rem;
    border-top: 1px solid var(--pico-muted-border-color);
    text-align: center;
    color: var(--pico-muted-color);
}

/* 3. TYPOGRAPHY */
hgroup {
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

hgroup h1 {
    color: var(--fp-primary);
    font-weight: 700;
}

[data-theme="dark"] hgroup h1 {
    color: var(--pico-h1-color);
}

hgroup p {
    font-size: 1.1rem;
    color: var(--pico-secondary);
}

/* 4. COMPONENT STYLING */

/* Icon Styling */
ion-icon {
    vertical-align: -0.15em; /* Better vertical alignment with text */
    font-size: 1.2em; /* Slightly larger for better visibility */
}

/* Custom Button Styles */
[role="button"].danger {
    --pico-color: var(--fp-text-light);
    --pico-background-color: var(--fp-danger);
    --pico-border-color: var(--fp-danger);
}

[role="button"].danger:hover, [role="button"].danger:active {
    --pico-background-color: hsl(354, 70%, 48%);
    --pico-border-color: hsl(354, 70%, 48%);
}

/* Cards */
article {
    border-radius: var(--pico-border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Forms */
form fieldset {
    border: 1px solid var(--pico-card-border-color);
    padding: 1.5rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1.5rem;
}

legend {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--fp-primary);
    padding: 0 0.5rem;
}

/* Buttons with Icons */
[role="button"] .icon, button .icon {
  margin-right: 0.5rem;
}

/* Positive / Negative Colors */
.positive {
    color: var(--fp-success) !important;
    font-weight: 600;
}

.negative {
    color: var(--fp-danger) !important;
    font-weight: 600;
}

/* Winner Highlighting for Comparison Table */
.winner {
    background-color: hsla(145, 63%, 42%, 0.15) !important;
    font-weight: bold;
    outline: 2px solid hsla(145, 63%, 42%, 0.3);
    outline-offset: -2px;
}
[data-theme="dark"] .winner {
    background-color: hsla(145, 63%, 42%, 0.25) !important;
}



/* --- Base & Layout --- */
:root {
    --pico-form-element-spacing-vertical: 0.75rem;
}

body {
    padding-bottom: 5rem;
}

nav {
    margin-bottom: 2rem;
}

.grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

#key-metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* --- Typography --- */
hgroup {
    margin-bottom: 2rem;
}

legend {
    font-weight: bold;
}

abbr {
    text-decoration: underline dotted;
    cursor: help;
}

/* --- UI Components & Modules --- */
.theme-switcher {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
}

.theme-switcher label {
    margin: 0 0.5rem 0 0;
}

#sale-results-container {
    border: 1px solid var(--pico-primary-border);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: var(--pico-border-radius);
    background-color: var(--pico-card-background-color);
}

/* --- Tables --- */
table {
    margin-top: 2rem;
}

tfoot tr {
    border-top: 2px solid var(--pico-muted-border-color);
}

/* Specific styling for the initial cash breakdown table */
#initial-cash-table {
    width: 100%;
    margin-top: 1rem;
}

#initial-cash-table td {
    padding: 0.5rem;
}

#initial-cash-table tfoot {
    border-top: 2px solid var(--pico-primary-border);
}

/* Consolidated styles for the main projection table */
#projection-table th,
#projection-table td {
    padding: 0.5rem 0.75rem; /* Add consistent padding */
}

#projection-table th:not(:first-child),
#projection-table td:not(:first-child) {
    text-align: right;     /* Right-align all numeric headers and cells */
    white-space: nowrap;   /* Prevent long numbers from wrapping */
}

.overflow-auto {
    overflow-x: auto; /* This is the key property to add horizontal scroll */
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on mobile devices */
    padding-bottom: 0.5rem; /* Adds a little space so the scrollbar doesn't hide content */
}

/* Ensure the scrollable container's background matches the article */
article .overflow-auto {
    background-color: var(--pico-card-background-color);
}

/* --- Helper Classes --- */
.hidden {
    display: none;
}

.sub-label {
    font-size: 0.8rem;
    color: var(--pico-color-zinc-500);
    margin-top: -0.5rem;
}

/* Enhanced Positive/Negative Indicators */
.positive {
    color: var(--pico-color-green-600) !important; /* A slightly darker green for better contrast */
    font-weight: bold;
}

.negative {
    color: var(--pico-color-red-600) !important; /* A slightly darker red */
    font-weight: bold;
}

/* --- Comparison Page Styles --- */
.better-metric {
    font-weight: bold;
    color: var(--pico-color-green-600);
    border-bottom: 2px solid var(--pico-color-green-300);
    padding-bottom: 2px;
}

.scenario-column header {
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.scenario-column header h3 {
    margin-bottom: 0.5rem;
}

/* 5. PAGE & COMPONENT-SPECIFIC STYLES (continued) */
/* Home Page Dashboard */
.dashboard-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.dashboard-card header h3 {
    color: var(--fp-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

[data-theme="dark"] .dashboard-card header h3 {
    color: var(--pico-h3-color);
}

/* The main container for the 4-card layout on the homepage */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to a single column on mobile */
    gap: 1.5rem;
}

/* For tablets and larger, switch to 2 columns */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* For large desktops, switch to 4 columns */
@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* This is the key to making the cards equal height */
.dashboard-card {
    height: 100%; /* Make the <a> tag fill the entire grid cell */
}

.dashboard-card article {
    height: 100%; /* Make the <article> also fill the entire cell */
    display: flex;
    flex-direction: column; /* Stacks header and p tag vertically */
}

.dashboard-card article p {
    flex-grow: 1; /* Allows the paragraph to expand, pushing the footer down (if you had one) */
}

/* 5. PAGE & COMPONENT-SPECIFIC STYLES (Add this block) */

/* Calculator Page Chart Sizing */
.chart-container {
    position: relative; /* Required for Chart.js responsiveness */
    height: 400px;      /* Set a generous height for the charts */
    width: 100%;
    margin-bottom: 2rem; /* Add some space below each chart */
}

/* On smaller screens, reduce the height a bit */
@media (max-width: 768px) {
    .chart-container {
        height: 300px;
    }
}