/*
 * The legacy Family Christmas theme (old public/css/styles.css on Bootstrap 4),
 * rebuilt on Bootstrap 5: holly background, green "formBg" panels with white
 * text, Mountains of Christmas headings, Bootstrap 4 button colors, and the
 * green option bar of buttons at the bottom.
 */

/* Bootstrap 4 palette (Bootstrap 5 shifted primary, info and success). */
:root {
    --bs-link-color: #007bff;
    --bs-link-color-rgb: 0, 123, 255;
    --bs-link-hover-color: #0056b3;
    --bs-link-hover-color-rgb: 0, 86, 179;
}
.btn-primary { --bs-btn-bg: #007bff; --bs-btn-border-color: #007bff; --bs-btn-hover-bg: #0069d9; --bs-btn-hover-border-color: #0062cc; --bs-btn-active-bg: #0062cc; --bs-btn-active-border-color: #005cbf; --bs-btn-disabled-bg: #007bff; --bs-btn-disabled-border-color: #007bff; }
.btn-info { --bs-btn-color: #fff; --bs-btn-bg: #17a2b8; --bs-btn-border-color: #17a2b8; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #138496; --bs-btn-hover-border-color: #117a8b; --bs-btn-active-color: #fff; --bs-btn-active-bg: #117a8b; --bs-btn-active-border-color: #10707f; --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: #17a2b8; --bs-btn-disabled-border-color: #17a2b8; }
.btn-success { --bs-btn-bg: #28a745; --bs-btn-border-color: #28a745; --bs-btn-hover-bg: #218838; --bs-btn-hover-border-color: #1e7e34; --bs-btn-active-bg: #1e7e34; --bs-btn-active-border-color: #1c7430; --bs-btn-disabled-bg: #28a745; --bs-btn-disabled-border-color: #28a745; }
.btn-warning { --bs-btn-color: #212529; --bs-btn-hover-color: #212529; --bs-btn-hover-bg: #e0a800; --bs-btn-hover-border-color: #d39e00; --bs-btn-active-color: #212529; --bs-btn-active-bg: #d39e00; --bs-btn-active-border-color: #c69500; }
.btn-danger { --bs-btn-hover-bg: #c82333; --bs-btn-hover-border-color: #bd2130; --bs-btn-active-bg: #bd2130; --bs-btn-active-border-color: #b21f2d; }
.btn-secondary { --bs-btn-hover-bg: #5a6268; --bs-btn-hover-border-color: #545b62; }

/* Bootstrap 4 metrics the legacy layout was built on, where Bootstrap 5 differs:
   container widths and 30px gutters, heading sizes, label spacing, and the
   smaller button and alert corners. */
.container, .container-fluid, .row {
    --bs-gutter-x: 30px;
}
@media (min-width: 576px) { .container { max-width: 540px; } }
@media (min-width: 768px) { .container { max-width: 720px; } }
@media (min-width: 992px) { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }
h1, h2, h3, h4, h5, h6 {
    margin-bottom: .5rem;
    font-weight: 500;
    line-height: 1.2;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }
label {
    margin-bottom: .5rem;
}
.btn {
    --bs-btn-border-radius: .25rem;
}
.alert {
    --bs-alert-padding-x: 1.25rem;
    --bs-alert-padding-y: .75rem;
    --bs-alert-border-radius: .25rem;
}
.alert-dismissible {
    padding-right: 4rem;
}
.alert-dismissible .close {
    position: absolute;
    top: 0;
    right: 0;
    padding: .75rem 1.25rem;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
}
.alert-dismissible .close:hover {
    opacity: .75;
}

/* The page: the holly background stays put behind the whole page, however
   long. A fixed layer rather than background-attachment: fixed, which iOS
   Safari ignores. */
body {
    min-height: 100vh;
    background: #e4dc96;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url(../images/christmas-background-3529.jpeg) 0 0 / cover;
}
a {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
#mainContainer {
    min-height: 100vh;
    padding-bottom: 1px;
}

.christmas {
    font-family: "Mountains of Christmas", cursive;
}

/* Page headings: big, centered, a quarter of the way down the screen. */
#header {
    padding-top: 25vh;
    margin: 0 auto;
    font-family: "Mountains of Christmas", cursive;
    font-size: 50px;
    font-weight: 500;
    line-height: 50px;
    text-align: center;
}
#header + .subheader {
    font-family: "Mountains of Christmas", cursive;
    text-align: center;
    margin: .25rem 0 0;
}

/* "You have Holly for Secret Santa!" */
#result, .result {
    text-align: center;
    margin-top: 10vh;
    font-family: "Mountains of Christmas", cursive;
}
#secondResult {
    text-align: center;
    margin-top: 20px;
    font-family: "Mountains of Christmas", cursive;
}
.hint {
    font-family: "Mountains of Christmas", cursive;
    text-align: center;
}

/* Green panels: every main form, and the option bar. */
.optionBar, .panel {
    background: url(../images/formBg.jpg);
    background-size: cover;
    padding: 10px;
    border-radius: 20px;
    color: white;
    display: block;
    margin: 10vh auto 0;
}
/* Main forms center each "Label: [input]" row, like the legacy
   <div align="center"> forms. */
.panel {
    text-align: center;
}
/* The login and forgot-password forms sit alone in a row: they shrink to fit
   and stay left-aligned. */
.row > .panel {
    width: auto;
    max-width: 100%;
    padding: 10px;
    margin: 10vh auto 0;
    text-align: left;
}
/* Other small panels shrink to fit too, but stay centered. */
.panel-narrow {
    width: fit-content;
    max-width: 100%;
}
.panel a:not(.btn) {
    color: #fff;
}
.panel .text-muted, .panel .form-text, .panel .small {
    color: rgba(255, 255, 255, .8) !important;
}
.panel .form-text {
    margin: -.75rem 0 1rem;
}

/* Fields are the browser's own inputs, as on the legacy site; Bootstrap's
   form-control styling is undone. */
.panel .form-control, .panel .form-select, .panel .form-check-input {
    all: revert;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}
.panel .mb-3, .panel .form-group {
    margin-bottom: 1rem !important;
}
.panel .form-group .invalid-feedback {
    margin-bottom: .25rem;
}
.panel .mb-3 > .form-label {
    margin-bottom: .5rem;
}
.panel .mb-3 > .form-label::after {
    content: ":";
}
.panel .mb-3:has(> textarea) > .form-label {
    display: block;
}
.panel .form-check {
    display: inline-block;
    padding: 0;
    margin: 0;
    min-height: 0;
}
.panel .form-check-input {
    margin-right: .25rem;
}
.panel fieldset legend {
    font-size: 1rem;
}
.panel .alert {
    text-align: left;
}
.panel .invalid-feedback {
    display: block;
    color: #ffc107;
}

/* Tables sit straight on the background, like "View All Picks". */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: #212529;
    width: auto;
    margin: 0 auto;
    vertical-align: middle;
}
/* Plain cells, as the legacy <table align="center">: the browser's 1px. */
.table > :not(caption) > * > * {
    padding: 1px;
    border-bottom-width: 0;
}
.table thead th {
    font-weight: 700;
}
.table .btn {
    margin: 1px 0;
}
.table-wrap {
    overflow-x: auto;
}
.panel .table {
    --bs-table-color: #fff;
}

/* The option bar of buttons at the bottom of every page. */
.optionBar {
    text-align: center;
}
.optionBar .impersonating {
    padding-bottom: 5px;
}
.optionBar .adminRow {
    padding-top: 5px;
}
.optionBar .dropdown-menu {
    text-align: left;
}

.readonly-note {
    margin: 1rem auto;
    max-width: 40rem;
    text-align: center;
}

/* Inline action forms (Remove, Save, Rename) stay plain. */
form.d-inline, form.inline {
    display: inline;
}

/* Manual reshuffle: people as cards that are moved between givers. */
.reshuffle-help { margin-bottom: .75rem; }
.reshuffle-tray-wrap { margin-bottom: 1rem; }
.reshuffle-tray-title { font-weight: 700; margin-bottom: .25rem; }
.reshuffle-tray { display: flex; flex-wrap: wrap; gap: .5rem; min-height: 3.5rem; padding: .5rem; border: 2px dashed rgba(255, 255, 255, .6); border-radius: .5rem; }
.reshuffle-tray-empty { align-self: center; opacity: .85; }
.reshuffle-rows { display: grid; gap: .5rem; margin-bottom: 1rem; }
.reshuffle-row { display: grid; grid-template-columns: minmax(8rem, 1fr) auto minmax(10rem, 1fr) minmax(0, 1fr); align-items: center; gap: .75rem; }
.reshuffle-giver-name { display: block; font-weight: 700; }
.reshuffle-giver-household, .person-card-household { display: block; font-size: .8rem; opacity: .8; }
.reshuffle-arrow { opacity: .8; }
.reshuffle-slot { min-height: 3.25rem; padding: .25rem; border: 2px solid transparent; border-radius: .5rem; background: rgba(255, 255, 255, .15); display: flex; align-items: center; }
.reshuffle-slot.is-empty { border-style: dashed; border-color: #ffc107; justify-content: center; font-style: italic; }
.reshuffle-slot.is-changed { border-color: #17a2b8; }
.reshuffle-slot.is-repeat { border-color: #ffc107; }
.reshuffle-slot.is-forbidden { border-color: #dc3545; background: rgba(220, 53, 69, .25); }
.reshuffle-slot.is-over, .reshuffle-tray.is-over { outline: 3px solid #fff; outline-offset: 1px; }
.reshuffle-note { font-size: .85rem; }
.person-card { appearance: none; width: 100%; text-align: left; padding: .35rem .6rem; border: 1px solid #ced4da; border-radius: .4rem; background: #fff; color: #212529; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.reshuffle-tray .person-card { width: auto; }
.person-card:focus-visible { outline: 3px solid #007bff; outline-offset: 1px; }
.person-card.is-picked { background: #fff3cd; border-color: #ffc107; box-shadow: 0 0 0 3px rgba(255, 193, 7, .6); }
.person-card-name { display: block; font-weight: 600; }
.reshuffle-status { font-weight: 700; }
.reshuffle-status.is-bad { color: #ffe08a; }
@media (max-width: 640px) {
    .reshuffle-row { grid-template-columns: 1fr 1fr; }
    .reshuffle-arrow { display: none; }
    .reshuffle-note { grid-column: 1 / -1; }
}

.season-input { width: 5.5rem; }
.history-table th[scope=row] { white-space: nowrap; }
