/* ================================================
   THEME VARIABLES
   ================================================ */

/* Light mode (default) */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-nav: #ffffff;
    --bg-input: #ffffff;
    --bg-header-row: #f0f0f0;
    --bg-highlight: rgba(0, 102, 204, 0.06);
    --bg-active: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-faint: #aaaaaa;
    --border-color: #e0e0e0;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --accent: #0066cc;
    --nav-shadow: rgba(0, 0, 0, 0.06);
    --thumbnail-bg: #e8e8e8;
}

/* Dark mode */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-nav: #1a1a1a;
    --bg-input: #2d2d2d;
    --bg-header-row: #1a1a1a;
    --bg-highlight: rgba(0, 102, 204, 0.1);
    --bg-active: #404040;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #999999;
    --text-faint: #777777;
    --border-color: #404040;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --accent: #0066cc;
    --nav-shadow: rgba(0, 0, 0, 0.1);
    --thumbnail-bg: #1a1a1a;
}

/* ================================================
   THEME TOGGLE BUTTON
   ================================================ */

.theme-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1001;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 1px 4px var(--card-shadow);
    transition: background 0.2s ease, border-color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.theme-toggle:active {
    transform: scale(0.92);
}

/* ================================================
   CSS RESET
   ================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ================================================
   BASE STYLES
   ================================================ */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Portrait-only hint */
@media screen and (orientation: landscape) {
    body::before {
        content: "Please rotate your device to portrait mode for the best experience.";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: #ff9800;
        color: white;
        padding: 10px;
        text-align: center;
        font-size: 14px;
        z-index: 9999;
    }
}

/* Main App Container */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 60px;
}

/* Page Containers */
.page {
    display: none;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.page.active {
    display: block;
}

/* ================================================
   BOTTOM TAB NAVIGATION
   ================================================ */

#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    box-shadow: 0 -2px 10px var(--nav-shadow);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.nav-tab:active {
    opacity: 0.7;
}

.nav-tab.active {
    color: var(--accent);
}

.nav-tab .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

/* Placeholder styles for pages */
.page h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.placeholder-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

/* ================================================
   HOME PAGE STYLES
   ================================================ */

#home-page {
    padding: 0;
}

.home-header {
    background: var(--bg-primary);
    padding: 40px 20px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.team-logo {
    width: 340px;
    height: 340px;
    margin: 0 auto 20px;
    display: block;
    object-fit: contain;
}

.team-record {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.record-stat {
    text-align: center;
}

.record-stat .label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.record-stat .value {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: bold;
}

.home-content {
    padding: 20px;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

/* Game Day Card */
.game-day-card {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    display: none;
}

.game-day-card.visible {
    display: block;
}

.game-day-card .badge {
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.game-day-card .matchup {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

.game-day-card .game-info {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.6;
}

/* News Feed */
.news-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.news-feed {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.news-item:active {
    transform: scale(0.98);
}

.news-item .date {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.news-item .title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.news-item .excerpt {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ================================================
   ROSTER PAGE STYLES
   ================================================ */

.search-container {
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.3s ease;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-container {
    margin-bottom: 20px;
}

.filter-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.3s ease;
}

.filter-select:focus {
    border-color: var(--accent);
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    min-height: 90px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 6px var(--card-shadow);
}

.player-card:active {
    transform: scale(0.98);
}

/* ── Player image: full-height left panel ── */
.player-img-wrap {
    position: relative;
    width: 140px;
    min-height: 90px;
    flex-shrink: 0;
    background: var(--thumbnail-bg);
    overflow: hidden;
}

.player-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 20% 15%;
    display: block;
    transform: scale(1.1);
    transform-origin: 25% 20%;
}

/* Gradient fade: image → card background */
.player-img-gradient {
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    width: 60px;
    background: linear-gradient(to right, transparent 0%, var(--bg-secondary) 100%);
    pointer-events: none;
}

/* Subtle vignette on the image for depth */
.player-img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, transparent 55%, var(--bg-secondary) 100%),
        linear-gradient(to bottom, transparent 70%, rgba(0,0,0,0.06) 100%);
    pointer-events: none;
}

/* Fallback icon when photo fails */
.player-fallback-icon {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.player-img-wrap.no-photo .player-fallback-icon {
    display: flex;
}

/* ── Player info: right side ── */
.player-info {
    flex: 1;
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-number {
    font-size: 13px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.player-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
    line-height: 1.2;
}

.player-position {
    font-size: 13px;
    color: var(--text-muted);
}

.player-details {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 3px;
}

.roster-section-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border-color);
    margin-top: 8px;
}

.loading-message,
.error-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

.error-message {
    color: #cc4444;
}

/* ================================================
   SCHEDULE PAGE STYLES
   ================================================ */

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s ease, background-color 0.3s ease;
    cursor: pointer;
}

.game-card:active {
    transform: scale(0.98);
}

.game-card.upcoming {
    border-left: 4px solid var(--accent);
}

.game-card.past {
    opacity: 0.7;
}

.game-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.game-matchup {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.game-matchup .team-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.vs {
    font-size: 14px;
    color: var(--text-muted);
}

.opponent {
    font-size: 16px;
    color: var(--text-secondary);
}

.game-location {
    font-size: 14px;
    color: var(--text-muted);
}

.game-score {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 8px;
}

.game-score.win {
    color: #4caf50;
}

.game-score.loss {
    color: #cc4444;
}

.schedule-section-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border-color);
    margin-top: 8px;
}

/* ================================================
   STANDINGS PAGE STYLES
   ================================================ */

.division-section {
    margin-bottom: 30px;
}

.division-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.standings-table {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.standings-header {
    display: flex;
    background: var(--bg-header-row);
    padding: 12px 15px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease;
}

.team-row {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
    cursor: pointer;
}

.team-row:last-child {
    border-bottom: none;
}

.team-row:active {
    background: var(--bg-active);
}

.team-row.highlight {
    background: var(--bg-highlight);
}

.team-col {
    flex: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.rank {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-muted);
    min-width: 20px;
}

.team-row.highlight .rank {
    color: var(--accent);
}

.standings-table .team-name {
    font-weight: 500;
    color: var(--text-primary);
}

.stat-col {
    flex: 1;
    text-align: center;
    font-size: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.standings-header .stat-col {
    font-size: 12px;
    color: var(--text-muted);
}
