/* ------------------------------------------------------------------
 * THEME: modern and simple - black text, white background, cinema red
 * as the only accent color (gold only for the stars). Bootstrap's colored
 * classes (success, warning, info, ...) are mapped onto this palette below,
 * so the templates can keep using the usual Bootstrap classes.
 * Errors and deleting use a dark wine red.
 * ------------------------------------------------------------------ */

:root {
    --kino-red: #A4161A;          /* curtain red */
    --kino-red-dark: #7F1013;     /* hover / active */
    --kino-red-light: #FBECEC;    /* light backgrounds */
    --kino-red-mid: #E7A9AB;
    --star: #E8A317;              /* stars */
    --line: #E3E3E3;              /* thin borders */
    --red-delete: #6B1B1B;
    --red-delete-dark: #4E1212;

    --bs-body-color: #000;
    --bs-body-color-rgb: 0, 0, 0;
    --bs-body-bg: #fff;
    --bs-secondary-color: #5F6368;
    --bs-primary: var(--kino-red);
    --bs-primary-rgb: 164, 22, 26;
    --bs-link-color: var(--kino-red);
    --bs-link-color-rgb: 164, 22, 26;
    --bs-link-hover-color: var(--kino-red-dark);
    --bs-link-hover-color-rgb: 127, 16, 19;
    --bs-border-color: var(--line);
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    color: #000;
}

h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 {
    font-weight: 600;
    letter-spacing: -.01em;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn:hover, .nav-link:hover, .dropdown-item:hover, .film-list-item:hover, .stat-tile-link:hover, .calendar-entry:hover {
    text-decoration: none;
}

/* Navigation: white with a thin red line, like the curtain */
.navbar, .navbar.bg-body-tertiary {
    background-color: #fff !important;
    border-bottom: 3px solid var(--kino-red) !important;
}

.navbar-brand {
    color: var(--kino-red) !important;
    font-weight: 600;
}

.navbar .nav-link {
    color: #000;
}

.navbar .nav-link.active {
    color: var(--kino-red) !important;
    font-weight: 600;
}

.navbar-search {
    max-width: 260px;
}

/* Cards and dialogs: no shadows, thin border */
.card, .modal-content {
    border: 1px solid var(--line);
    box-shadow: none !important;
}

.card-highlight {
    border-color: var(--kino-red-mid);
    background-color: var(--kino-red-light);
}

/* --- Buttons --- */

.btn-primary, .btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--kino-red);
    --bs-btn-border-color: var(--kino-red);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--kino-red-dark);
    --bs-btn-hover-border-color: var(--kino-red-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--kino-red-dark);
    --bs-btn-active-border-color: var(--kino-red-dark);
    --bs-btn-disabled-bg: var(--kino-red);
    --bs-btn-disabled-border-color: var(--kino-red);
    --bs-btn-focus-shadow-rgb: 164, 22, 26;
}

.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--kino-red);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--kino-red);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--kino-red);
    --bs-btn-hover-border-color: var(--kino-red);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--kino-red-dark);
    --bs-btn-active-border-color: var(--kino-red-dark);
    --bs-btn-focus-shadow-rgb: 164, 22, 26;
}

.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--red-delete);
    --bs-btn-border-color: var(--red-delete);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--red-delete-dark);
    --bs-btn-hover-border-color: var(--red-delete-dark);
    --bs-btn-active-bg: var(--red-delete-dark);
    --bs-btn-active-border-color: var(--red-delete-dark);
}

/* Neutral actions (e.g. "Abbrechen", "Abmelden"): black outline */
.btn-secondary, .btn-warning, .btn-outline-secondary, .btn-outline-dark {
    --bs-btn-color: #000;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #000;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #000;
    --bs-btn-hover-border-color: #000;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #333;
    --bs-btn-active-border-color: #333;
    --bs-btn-focus-shadow-rgb: 0, 0, 0;
}

.btn-link {
    --bs-btn-color: var(--kino-red);
    --bs-btn-hover-color: var(--kino-red-dark);
}

.link-danger, .btn-link.link-danger {
    color: var(--red-delete) !important;
}

/* --- Badges: red, or white with a black outline --- */
.badge.text-bg-primary, .badge.text-bg-info, .badge.text-bg-success {
    color: #fff !important;
    background-color: var(--kino-red) !important;
}

.badge.text-bg-warning, .badge.text-bg-secondary, .badge.text-bg-danger, .badge.text-bg-light {
    color: #000 !important;
    background-color: #fff !important;
    border: 1px solid #000;
    font-weight: 500;
}

.badge.text-bg-light {
    border-color: var(--line);
    color: var(--bs-secondary-color) !important;
}

.badge {
    font-weight: 600;
}

/* IMDb rating: in IMDb's yellow */
.imdb-badge {
    background-color: #F5C518;
    color: #000;
}

.progress {
    background-color: #F1F1F1;
}

.progress-bar.bg-success {
    background-color: var(--kino-red) !important;
}

/* --- Messages --- */
.alert-info, .alert-success {
    --bs-alert-color: #000;
    --bs-alert-bg: var(--kino-red-light);
    --bs-alert-border-color: var(--kino-red-mid);
    --bs-alert-link-color: var(--kino-red);
}

.alert-danger {
    --bs-alert-color: #8A1414;
    --bs-alert-bg: #FDF1F1;
    --bs-alert-border-color: #E8B4B4;
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--kino-red);
    box-shadow: 0 0 0 .2rem rgba(164, 22, 26, .2);
}

.form-check-input:checked {
    background-color: var(--kino-red);
    border-color: var(--kino-red);
}

.nav-tabs .nav-link.active {
    color: var(--kino-red);
    font-weight: 600;
}

.nav-tabs .nav-link {
    color: #000;
}

/* ------------------------------------------------------------------
 * LAYOUT
 * ------------------------------------------------------------------ */

#content {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* Cards and forms use the full width on phones and stay narrow on larger screens. */
.card-narrow {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.card-wide {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.alert {
    max-width: 560px;
    margin: 0 auto 1rem auto;
    border-radius: .75rem;
}

.alert ul {
    margin-bottom: 0;
}

.sql-output {
    font-size: .85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ------------------------------------------------------------------
 * FILMS
 * ------------------------------------------------------------------ */

.poster {
    object-fit: cover;
    border-radius: .4rem;
    background-color: #F1F1F1;
    flex-shrink: 0;
}

.poster-sm {
    width: 46px;
    height: 68px;
}

.poster-lg {
    width: 160px;
    height: 237px;
}

.poster-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.poster-lg.poster-empty {
    font-size: 3rem;
}

.film-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

@media (max-width: 575.98px) {
    .film-header {
        flex-direction: column;
    }
    .poster-lg {
        width: 120px;
        height: 178px;
    }
}

/* "Neu im Programm" on the start page: a row of posters, scrolls sideways */
.new-films {
    display: flex;
    gap: .9rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    scroll-snap-type: x proximity;
}

.new-film {
    flex: 0 0 120px;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    color: #000;
    font-size: .85rem;
    scroll-snap-align: start;
}

.new-film .badge {
    align-self: flex-start;
}

.poster-md {
    width: 120px;
    height: 178px;
}

.new-film-title {
    font-weight: 600;
    line-height: 1.2;
}

.new-film-next {
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

/* Facts of a film (label, value with the mark of its source) */
.film-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 1rem;
    row-gap: .25rem;
    margin-bottom: 1rem;
    font-size: .95rem;
}

.film-facts dt {
    font-weight: 400;
    color: var(--bs-secondary-color);
}

.film-facts dd {
    margin: 0;
}

/* Mark of the source of an information: IMDb (yellow), nonstopkino.at (pink like their site), entered by a user (grey) */
.source {
    display: inline-block;
    font-size: .65rem;
    font-weight: 600;
    line-height: 1;
    padding: .2rem .35rem;
    border-radius: .25rem;
    vertical-align: middle;
    color: #555;
    background-color: #EEE;
    white-space: nowrap;
}

.source-imdb {
    color: #000;
    background-color: #F5C518;
}

.source-nonstop {
    color: #000;
    background-color: #F5B5D2;
}

.film-header .poster-lg + div .source {
    margin-top: .25rem;
}

/* "Manuell zuordnen" on the admin page: a link that opens a small form */
.manual-assign > summary {
    list-style: none;
}

.manual-assign > summary::-webkit-details-marker {
    display: none;
}

.manual-assign form {
    min-width: 18rem;
}

details.card > summary {
    cursor: pointer;
}

.seen-note {
    color: var(--kino-red);
    font-weight: 500;
}

.film-list {
    list-style: none;
    padding: 0;
}

.film-list-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--line);
    color: #000;
}

/* Stars: gold, the empty ones light grey */
.stars {
    color: var(--star);
    letter-spacing: .05em;
    white-space: nowrap;
}

.stars-empty {
    color: #DDD;
}

.stars-small {
    color: var(--star);
    font-weight: 600;
    white-space: nowrap;
}

/* Rating input: 10 radio buttons as stars. In reverse order (row-reverse), so that the checked star and all
   stars before it ("~" selects the following ones in the HTML, which are shown to the left) are colored. */
.star-input {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.star-input input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.star-input label {
    font-size: 1.7rem;
    line-height: 1;
    color: #DDD;
    cursor: pointer;
    padding: 0 .05rem;
}

.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label {
    color: var(--star);
}

.star-input input:focus-visible + label {
    outline: 2px solid var(--kino-red);
    outline-offset: 2px;
}

@media (max-width: 400px) {
    .star-input label {
        font-size: 1.45rem;
    }
}

.visit-note {
    color: var(--bs-secondary-color);
    font-style: italic;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------
 * PROGRAM
 * ------------------------------------------------------------------ */

.program-day {
    margin-top: 1.25rem;
    padding-bottom: .3rem;
    border-bottom: 2px solid #000;
}

.screening-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.screening {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .6rem 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 5rem;
}

.screening-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 3rem;
}

.screening-date {
    display: block;
    font-weight: 400;
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

.screening-body {
    flex: 1;
    min-width: 0;
}

.screening-title {
    font-weight: 600;
    color: #000;
}

.screening-actions {
    white-space: nowrap;
}

.screening-saved {
    background-color: var(--kino-red-light);
    margin: 0 -.5rem;
    padding-left: .5rem;
    padding-right: .5rem;
}

.screening-people {
    color: var(--kino-red);
}

.screening-cancelled .screening-time, .screening-cancelled .screening-title {
    text-decoration: line-through;
}

@media (max-width: 575.98px) {
    .screening {
        flex-wrap: wrap;
    }
    .screening-actions {
        width: 100%;
        padding-left: 3.75rem;
    }
}

/* Films on the own watchlist: a light gold background (saved screenings stay light red) */
.screening-watchlist {
    background-color: #FFF7E0;
    margin: 0 -.5rem;
    padding-left: .5rem;
    padding-right: .5rem;
}

/* "Merken" / "Gemerkt" in the lists: gold like the stars */
.btn-watchlist {
    --bs-btn-color: #8A5A00;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--star);
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: var(--star);
    --bs-btn-hover-border-color: var(--star);
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: var(--star);
    --bs-btn-active-border-color: var(--star);
}

/* Earlier screenings of a film: grey */
.screenings-past .screening, .screenings-past .program-day, .screenings-past a {
    color: #8A8A8A !important;
}

.screenings-past .program-day {
    border-bottom-color: #BBB;
}

.screenings-past .btn {
    --bs-btn-color: #8A8A8A;
    --bs-btn-border-color: #BBB;
}

/* ------------------------------------------------------------------
 * CALENDAR (month)
 * ------------------------------------------------------------------ */

.calendar-head, .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-head div {
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    padding: .25rem 0;
    border-bottom: 2px solid #000;
}

.calendar-day {
    min-height: 6.5rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: .25rem;
    overflow: hidden;
}

.calendar-grid > .calendar-day:nth-child(7n+1) {
    border-left: 1px solid var(--line);
}

.calendar-weekend {
    background-color: #FAFAFA;
}

.calendar-outside {
    background-color: #F4F4F4;
}

.calendar-date {
    font-size: .8rem;
    color: var(--bs-secondary-color);
    text-align: right;
}

.calendar-weekday {
    display: none;
}

.calendar-today .calendar-date {
    color: var(--kino-red);
    font-weight: 700;
}

.calendar-today {
    box-shadow: inset 0 0 0 2px var(--kino-red);
}

.calendar-entry {
    display: block;
    font-size: .78rem;
    line-height: 1.25;
    color: #fff;
    background-color: var(--kino-red);
    border-radius: .3rem;
    padding: .2rem .3rem;
    margin-top: .2rem;
    overflow-wrap: anywhere;
}

.calendar-entry:hover {
    background-color: var(--kino-red-dark);
    color: #fff;
}

.calendar-entry .stars-small {
    color: #FFD866;
}

.calendar-time {
    font-weight: 600;
}

.calendar-who, .calendar-cinema {
    display: block;
    font-size: .7rem;
    opacity: .85;
}

.calendar-planned, .calendar-planned:hover {
    background-color: #fff;
    color: var(--kino-red);
    border: 1px dashed var(--kino-red);
}

.calendar-legend-planned {
    border-bottom: 1px dashed var(--kino-red);
}

/* Phones: one day per line, days without entries are hidden */
@media (max-width: 767.98px) {
    .calendar-head {
        display: none;
    }
    .calendar-grid {
        display: block;
    }
    .calendar-day {
        min-height: 0;
        border: none !important;
        border-bottom: 1px solid var(--line) !important;
        display: flex;
        gap: .75rem;
        flex-wrap: wrap;
        padding: .5rem 0;
    }
    .calendar-empty, .calendar-outside {
        display: none;
    }
    .calendar-date {
        text-align: left;
        min-width: 3.5rem;
        font-size: .9rem;
    }
    .calendar-weekday {
        display: inline;
    }
    .calendar-entry {
        flex: 1 1 12rem;
        margin-top: 0;
        font-size: .85rem;
    }
    .calendar-weekend {
        background-color: transparent;
    }
}

/* ------------------------------------------------------------------
 * STATISTICS
 * ------------------------------------------------------------------ */

.stat-tile {
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: .9rem 1rem;
    background-color: #fff;
    color: #000;
}

.stat-tile-link:hover {
    border-color: var(--kino-red);
}

.stat-label, .stat-note {
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Column chart: one series in cinema red, recessive axes */
.chart {
    display: flex;
    gap: .5rem;
    height: 160px;
}

.chart-y {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 1.5rem;
    text-align: right;
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

.chart-plot {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.chart-slot {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    outline: none;
}

.chart-column {
    width: 100%;
    max-width: 28px;
    background-color: var(--kino-red);
    border-radius: 4px 4px 0 0;
}

.chart-slot:hover .chart-column, .chart-slot:focus .chart-column {
    background-color: var(--kino-red-dark);
}

.chart-slot:hover::after, .chart-slot:focus::after {
    content: attr(data-tip);
    position: absolute;
    top: -2.1rem;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background-color: #000;
    color: #fff;
    font-size: .75rem;
    padding: .2rem .5rem;
    border-radius: .35rem;
    z-index: 5;
    pointer-events: none;
}

.chart-slot:nth-child(-n+3)::after {
    left: 0;
    transform: none;
}

.chart-slot:nth-last-child(-n+3)::after {
    left: auto;
    right: 0;
    transform: none;
}

.chart-x {
    display: flex;
    justify-content: space-between;
    margin-left: 2rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
}

.chart-x-days {
    gap: 2px;
}

.chart-x-days span {
    flex: 1;
    text-align: center;
    overflow: hidden;
}

/* Horizontal bars with the value at the end */
.hbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: .75rem;
    row-gap: .2rem;
    align-items: baseline;
    margin-bottom: .7rem;
}

.hbar-label {
    grid-column: 1;
    grid-row: 1;
    font-size: .85rem;
}

.hbar-track {
    display: contents;
}

.hbar {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 12px;
    min-width: 2px;
    background-color: var(--kino-red);
    border-radius: 0 4px 4px 0;
}

.hbar-value {
    grid-column: 2;
    grid-row: 1;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}

/* Import preview */
.import-preview {
    max-height: 60vh;
    overflow-y: auto;
}

/* The menu of the user name: on phones aligned with the left edge of the name */
@media (max-width: 991.98px) {
    .user-menu .dropdown-menu {
        position: absolute;
    }
}
