/* AI CONTEXT: Index Page Styles
   PURPOSE: Styles for the main annotation page (index.html)
   DEPENDENCIES: common.css
   PATTERNS: Component-scoped CSS */

body { display: flex; flex-direction: column; align-items: center; }

/* ── Login overlay ──────────────────────────────────────────────────── */
#login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.75); display: flex;
    justify-content: center; align-items: center;
    z-index: 2000; backdrop-filter: blur(5px);
}
#login-box {
    background: #fff; padding: 30px 40px; border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); text-align: center;
    width: 90%; max-width: 380px;
}
#login-box h2 { margin-top: 0; color: #1a237e; margin-bottom: 20px; font-size: 1.8em; }
#login-box p  { margin-bottom: 15px; color: #555; font-size: 0.95em; }
#password-input {
    width: calc(100% - 24px); padding: 12px; margin-bottom: 25px;
    border: 1px solid #ccc; border-radius: 6px; font-size: 1em; box-sizing: border-box;
}
#password-input:focus { border-color: #3f51b5; outline: none; box-shadow: 0 0 0 2px rgba(63,81,181,0.2); }
#login-button {
    padding: 12px 25px; font-size: 1.1em; font-weight: bold;
    border-radius: 6px; cursor: pointer; border: none; color: #fff;
    background: #4CAF50; width: 100%; transition: background 0.3s;
}
#login-button:hover { background: #45a049; }
#login-error { margin-top: 15px; font-size: 0.9em; color: #f44336; font-weight: bold; display: none; }

/* ── Main container ─────────────────────────────────────────────────── */
.container {
    background: #fff; padding: 25px; border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%; max-width: 1000px;
    display: flex; flex-direction: column; gap: 20px;
}
h1 { text-align: center; color: #1a237e; margin: 0 0 10px; }

/* ── Timer ──────────────────────────────────────────────────────────── */
.main-timer-section { text-align: center; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.timer-controls { display: flex; gap: 10px; align-items: center; position: relative; }
#main-timer-display {
    font-size: 3.5em; font-weight: bold; color: #1a237e; background: #e8eaf6;
    padding: 10px 20px; border-radius: 8px; display: inline-block;
    min-width: 250px; border: 2px solid #c5cae9; margin-bottom: 10px; cursor: pointer;
}
#main-timer-display:hover { background: #dcdff1; }
#start-stop-timer, #toggle-half-btn {
    padding: 12px 20px; font-size: 1em; border-radius: 6px; cursor: pointer;
    border: none; color: #fff; transition: background 0.3s; min-width: 120px;
}
.start-button { background: #4CAF50; }
.start-button:hover { background: #45a049; }
.stop-button  { background: #f44336; }
.stop-button:hover  { background: #da190b; }
#toggle-half-btn { background: #2196F3; }
#toggle-half-btn:hover { background: #1976D2; }

/* ── Event buttons ──────────────────────────────────────────────────── */
.event-buttons-section { display: flex; flex-direction: column; gap: 10px; }
.team-buttons-title { font-size: 1.2em; color: #3f51b5; margin: 10px 0 5px; padding-bottom: 5px; border-bottom: 1px solid #e0e0e0; }
.team-buttons-title:first-of-type { margin-top: 0; }
.event-buttons-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 15px; position: relative; }
.event-buttons-grid button, .timed-flag-button {
    padding: 15px; font-size: 1em; border-radius: 6px; cursor: pointer;
    border: 2px solid transparent; background: #3f51b5; color: #fff;
    transition: background 0.2s, border-color 0.2s;
    display: flex; align-items: center; justify-content: center;
    min-height: 50px; text-align: center; position: relative;
}
.event-buttons-grid button:not(.timed-flag-button):hover { background: #303f9f; }
#rival-buttons button { background: #607d8b; }
#rival-buttons button:hover { background: #546e7a; }
.timed-flag-button.inactive { background: #4CAF50; border-color: #388e3c; }
.timed-flag-button.inactive:hover { background: #45a049; }
.timed-flag-button.active { background: #f44336; border-color: #d32f2f; }
.timed-flag-button.active:hover { background: #da190b; }
.team-separator { border: none; border-top: 1px solid #ddd; margin: 15px 0; }

/* ── Hotkey tooltips ────────────────────────────────────────────────── */
.hotkey-tooltip {
    visibility: hidden; width: auto; min-width: 20px; background: #555; color: #fff;
    text-align: center; border-radius: 6px; padding: 5px 8px;
    position: absolute; z-index: 1; bottom: 110%; left: 50%; transform: translateX(-50%);
    opacity: 0; transition: opacity 0.3s; font-size: 0.8em; white-space: nowrap;
}
#toggle-half-btn:hover .hotkey-tooltip,
.event-buttons-grid button:hover .hotkey-tooltip,
.timer-controls > button:hover .hotkey-tooltip { visibility: visible; opacity: 1; }

/* ── Opta section ───────────────────────────────────────────────────── */
.opta-section { margin-top: 15px; padding: 15px; background: #f3e5f5; border-radius: 8px; display: flex; flex-direction: column; gap: 12px; }
.opta-section h3 { margin: 0; color: #7B1FA2; font-size: 1.1em; }
.opta-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.opta-controls input[type="text"] { padding: 10px 12px; border-radius: 6px; border: 1px solid #CE93D8; font-size: 0.95em; width: 280px; }
.opta-controls input[type="text"]:focus { border-color: #9C27B0; outline: none; box-shadow: 0 0 0 2px rgba(156,39,176,0.2); }
.opta-status { font-size: 0.9em; color: #666; margin-left: 10px; }
.opta-status.success { color: #4CAF50; }
.opta-status.error { color: #f44336; }
#fetch-opta-btn { background: #9C27B0; }
#fetch-opta-btn:hover { background: #7B1FA2; }
#fetch-opta-btn.loading { background: #CE93D8; cursor: wait; }
.opta-auto-fetch-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.opta-auto-fetch-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: #7B1FA2; }
.opta-auto-fetch-row input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: #9C27B0; }
.opta-countdown { font-size: 0.9em; color: #666; padding: 5px 10px; background: #EDE7F6; border-radius: 4px; }
.opta-countdown.active { color: #4CAF50; background: #E8F5E9; }
.opta-countdown.paused { color: #FF9800; background: #FFF3E0; }
.opta-live-display { display: flex; gap: 20px; flex-wrap: wrap; padding: 10px 15px; background: #EDE7F6; border-radius: 6px; font-size: 0.95em; }
.opta-live-display .team-possession { display: flex; align-items: center; gap: 8px; }
.opta-live-display .team-name { font-weight: 600; }
.opta-live-display .team-name.motor { color: #3f51b5; }
.opta-live-display .team-name.rival { color: #607d8b; }
.opta-live-display .possession-value { font-weight: bold; font-size: 1.1em; color: #333; }
.opta-live-display .interval-label { color: #666; font-size: 0.85em; margin-left: auto; }

/* ── Counters ───────────────────────────────────────────────────────── */
.counters-section {
    margin-top: 10px; padding: 15px; background: #e8eaf6; border-radius: 8px;
    display: grid; grid-template-columns: repeat(5,minmax(130px,1fr)); gap: 10px; text-align: center;
}
.counter-group-title {
    grid-column: 1/-1; text-align: left; margin-top: 10px; margin-bottom: 8px;
    color: #1a237e; font-size: 1.15em; font-weight: bold; border-bottom: 1px solid #c5cae9; padding-bottom: 6px;
}
.counter-group-title:first-of-type { margin-top: 0; }
.counters-section div:not(.counter-group-title) {
    font-size: 0.9em; padding: 8px; background: #fff; border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.3;
}
.counters-section strong { color: #3f51b5; font-size: 1.2em; margin-top: 4px; }

/* ── Event log ──────────────────────────────────────────────────────── */
.event-log-section { margin-top: 20px; }
.event-log-section h2 { text-align: center; color: #3f51b5; margin-bottom: 10px; }
#event-list { list-style: none; padding: 0; max-height: 300px; overflow-y: auto; border: 1px solid #ddd; border-radius: 6px; }
#event-list li { padding: 10px 15px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; font-size: 0.95em; }
#event-list li:last-child { border-bottom: none; }
#event-list li:nth-child(odd) { background: #f9f9f9; }
.event-details { flex-grow: 1; }
.event-time { font-weight: bold; color: #1a237e; margin-right: 8px; }
.event-half { font-weight: normal; color: #666; margin-right: 8px; background: #eee; padding: 2px 5px; border-radius: 3px; font-size: 0.85em; }
.event-team-prefix { font-weight: bold; margin-right: 5px; }
.event-team-motor { color: #3f51b5; }
.event-team-rival { color: #607d8b; }
.event-type { color: #555; }
.event-value { font-style: italic; color: #777; margin-left: 5px; }
.delete-event-btn { background: #ffcdd2; color: #c62828; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.8em; margin-left: 10px; }
.delete-event-btn:hover { background: #ef9a9a; }

/* ── Match management ───────────────────────────────────────────────── */
.match-management-section { display: flex; justify-content: center; gap: 15px; margin-bottom: 15px; }
.match-btn { padding: 8px 16px; border-radius: 4px; border: none; color: #fff; cursor: pointer; font-size: 0.9em; transition: background 0.2s; }

/* ── Start-screen overlay ───────────────────────────────────────────── */
#start-screen-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 1500; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
#start-screen-match-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; height: 100%; }
#start-screen-match-list li { padding: 10px 15px; border-bottom: 1px solid #eee; cursor: pointer; transition: background 0.2s; }
#start-screen-match-list li:hover { background: #f5f5f5; }

/* ── Time-edit modal colours ────────────────────────────────────────── */
#apply-time-edit  { background: #4CAF50; }
#apply-time-edit:hover  { background: #45a049; }
#cancel-time-edit { background: #f44336; }
#cancel-time-edit:hover { background: #da190b; }
