/* ============================================================
   Hostelity base layer — every native HTML element, everywhere.
   Loaded before styles.css on every page (public, app, admin) so no
   control ever falls back to the browser's default look. All
   selectors are wrapped in :where() (zero specificity): any component
   rule in styles.css / site.css / hostelity.css still wins.
   ============================================================ */

/* Native widgets (date pickers, select popups, scrollbars) follow the theme. */
:root { color-scheme: light; accent-color: #1d14a0; }
:root[data-theme="dark"] { color-scheme: dark; accent-color: #6a62f0; }

:where(html) { -webkit-text-size-adjust: 100%; }
:where(body) { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: rgba(29, 20, 160, .18); }
:root[data-theme="dark"] ::selection { background: rgba(106, 98, 240, .35); }

/* ---- headings, text, inline elements ---- */
:where(h1, h2, h3, h4, h5, h6) { color: var(--navy-900, #0c0848); line-height: 1.25; letter-spacing: -.01em; }
:where(h1) { font-size: 1.6rem; } :where(h2) { font-size: 1.3rem; } :where(h3) { font-size: 1.08rem; }
:where(h4) { font-size: .98rem; } :where(h5, h6) { font-size: .9rem; }
:where(p) { line-height: 1.6; }
:where(strong, b) { font-weight: 650; }
:where(small) { font-size: .82em; }
:where(code, kbd, samp, pre) { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
:where(code, kbd) { background: var(--bg, #f7f7fb); border: 1px solid var(--line, #e6e4ef); border-radius: 5px; padding: 1px 6px; color: var(--ink, #24223f); }
:where(kbd) { box-shadow: inset 0 -1px 0 var(--line, #e6e4ef); }
:where(pre) { background: var(--bg, #f7f7fb); border: 1px solid var(--line, #e6e4ef); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
:where(pre code) { border: 0; padding: 0; background: none; }
:where(mark) { background: #fdf1c7; color: inherit; border-radius: 3px; padding: 0 2px; }
:root[data-theme="dark"] :where(mark) { background: rgba(241, 196, 107, .3); }
:where(hr) { border: 0; border-top: 1px solid var(--line, #e6e4ef); margin: 18px 0; }
:where(blockquote) { border-inline-start: 3px solid var(--accent, #1d14a0); padding: 4px 14px; color: var(--muted, #5d5b78); margin: 12px 0; }
:where(abbr[title]) { text-decoration: underline dotted; cursor: help; }
:where(ul, ol):where(:not([class])) { padding-inline-start: 1.3em; }
:where(dl) { margin: 0; } :where(dd) { margin: 0; }
:where(img, svg, video, canvas) { max-width: 100%; }
:where(a) { color: var(--accent-dark, #140c82); }
:where(a):hover { color: var(--accent, #1d14a0); }

/* ---- focus: visible for keyboard users, invisible for mouse clicks ---- */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent, #1d14a0); outline-offset: 2px; border-radius: 6px;
}

/* ---- form controls: one look for every text-like field ---- */
:where(input:not([type]), input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel],
       input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=month],
       input[type=time], input[type=week], select, textarea) {
  font: inherit; font-size: .93rem; color: var(--ink, #24223f); background-color: var(--card, #fff);
  border: 1.5px solid var(--line, #e6e4ef); border-radius: 8px; padding: 8px 11px; line-height: 1.4;
  min-height: 38px; max-width: 100%; transition: border-color .12s, box-shadow .12s;
}
:where(textarea) { min-height: 76px; resize: vertical; }
:where(input, select, textarea):focus { outline: none; border-color: var(--accent, #1d14a0); box-shadow: 0 0 0 3px rgba(29, 20, 160, .14); }
:root[data-theme="dark"] :where(input, select, textarea):focus { box-shadow: 0 0 0 3px rgba(106, 98, 240, .22); }
:where(input, textarea)::placeholder { color: var(--muted, #5d5b78); opacity: .75; }
:where(input, select, textarea, button):disabled { opacity: .55; cursor: not-allowed; }
:where(input[readonly]) { background-color: var(--bg, #f7f7fb); }
:where(input:invalid:not(:placeholder-shown):not(:focus)) { border-color: rgba(192, 57, 43, .55); }

/* Selects get the same chevron everywhere (no OS-native arrow). */
:where(select:not([multiple]):not([size])) {
  appearance: none; -webkit-appearance: none; padding-inline-end: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2393a1b3' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
[dir="rtl"] :where(select:not([multiple]):not([size])) { background-position: left 12px center; }
:where(select) option { color: var(--ink, #24223f); background: var(--card, #fff); }

/* Number fields: no spinner arrows (amounts are typed). */
:where(input[type=number])::-webkit-inner-spin-button, :where(input[type=number])::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
:where(input[type=number]) { -moz-appearance: textfield; }
/* Date / month pickers: the icon follows the theme. */
:where(input[type=date], input[type=month], input[type=datetime-local], input[type=time])::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }
:where(input[type=date], input[type=month], input[type=datetime-local], input[type=time])::-webkit-calendar-picker-indicator:hover { opacity: 1; }
:where(input[type=search])::-webkit-search-cancel-button { cursor: pointer; }

/* Checkboxes / radios: brand colour, consistent size, never stretched by a field rule. */
:where(input[type=checkbox], input[type=radio]) {
  font: inherit; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent, #1d14a0);
  cursor: pointer; flex-shrink: 0; vertical-align: -2px;
}
:where(input[type=range]) { accent-color: var(--accent, #1d14a0); width: 100%; }
:where(progress, meter) { accent-color: var(--accent, #1d14a0); }
:where(label:has(> input[type=checkbox], > input[type=radio])) { cursor: pointer; }

/* File pickers: the button looks like .btn-outline. */
:where(input[type=file]) { font: inherit; font-size: .88rem; color: var(--muted, #5d5b78); max-width: 100%; }
:where(input[type=file])::file-selector-button {
  font: inherit; font-weight: 600; font-size: .85rem; margin-inline-end: 10px; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  background: var(--card, #fff); color: var(--navy-800, #241d7a); border: 1.5px solid var(--navy-800, #241d7a);
}
:where(input[type=file])::file-selector-button:hover { filter: brightness(1.05); background: var(--bg, #f7f7fb); }

/* Buttons that aren't .btn still use the app's font and a pointer. */
:where(button, input[type=button], input[type=submit], input[type=reset]) { font: inherit; cursor: pointer; }
:where(button:not([class])) {
  padding: 7px 14px; border-radius: 8px; border: 1.5px solid var(--line, #e6e4ef); background: var(--card, #fff);
  color: var(--ink, #24223f); font-weight: 600; font-size: .88rem;
}
:where(button:not([class])):hover { background: var(--bg, #f7f7fb); }

:where(fieldset) { border: 1px solid var(--line, #e6e4ef); border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; }
:where(legend) { padding: 0 6px; font-weight: 650; color: var(--navy-900, #0c0848); font-size: .9rem; }
:where(label) { color: inherit; }
:where(output) { font-weight: 650; }

/* ---- tables without a component class (dialogs, ad-hoc lists) ---- */
:where(table:not([class])) { width: 100%; border-collapse: collapse; font-size: .92rem; }
:where(table:not([class]) th) { text-align: start; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #5d5b78); padding: 8px 10px; border-bottom: 1px solid var(--line, #e6e4ef); }
:where(table:not([class]) td) { padding: 9px 10px; border-bottom: 1px solid var(--line, #e6e4ef); }
:where(caption) { caption-side: top; text-align: start; color: var(--muted, #5d5b78); font-size: .85rem; padding-bottom: 6px; }

/* ---- disclosure widgets ---- */
:where(summary) { cursor: pointer; }
:where(details:not([class]) > summary) { font-weight: 600; color: var(--navy-900, #0c0848); padding: 6px 0; }

/* ---- dialogs (native) ---- */
:where(dialog) { border: 1px solid var(--line, #e6e4ef); border-radius: 14px; padding: 22px; background: var(--card, #fff); color: var(--ink, #24223f); box-shadow: 0 20px 60px rgba(12, 8, 72, .35); }
:where(dialog)::backdrop { background: rgba(12, 8, 72, .5); }

/* ---- scrollbars: thin and themed ---- */
* { scrollbar-width: thin; scrollbar-color: #c7d0dc transparent; }
:root[data-theme="dark"] * { scrollbar-color: #3c3a58 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7d0dc; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #a9b5c4; background-clip: padding-box; border: 2px solid transparent; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3c3a58; background-clip: padding-box; border: 2px solid transparent; }

/* ---- SweetAlert2 (admin dialogs) follow the theme ---- */
:root[data-theme="dark"] .swal2-popup { background: #1f1d33; color: var(--ink); }
:root[data-theme="dark"] .swal2-title, :root[data-theme="dark"] .swal2-html-container { color: var(--ink); }
.swal2-popup { font-family: inherit; border-radius: 14px; }
.swal2-input, .swal2-select, .swal2-textarea { font: inherit; border: 1.5px solid var(--line, #e6e4ef) !important; border-radius: 8px !important; box-shadow: none !important; background: var(--card, #fff); color: var(--ink, #24223f); }
.swal2-input:focus, .swal2-textarea:focus { border-color: var(--accent, #1d14a0) !important; box-shadow: 0 0 0 3px rgba(29, 20, 160, .14) !important; }
.swal2-styled { border-radius: 10px !important; font-weight: 600 !important; }

/* ---- print ---- */
@media print { * { scrollbar-width: none; } :where(a) { text-decoration: none; } }
