/* Historical Returns Page Specific Styles - Updated with Theme Variables */

/* Theme Variables (if not already defined in styles.css) */
:root {
    --theme-shade-0: #003366;
    --theme-shade-1: #004080;
    --theme-d3: #002244;
    --theme-d5: #001122;
    --main-text-color: #171717;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Header for historical page */
header.theme-d3 {
    background: var(--theme-d3);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

header.theme-d3 h1 {
    color: white;
    margin: 0;
}

header.theme-d3 h1 .line {
    display: block;
}

/* Navigation for historical page */
nav.theme-d5 {
    background: var(--theme-d5);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav.theme-d5 .spacer {
    flex: 1;
}

nav.theme-d5 a.coffee {
    color: white;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s ease;
}

nav.theme-d5 a.coffee:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main content wrapper */
main.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Input Groups */
.historical-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem auto;
    max-width: 50rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    color: var(--theme-shade-1);
    font-size: 0.95rem;
}

.input-group .input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

.input-group .input:focus {
    border-color: var(--theme-shade-0);
    outline: none;
}

.input-group .date-input {
    font-family: inherit;
}

/* Period Breakdown Table */
.period-breakdown {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
}

.period-breakdown thead {
    background-color: var(--theme-shade-0);
    color: white;
}

.period-breakdown thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
}

.period-breakdown thead th:nth-child(2),
.period-breakdown thead th:nth-child(3),
.period-breakdown thead th:nth-child(4),
.period-breakdown thead th:nth-child(5) {
    text-align: right;
}

.period-breakdown tbody tr {
    border-bottom: 1px solid #eee;
}

.period-breakdown tbody tr:last-child {
    border-bottom: none;
}

.period-breakdown tbody tr:hover {
    background-color: #f9f9f9;
}

.period-breakdown tbody td {
    padding: 0.75rem 1rem;
    text-align: left;
}

.period-breakdown tbody td:nth-child(2),
.period-breakdown tbody td:nth-child(3),
.period-breakdown tbody td:nth-child(4),
.period-breakdown tbody td:nth-child(5) {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.period-breakdown tbody td:first-child {
    font-weight: 600;
    color: var(--theme-shade-1);
}

/* Comparison Section */
#comparisonSection {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

.comparison-text {
    line-height: 1.6;
    color: var(--main-text-color);
}

.comparison-text strong {
    color: var(--theme-shade-0);
    font-weight: 700;
}

/* Stats Section Enhancements */
.stats-section {
    margin: 2rem auto;
    max-width: 50rem;
}

.stats-section h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: var(--theme-shade-1);
}

/* Stats Table (shared with detailed) */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.stats-table thead {
    background-color: var(--theme-shade-0);
    color: white;
}

.stats-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
}

.stats-table thead th:first-child {
    width: 40%;
}

.stats-table tbody tr {
    border-bottom: 1px solid #eee;
}

.stats-table tbody tr:last-child {
    border-bottom: none;
}

.stats-table tbody tr:hover {
    background-color: #f9f9f9;
}

.stats-table tbody td {
    padding: 0.75rem 1rem;
    text-align: left;
}

.stats-table tbody td:first-child {
    font-weight: 600;
    color: var(--theme-shade-1);
}

.stats-table tbody td:not(:first-child) {
    font-family: 'Courier New', monospace;
    color: var(--main-text-color);
}

/* Investment Input Section */
#investmentInput {
    padding: 2rem 1rem;
    text-align: center;
}

#investmentInput h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--theme-shade-0);
}

/* Information Section */
#information {
    margin: 2rem auto;
    max-width: 50rem;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#information h2 {
    color: var(--theme-shade-0);
    margin-bottom: 1rem;
}

#information p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

#information p:last-child {
    margin-bottom: 0;
}

/* Links Navigation */
#links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.5rem 0 0;
}

#links a.nav {
    padding: 0.5rem 1rem;
    background-color: white;
    border: 2px solid var(--theme-shade-0);
    color: var(--theme-shade-0);
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
}

#links a.nav:hover {
    background-color: var(--theme-shade-0);
    color: white;
}

#links a.nav:after {
    content: " →";
    font-size: 1rem;
}

/* Footer Styles */
footer.theme-d5 {
    background: var(--theme-d5);
    color: rgba(255, 255, 255, 0.8);
    padding: 2rem 1rem;
    margin-top: 4rem;
}

footer.theme-d5 .horizontalBar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

footer.theme-d5 a {
    color: rgba(255, 255, 255, 0.9);
}

footer.theme-d5 a:hover {
    color: white;
}

.coffeeButtonSpace {
    min-width: 60px;
}

.coffeeButtonSpace.right {
    text-align: right;
}

/* Sticky footer for floating button */
#stickyFooter.sticky {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

#floatingFooter .horizontalBar {
    display: flex;
    justify-content: flex-end;
}

.coffeeButton {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    position: relative;
}

.coffeeButton::after {
    content: '☕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.75rem;
}

.coffeeButton:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .historical-inputs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-section {
        padding: 0 0.5rem;
    }
    
    .period-breakdown thead th,
    .period-breakdown tbody td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    #comparisonSection {
        padding: 1rem;
    }
    
    #information {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    #investmentInput h2 {
        font-size: 1.2rem;
    }
    
    .stats-section h2 {
        font-size: 1.1rem;
    }
    
    /* Stack period breakdown table on very small screens */
    .period-breakdown thead {
        display: none;
    }
    
    .period-breakdown tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 0.5rem;
    }
    
    .period-breakdown tbody td {
        display: block;
        text-align: left !important;
        padding: 0.25rem 0;
    }
    
    .period-breakdown tbody td:before {
        content: attr(data-label) ": ";
        font-weight: 700;
        color: #666;
    }
    
    .period-breakdown tbody td:first-child:before {
        content: "Period: ";
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Print Styles */
@media print {
    .historical-inputs,
    #links {
        display: none;
    }
    
    .stats-table,
    .period-breakdown {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .stats-table tbody tr:hover,
    .period-breakdown tbody tr:hover {
        background-color: transparent;
    }
}
