/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    background-color: #f8f6f0;
    color: #000;
    line-height: 1.4;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.herald-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
}

.herald-header h1 {
    font-size: 2.5rem;
    font-weight: normal;
    letter-spacing: 2px;
}

/* Date Picker Section */
.date-picker-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #000;
    padding-bottom: 15px;
}

.date-picker-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Current Date Display (Top Line) */
.current-date-display {
    font-size: 1.2rem;
    font-weight: normal;
    text-align: center;
    color: #000;
}

/* Date Navigation Container (Bottom Line) - Updated for Pikaday */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Calendar trigger styling integration */
.date-picker-wrapper .calendar-trigger {
    margin-top: 5px;
}

.date-nav-btn {
    background: none;
    border: none;
    font-size: 1rem;
    padding: 4px 8px;
    cursor: pointer;
    margin: 0 15px;
    color: #000 !important; /* Force black color on all devices */
    -webkit-appearance: none; /* Remove Safari default button styling */
    appearance: none;
}

.date-nav-btn:hover {
    background: #f0f0f0;
    color: #000 !important;
}

.date-nav-btn:focus {
    outline: none;
    color: #000 !important;
}

.date-picker-container {
    display: flex;
    gap: 8px;
}

.date-btn {
    background: none;
    border: none;
    cursor: pointer;
    text-align: center;
    padding: 3px 8px;
    min-width: 50px;
    color: #000 !important; /* Force black color on all devices */
    text-decoration: none; /* Remove any link styling */
    -webkit-appearance: none; /* Remove Safari default button styling */
    appearance: none;
    font-size: 0.85rem;
}

.date-btn:hover {
    background: #f5f5f5;
    color: #000 !important;
}

.date-btn:focus {
    outline: none;
    color: #000 !important;
}

.date-btn.active {
    font-weight: bold !important;
    color: #000 !important;
}

.date-btn.active .date-compact {
    border-top: 2px solid #000 !important;
    border-bottom: 2px solid #000 !important;
    padding-top: 2px;
    padding-bottom: 2px;
}

.date-btn.today {
    /* Center date (not bold unless also selected) */
    font-weight: normal !important;
    color: #000 !important;
}

.date-compact {
    font-size: 0.85rem;
    display: block;
    white-space: nowrap;
}

/* Top Metrics Section */
.metrics-section {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    border-bottom: 1px solid #000;
    padding-bottom: 20px;
}

.metric-item {
    text-align: center;
    flex: 1;
}

.metric-label {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.metric-subtitle {
    font-size: 0.7rem;
    font-weight: normal;
    color: #666;
    margin-bottom: 5px;
}

.metric-value {
    font-size: 0.9rem;
}

/* Games Section */
.games-section {
    margin-bottom: 20px;
}

.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

/* Individual Game Box */
.game-box {
    border-bottom: 1px solid #ccc;
    padding-bottom: 15px;
    position: relative;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.game-status {
    font-weight: bold;
    text-align: right;
}

/* Secondary status for front page - centered under pitcher info */
.game-secondary-status {
    font-size: 0.7rem;
    font-weight: normal;
    color: #666;
    text-align: center;
    margin-top: 5px;
}

/* Secondary status for game detail page - centered under main status */
.game-detail-secondary-status {
    font-size: 0.8rem;
    font-weight: normal;
    color: #666;
    text-align: center;
    margin-top: 5px;
}

.rhe-headers {
    display: flex;
    font-weight: bold;
    font-size: 0.9rem;
    align-items: flex-start;
    min-height: 28px;
}

.rhe-headers span {
    width: 20px;
    text-align: center;
    margin-right: 15px;
}

.rhe-headers span:last-child {
    margin-right: 0;
}

.team-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.team-info {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.team-name {
    font-weight: bold;
    font-size: 0.95rem;
}

.team-record {
    font-size: 0.85rem;
    color: #666;
}

.rhe-values {
    display: flex;
    font-size: 0.9rem;
    align-items: flex-start;
    min-height: 28px;
}

.rhe-values span {
    width: 20px;
    text-align: center;
    margin-right: 15px;
}

.rhe-values span:last-child {
    margin-right: 0;
}

.pitcher-info {
    font-size: 0.8rem;
    color: #666;
    margin-top: 8px;
    text-align: left;
}

/* Special Game Alert (Perfect Game, No Hitter) */
.special-game-alert {
    font-size: 0.85rem;
    font-weight: bold;
    color: #2d1015; /* Dark rusty red, almost black */
    margin-top: 8px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Game Details Link */
.game-details-link {
    position: absolute;
    bottom: 5px;
    right: 0;
    font-size: 0.8rem;
    color: #666;
    text-decoration: none;
    display: none; /* Hidden by default (desktop) */
}

.game-details-link:hover {
    color: #333;
    text-decoration: underline;
}

.game-details-link:active {
    color: #000;
}

/* Show Details link only on touch devices */
@media (pointer: coarse) {
    .game-details-link {
        display: block;
    }
}

/* At-Bat Visual Display */
.at-bat-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 0;
    background: none;
    border: none;
    font-size: 0.7rem;
    gap: 2px;
    flex: 1;
}

.at-bat-display.hidden {
    display: none;
}

/* Base Diamonds Container */
.bases-container {
    position: relative;
    width: 40px;
    height: 28px;
    margin: 0;
}

.base {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 1px solid #333;
    transform: rotate(45deg);
    transition: background-color 0.3s ease;
}

.base.occupied {
    background: #333;
}

/* Base Positions - Inline Horizontal */
.base.first {
    right: 2px;
    bottom: 2px;
}

.base.second {
    left: 14px;
    top: 0;
}

.base.third {
    left: 2px;
    bottom: 2px;
}

/* Outs Display (Front Page) */
.outs-display {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin: 0;
}

.outs-circle {
    width: 8px;
    height: 8px;
    border: 1px solid #333;
    border-radius: 50%;
    background: #fff;
    transition: background-color 0.3s ease;
}

.outs-circle.active {
    background: #333;
}


/* Current Batter Name */
.current-batter {
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
    color: #333;
    margin-top: 4px;
}

/* Game Detail Page At-Bat Display */
.game-detail .at-bat-display {
    margin: 10px 0;
    padding: 8px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.8rem;
    flex-direction: column;
    gap: 4px;
    flex: none;
}

.game-detail .bases-container {
    width: 50px;
    height: 50px;
    margin-bottom: 4px;
}

.game-detail .base {
    width: 10px;
    height: 10px;
    border: 1px solid #333;
}

.game-detail .base.first {
    right: 8px;
    bottom: 20px;
}

.game-detail .base.second {
    left: 20px;
    top: 8px;
}

.game-detail .base.third {
    left: 8px;
    bottom: 20px;
}

.game-detail .base.home {
    left: 20px;
    bottom: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: none;
}

/* Game Detail Outs Display - Use circles like front page */
.game-detail .outs-display {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin: 0;
}

/* Game Detail Count Display (Balls and Strikes) */
.game-detail .count-display {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 6px;
    justify-content: center;
    align-items: center;
}

.game-detail .count-section {
    display: flex;
    gap: 2px;
    align-items: center;
}

.game-detail .count-label {
    font-size: 0.7rem;
    font-weight: bold;
    margin-right: 2px;
}

.game-detail .count-circle {
    width: 10px;
    height: 10px;
    border: 1px solid #333;
    border-radius: 50%;
    background: #fff;
    transition: background-color 0.3s ease;
}

.game-detail .count-circle.active {
    background: #333;
}

.game-detail .outs-display {
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.game-detail .current-batter {
    font-size: 0.8rem;
}

/* Loading and Error States */
.loading, .error {
    text-align: center;
    padding: 20px;
    font-size: 1.1rem;
}

.error {
    color: #d32f2f;
}

/* Mock Data Styling */
.mock-data {
    color: red;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .herald-header h1 {
        font-size: 2rem;
    }
    
    .current-date-display {
        font-size: 1rem;
    }
    
    .date-picker-container {
        gap: 6px;
    }
    
    .date-btn {
        min-width: 45px;
        padding: 3px 6px;
        font-size: 0.8rem;
    }
    
    .date-compact {
        font-size: 0.8rem;
    }
    
    .metrics-section {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 columns */
        gap: 10px 15px;
        padding-bottom: 15px;
    }
    
    .metric-item {
        text-align: center;
    }
    
    .metric-label {
        font-size: 0.85rem;
        margin-bottom: 3px;
    }
    
    .metric-value {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .games-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .rhe-headers, .rhe-values {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .current-date-display {
        font-size: 0.95rem;
    }
    
    .date-nav-btn {
        margin: 0 8px;
        padding: 3px 6px;
        font-size: 0.9rem;
    }
    
    .date-btn {
        min-width: 40px;
        padding: 2px 4px;
        font-size: 0.75rem;
    }
    
    .date-compact {
        font-size: 0.75rem;
    }
    
    .metrics-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .metric-label {
        font-size: 0.75rem;
    }
    
    .metric-value {
        font-size: 0.7rem;
    }
}