/* ---------------------------------------------------------------------------
   NMR mérésidő-foglalás
   The four band colours and the overall shape of the grid are kept from the
   original CGI pages so the board stays recognisable; everything else is
   modern CSS instead of <font> tags and table attributes.
   --------------------------------------------------------------------------- */

:root {
    --band-early: #e1f5a9;
    --band-core:  #82fa58;
    --band-late:  #ffbf00;
    --band-night: #819ff7;

    --ink:        #1b2430;
    --ink-soft:   #5a6673;
    --line:       #c9d2dc;
    --line-soft:  #e4e9ef;
    --bg:         #f4f6f8;
    --panel:      #ffffff;
    --accent:     #0b4f8a;
    --accent-ink: #ffffff;
    --free:       #ffffff;
    --taken:      #eef3f7;
    --mine:       #cfe9d4;
    --weekend:    #f2f4f7;
    --danger:     #b02a37;
    --ok:         #1c6b3a;

    --radius: 6px;
    --shadow: 0 1px 3px rgb(27 36 48 / 12%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

a { color: var(--accent); }
a:hover { text-decoration: none; }

/* --- Shell ---------------------------------------------------------------- */

.masthead {
    background: var(--accent);
    color: var(--accent-ink);
    padding: 0.6rem 1rem;
}

.masthead__inner,
.page {
    max-width: 1600px;
    margin: 0 auto;
}

.masthead__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

.masthead__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.masthead__title a { color: inherit; text-decoration: none; }

.masthead__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin-left: auto;
    align-items: center;
    font-size: 0.9rem;
}

.masthead__nav a { color: var(--accent-ink); text-decoration: none; opacity: 0.9; }
.masthead__nav a:hover { opacity: 1; text-decoration: underline; }
.masthead__user { font-weight: 600; }

.page { padding: 1rem; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

h1 { font-size: 1.35rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
h3 { font-size: 0.98rem; margin: 0 0 0.5rem; }

.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* --- Flash messages ------------------------------------------------------- */

.flash {
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    border: 1px solid;
}

.flash--success { background: #e7f5ec; border-color: #b7dfc5; color: var(--ok); }
.flash--error   { background: #fdeaec; border-color: #f3c2c8; color: var(--danger); }
.flash--info    { background: #e9f1fa; border-color: #c3d9ef; color: var(--accent); }

/* --- Forms ---------------------------------------------------------------- */

label { font-weight: 600; font-size: 0.9rem; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="search"],
select,
textarea {
    font: inherit;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: inherit;
    max-width: 100%;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn {
    font: inherit;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-ink);
    cursor: pointer;
}

.btn:hover { filter: brightness(1.1); }
.btn--ghost { background: #fff; color: var(--accent); }
.btn--danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn--small { padding: 0.2rem 0.5rem; font-size: 0.82rem; }

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    align-items: flex-end;
}

.field { display: flex; flex-direction: column; gap: 0.2rem; }

/* --- The booking grid ----------------------------------------------------- */

.grid-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

table.grid {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    min-width: 1100px;
    font-size: 0.82rem;
}

table.grid th,
table.grid td {
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    padding: 0.25rem 0.3rem;
    text-align: center;
    vertical-align: middle;
}

table.grid thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f7f9fb;
    font-weight: 600;
    line-height: 1.25;
    padding: 0.4rem 0.3rem;
    border-bottom: 2px solid var(--line);
}

table.grid thead th.is-weekend { background: #eceff3; }
table.grid thead th.is-today { box-shadow: inset 0 -3px 0 var(--accent); }
table.grid thead th small { display: block; font-weight: 400; color: var(--ink-soft); }

/* First column: the time, painted with its price band. */
table.grid th.slot,
table.grid thead th.slot {
    position: sticky;
    left: 0;
    z-index: 4;
    text-align: left;
    white-space: nowrap;
    font-weight: 600;
    min-width: 122px;
    border-right: 1px solid var(--line);
}

table.grid tbody th.slot { z-index: 2; }
table.grid tbody th.slot.band-early { background: var(--band-early); }
table.grid tbody th.slot.band-core  { background: var(--band-core); }
table.grid tbody th.slot.band-late  { background: var(--band-late); }
table.grid tbody th.slot.band-night { background: var(--band-night); }

table.grid td { background: var(--free); }
table.grid td.is-weekend { background: var(--weekend); }
table.grid td.taken { background: var(--taken); font-weight: 600; }
table.grid td.mine  { background: var(--mine); font-weight: 600; }
table.grid td.past  { background: #fafafa; color: #aab2bb; }

.cell-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 145px;
    margin: 0 auto;
}

.cell-btn {
    font: inherit;
    font-size: 0.78rem;
    width: 100%;
    padding: 0.2rem 0.15rem;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    color: var(--ink-soft);
}

.cell-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.cell-btn--cancel { color: var(--danger); }
.cell-btn--cancel:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* --- Legend --------------------------------------------------------------- */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
    font-size: 0.84rem;
}

.legend span {
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius);
    border: 1px solid rgb(0 0 0 / 10%);
}

.legend .band-early { background: var(--band-early); }
.legend .band-core  { background: var(--band-core); }
.legend .band-late  { background: var(--band-late); }
.legend .band-night { background: var(--band-night); }

.notice {
    margin-top: 0.5rem;
    padding: 0.45rem 0.8rem;
    background: var(--band-night);
    border-radius: var(--radius);
    display: inline-block;
    font-size: 0.86rem;
}

/* --- Login strip ---------------------------------------------------------- */

.login {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem 1rem;
}

.login input[type="password"] { width: 11rem; letter-spacing: 0.3em; }

/* --- Instrument cards ----------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card img { width: 100%; height: 150px; object-fit: cover; display: block; background: #dde3ea; }
.card__body { padding: 0.8rem 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.card__name { font-weight: 700; }
.card__links { margin-top: auto; display: flex; gap: 0.75rem; font-size: 0.86rem; padding-top: 0.4rem; }
.card--retired { opacity: 0.72; }

.badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #eceff3;
    color: var(--ink-soft);
    border: 1px solid var(--line-soft);
}

/* --- Data tables ---------------------------------------------------------- */

table.data {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.88rem;
}

table.data th,
table.data td {
    border-bottom: 1px solid var(--line-soft);
    padding: 0.35rem 0.5rem;
    text-align: left;
}

table.data thead th { background: #f7f9fb; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.data tbody tr:hover { background: #f9fbfd; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* --- Message board -------------------------------------------------------- */

.message { border-bottom: 1px solid var(--line-soft); padding: 0.6rem 0; }
.message:last-child { border-bottom: 0; }
.message__meta { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 0.15rem; }
.message__body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* --- Usage heat map ------------------------------------------------------- */

.heat td { font-size: 0.7rem; padding: 0.15rem 0.2rem; }
.heat td.on { background: var(--band-core); }
.heat td.off { background: #fff; color: #cbd2da; }

@media print {
    .masthead, .legend, .login, .btn { display: none !important; }
    .panel { box-shadow: none; border: 0; }
}

/* An operator may clear anyone's slot; that must not look like the red ✕ that
   cancels your own booking. */
.cell-btn--override { color: var(--ink); font-weight: 600; }
.cell-btn--override:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.cell-btn--override:hover::after { content: " ✕"; }

/* Instruments with no photo still occupy a card-sized block. */
.card__placeholder {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8edf3, #d7dfe8);
    color: var(--ink-soft);
    font-weight: 600;
    letter-spacing: 0.04em;
}
