/* Game Discount Tracker - Custom Styles */

body {
    background-color: #1a1d23;
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Cards */
.card {
    background-color: #212529;
    border-color: #373b3e;
}

.card-header {
    background-color: #2c3035;
    border-bottom: 1px solid #373b3e;
}

/* Tables */
.table-dark {
    --bs-table-bg: #212529;
}

/* Game name tooltip trigger */
.game-name-tooltip {
    cursor: help;
    border-bottom: 1px dashed #6c757d;
    transition: color 0.2s;
}

.game-name-tooltip:hover {
    color: #0d6efd;
}

/* Game tooltip popup */
#gameTooltip {
    position: fixed;
    z-index: 9999;
    background: #2c3035;
    border: 1px solid #495057;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    max-width: 260px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s, transform 0.15s;
    overflow: hidden;
}

#gameTooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

#gameTooltip .tooltip-image {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid #373b3e;
}

#gameTooltip .tooltip-body {
    padding: 10px 12px;
}

#gameTooltip .tooltip-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #e9ecef;
    margin-bottom: 4px;
}

#gameTooltip .tooltip-price {
    font-size: 0.85rem;
    color: #0dcaf0;
}

/* Calendar overrides */
.fc {
    background: #212529;
}

.fc .fc-toolbar-title {
    color: #e9ecef;
}

.fc .fc-button {
    background-color: #373b3e;
    border-color: #495057;
    color: #e9ecef;
}

.fc .fc-button:hover {
    background-color: #495057;
    border-color: #6c757d;
}

.fc .fc-button-active {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.fc .fc-daygrid-day-number {
    color: #e9ecef;
}

.fc .fc-col-header-cell-cushion {
    color: #adb5bd;
}

.fc .fc-daygrid-day.fc-day-today {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.8rem;
}

/* Timeline Gantt styles */
.timeline-card {
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

.timeline-card .card-body {
    background-color: #f8f9fa !important;
}

.timeline-table {
    table-layout: fixed;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.timeline-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #e9ecef !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
    /* Override Bootstrap's `vertical-align: bottom` (table thead th):
       with `bottom`, the absolutely-positioned month tick spans get a
       bottom-aligned static position and spill out of the header row.
       Middle alignment keeps the ticks and the "Game / Platform"
       label on the same vertical center line. */
    vertical-align: middle;
}

.timeline-table td {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
    padding: 2px 4px !important;
}

.timeline-table td:first-child,
.timeline-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: #f1f3f5 !important;
}

.timeline-table thead th:first-child {
    z-index: 15;
}

.timeline-game-label {
    font-weight: 600;
    padding-left: 12px !important;
    color: #0d6efd !important;
}

.timeline-platform-label {
    padding-left: 20px !important;
    font-size: 0.85rem;
    color: #495057 !important;
}

/* Bar cell: single cell spanning the visible date range per platform row */
.timeline-bar-cell {
    border-right: 1px solid #dee2e6;
    vertical-align: middle;
    padding: 4px 0 !important;
    background-color: #ffffff !important;
    /* Month/day grid lines are injected by timeline.js as a dynamic
       gradient via --timeline-grid-image so they follow zoom & pan */
    background-image: var(--timeline-grid-image, none);
    background-position: 0 0;
    background-size: 100% 100%;
}

/* Wrapper: one fixed-height track, all bars share same Y */
.timeline-bar-wrapper {
    position: relative;
    width: 100%;
    height: 24px;
}

.timeline-bar {
    height: 22px;
    line-height: 22px;
    border-radius: 4px;
    cursor: pointer;
    position: absolute;
    top: 1px;
    left: 0;
    transition: filter 0.2s, z-index 0s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    box-sizing: border-box;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.25);
}

.timeline-bar:hover {
    filter: brightness(1.2);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Event section rows: subtle warm tint to set them apart from platform rows */
.timeline-events-row .timeline-bar-cell {
    background-color: #fff8f1 !important;
}
.timeline-events-row td:first-child {
    background-color: #fff8f1 !important;
}

/* Event bars on the game's events section rows (distinct from discount bars) */
.timeline-event-bar {
    position: absolute;
    top: 4px;
    left: 0;
    height: 16px;
    border-radius: 3px;
    cursor: pointer;
    background-color: #fd7e14;
    border: 1px dashed rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    box-sizing: border-box;
    pointer-events: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    transition: filter 0.2s;
}

.timeline-event-bar:hover {
    filter: brightness(1.15);
    box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}

/* Game events in FullCalendar: dashed border to distinguish from solid discount bars */
.fc-event.calendar-game-event {
    border-style: dashed !important;
}

.game-header-row td {
    border-bottom: 2px solid #adb5bd !important;
    background-color: #f1f3f5 !important;
    padding: 6px 4px !important;
}

.month-col {
    min-width: 60px;
    border-bottom: 2px solid #dee2e6;
}

.timeline-grid-cell {
    border-right: 1px solid #dee2e6;
    height: 36px;
}

/* Dynamic month tick labels in header */
.timeline-months-row {
    background-color: #e9ecef !important;
    color: #212529 !important;
    border-bottom: 2px solid #dee2e6 !important;
}

.timeline-month-tick {
    display: flex;
    align-items: center;
    /* Pin to the top of the th (its containing block) instead of relying
       on the static position, which follows the cell's vertical-align.
       height:100% + flex centering then puts the label exactly on the
       header row's vertical center line, in line with "Game / Platform". */
    top: 0;
    padding: 2px 4px;
    border-right: 1px solid #dee2e6;
    height: 100%;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Pan scrollbar at bottom of timeline */
.timeline-scrollbar {
    height: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    cursor: grab;
}
.timeline-scrollbar:active {
    cursor: grabbing;
}
.timeline-scrollbar-content {
    height: 100%;
    min-width: 100%;
}
.timeline-scrollbar::-webkit-scrollbar {
    height: 10px;
}
.timeline-scrollbar::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 5px;
}
.timeline-scrollbar::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 5px;
    border: 2px solid #e9ecef;
}
.timeline-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #495057;
}
.timeline-scrollbar::-webkit-scrollbar-button {
    width: 12px;
    background-color: #e9ecef;
}

/* Disable the default horizontal scrollbar on the table wrapper — bottom scrollbar handles panning */
#timelineScroll {
    overflow-x: hidden !important;
}

/* Dashboard stat cards */
.display-4 {
    font-weight: 700;
}

/* Form controls */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Read-only auto-calculated fields */
.form-control[readonly] {
    background-color: #1a1e23;
    color: #0dcaf0;
    font-weight: 600;
    border-color: #373b3e;
    cursor: default;
}

.form-control[readonly]:focus {
    box-shadow: none;
    border-color: #373b3e;
}

/* Flash animation when auto-calculated value changes */
@keyframes fieldFlash {
    0% { background-color: #0dcaf0; color: #000; }
    100% { background-color: #1a1e23; color: #0dcaf0; }
}

.field-flash {
    animation: fieldFlash 0.6s ease-out;
}

/* Badges */
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Preview bar in discount form */
#previewBar {
    background-color: #2c3035;
}

/* Footer */
footer {
    background-color: #1a1d23;
}

/* ── Clickable legend filters (calendar + timeline) ─────────────── */
.cal-legend-item,
.tl-legend-item {
    cursor: pointer;
    user-select: none;
}

.cal-legend-off,
.tl-legend-off {
    opacity: .35;
    text-decoration: line-through;
}
