/* Detailed 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 detailed 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 detailed 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;
}

/* Statistics Tables */
.stats-section {
    margin: 2rem auto;
    max-width: 50rem;
}

.stats-section h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.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);
}

/* Toggle Buttons */
.period-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.period-toggle button {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--theme-shade-0);
    background-color: white;
    color: var(--theme-shade-0);
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.period-toggle button:hover {
    background-color: var(--theme-shade-0);
    color: white;
}

.period-toggle button.active {
    background-color: var(--theme-shade-0);
    color: white;
}

/* Draw Details Section */
.draw-details {
    margin: 2rem auto;
    max-width: 50rem;
}

.draw-info {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.draw-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.draw-info-item {
    padding: 0.5rem;
}

.draw-info-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.draw-info-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--theme-shade-0);
    font-family: 'Courier New', monospace;
}

/* Prize Breakdown Table */
.prize-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;
}

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

.prize-breakdown thead th {
    padding: 0.75rem 1rem;
    text-align: right;
    font-weight: 700;
}

.prize-breakdown thead th:first-child {
    text-align: left;
}

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

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

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

.prize-breakdown tbody td {
    padding: 0.75rem 1rem;
    text-align: right;
    font-family: 'Courier New', monospace;
}

.prize-breakdown tbody td:first-child {
    text-align: left;
    font-weight: 700;
    color: var(--theme-shade-0);
}

.prize-breakdown tbody td.percentage {
    color: #666;
    font-size: 0.9rem;
}

/* Prize row highlighting for jackpots */
.prize-breakdown tbody tr.jackpot {
    background-color: #fffbf0;
    font-weight: 700;
}

.prize-breakdown tbody tr.jackpot td {
    color: #b8860b;
}

/* Expected Frequency Table */
.frequency-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;
}

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

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

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

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

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

.frequency-table tbody td {
    padding: 0.75rem 1rem;
}

.frequency-table tbody td:first-child {
    font-weight: 700;
    color: var(--theme-shade-0);
}

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

/* Source Link */
.source-link {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-left: 4px solid var(--theme-shade-0);
    border-radius: 4px;
}

.source-link strong {
    color: var(--theme-shade-1);
}

.source-link a {
    word-break: break-all;
}

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

#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 for Tables */
@media (max-width: 768px) {
    .stats-table thead th:first-child,
    .stats-table tbody td:first-child {
        width: 50%;
    }
    
    .stats-table thead th,
    .stats-table tbody td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .draw-info-grid {
        grid-template-columns: 1fr;
    }
    
    .prize-breakdown thead th,
    .prize-breakdown tbody td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .frequency-table thead th,
    .frequency-table tbody td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .stats-section {
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .stats-table {
        font-size: 0.85rem;
    }
    
    .period-toggle {
        flex-direction: column;
    }
    
    .period-toggle button {
        width: 100%;
    }
    
    .draw-info-value {
        font-size: 1rem;
    }
    
    /* Stack prize breakdown table on very small screens */
    .prize-breakdown thead {
        display: none;
    }
    
    .prize-breakdown tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 0.5rem;
    }
    
    .prize-breakdown tbody td {
        display: block;
        text-align: left !important;
        padding: 0.25rem 0;
    }
    
    .prize-breakdown tbody td:before {
        content: attr(data-label) ": ";
        font-weight: 700;
        color: #666;
    }
}

/* 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 {
    .period-toggle {
        display: none;
    }
    
    .stats-table,
    .prize-breakdown,
    .frequency-table {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .stats-table tbody tr:hover,
    .prize-breakdown tbody tr:hover,
    .frequency-table tbody tr:hover {
        background-color: transparent;
    }
}
