/* ============================================
   components.css
   Reusable UI: buttons, inputs, cards, panels,
   labels, lists, badges, sidebar, brand.
   Uses ONLY var(--xxx) from variables.css.
   ============================================ */


/* ---- Labels ---- */

.label, .field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}


/* ---- Inputs & selects ---- */

.select, .input,
input:not(.input):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select:not(.select),
textarea:not(.input) {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-color);
  padding: 10px 12px;
  border-radius: var(--radius);
  outline: none;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select:focus, .input:focus,
input:not(.input):not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:not(.select):focus,
textarea:not(.input):focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

/* Autofill fix (Chrome blue tint).

   Chrome paints an autofilled field itself and ignores background, so the only
   way to recolour it is an inset box-shadow covering the whole box. On a dark
   theme, without this, the field turns white and takes the text with it.

   Three blocks rather than one long selector list, and that is deliberate: an
   unknown selector invalidates the ENTIRE list it appears in. Putting the
   standard and the internal names together would mean a browser that knows
   only one of them silently drops the rule for all of them. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px var(--input-autofill) inset !important;
  -webkit-text-fill-color: var(--input-color) !important;
  caret-color: var(--input-color);
  border-color: var(--input-border) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* The standard spelling, for the browsers that have moved on from the prefix. */
input:autofill,
input:autofill:hover,
input:autofill:focus,
textarea:autofill,
select:autofill {
  -webkit-box-shadow: 0 0 0 40px var(--input-autofill) inset !important;
  box-shadow: 0 0 0 40px var(--input-autofill) inset !important;
  -webkit-text-fill-color: var(--input-color) !important;
  caret-color: var(--input-color);
  border-color: var(--input-border) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* The preview state: a suggestion merely highlighted in the dropdown, not yet
   accepted. It is a separate internal selector, and it is the one the rules
   above miss -- which is why a field could go white before anything had been
   chosen. */
input:-internal-autofill-previewed,
input:-internal-autofill-selected {
  -webkit-box-shadow: 0 0 0 40px var(--input-autofill) inset !important;
  -webkit-text-fill-color: var(--input-color) !important;
  caret-color: var(--input-color);
  border-color: var(--input-border) !important;
}

select option {
  background: var(--option-bg);
  color: var(--text);
}

.field {
  display: grid;
  gap: 6px;
}


/* ---- Buttons ---- */

.btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, var(--btn-bg-from), var(--btn-bg-to));
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
  font-weight: 600;
  transition: transform 80ms ease, border-color 120ms ease, background 120ms ease;
}

.btn:hover {
  border-color: var(--gold-hover);
  background: linear-gradient(180deg, var(--btn-hover-from), var(--btn-hover-to));
}

.btn:active { transform: translateY(1px); }

.btn.primary {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px rgba(200,162,74,0.08), var(--shadow2);
}

.btn.danger, .btnDanger {
  border-color: var(--danger-border);
}

.btnDanger:hover {
  border-color: var(--danger);
}


/* ---- Cards & panels ---- */

.card {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  box-shadow: var(--shadow2);
  padding: 14px;
}


/* ---- Lists ---- */

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.list-row {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--list-row-bg);
  border-radius: var(--radius);
}

.list-main { display: grid; gap: 4px; }
.list-actions { display: flex; gap: 8px; align-items: center; }


/* ---- Nav ---- */

.nav { display: grid; gap: 10px; }


/* ---- Brand ---- */

.brand {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 22px;
  margin: 6px 4px 16px 4px;
}

.brand small {
  display: block;
  margin-top: 6px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}


/* ---- Sidebar ---- */

.sidebar {
  padding: 18px 16px;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  color: var(--text);
}

@media (max-width: 980px) {
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

.sidebar .panel + .panel { margin-top: 12px; }

.sidebar-user {
  padding: 0 4px 14px 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-user:empty { display: none; }

.sidebar-user-email {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.3;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}


/* ---- Status badges ---- */

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.status-badge.active   { background: var(--success-bg); color: var(--success-text); }
.status-badge.inactive { background: var(--danger-bg); color: var(--danger-text); }
.status-badge.type-interior { background: rgba(200,162,74,0.15); color: var(--gold); }
.status-badge.type-terrace  { background: var(--success-bg); color: var(--success-text); }
.status-badge.type-private  { background: rgba(156,39,176,0.15); color: #ce93d8; }


/* ---- Theme toggle ---- */

.theme-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
}

.theme-toggle:hover {
  color: var(--gold);
}


/* ---- Password wrapper (my-account) ---- */

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .input {
    flex: 1;
    padding-right: 40px;
}

.password-wrapper .pwd-toggle {
    position: absolute;
    right: 8px;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.4;
    padding: 4px;
    line-height: 1;
}

.password-wrapper .pwd-toggle:hover {
    opacity: 0.7;
}

.password-wrapper .pwd-toggle.visible {
    opacity: 0.8;
}

/* ---- Password requirements checklist ---- */

.pwd-requirements {
    margin-top: 8px;
    padding: 0;
    list-style: none;
}

.pwd-requirements li {
    font-size: 13px;
    line-height: 1.8;
    color: var(--muted);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    max-height: 30px;
    overflow: hidden;
}

.pwd-requirements li::before {
    content: "\25CB";
    font-size: 10px;
    flex-shrink: 0;
}

.pwd-requirements li.met {
    max-height: 0;
    opacity: 0;
    margin: 0;
    line-height: 0;
}

/* ---- Password match hint ---- */

.pwd-match-hint {
    font-size: 12px;
    min-height: 18px;
    margin-top: 4px;
    transition: color 0.2s;
}

.pwd-match-hint.match-error {
    color: var(--danger, #e05050);
}

.pwd-match-hint.match-ok {
    color: var(--success, #30b060);
}

/* ---- Password toggle (injected by pwd-toggle.js) ---- */

/* The eye sits INSIDE the field, not beside it.

   As a flex sibling it took its own width plus the gap, so a password field
   ended up some thirty pixels shorter than the e-mail field above it. Two
   boxes of different lengths in the same column read as a mistake, not as a
   design.

   Absolute, over the field own right padding: the input goes back to the full
   width of its neighbours, and no rule has to know how wide the button is.
   Same pattern as .password-wrapper further up, which already did this for the
   change-password form -- so this is the house pattern, applied where it had
   been forgotten.

   Scoped to .pwd-row on purpose. A bare .pwd-toggle rule would also reach the
   buttons inside .password-wrapper on my-account, which nobody asked to
   change. */
.pwd-row {
  position: relative;
  display: block;
}

/* Room for the eye inside the field: what is typed stops before it instead of
   sliding underneath.

   The [type] is there for specificity and nothing else. auth.css carries
   ".auth-field input { padding: 12px 14px }", which has the same weight as a
   plain ".pwd-row > input" and is loaded after this file -- so the plain form
   lost, silently, and only on the pages where it mattered most. The attribute
   tips the balance without inventing a class, and it matches both states the
   toggle switches between, password and text. */
.pwd-row > input[type] {
  width: 100%;
  padding-right: 40px;
}

.pwd-row .pwd-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
}

.pwd-toggle {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0;
  line-height: 0;
  color: var(--muted) !important;
  opacity: 0.5;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.pwd-toggle:hover {
  opacity: 0.9;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}


/* ---- Toast (minimal, rest in toast.css) ---- */
/* kept in toast.css */


/* ---- Room Closures (shared: room-plan + restaurants) ---- */

.rs-closures-list {
    max-height: 200px;
    overflow-y: auto;
}
.rs-closure-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--divider);
    border-radius: 8px;
    margin-bottom: 6px;
    background: var(--gold-tint);
}
.rs-closure-dates {
    flex: 1;
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 600;
}
.rs-closure-type {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.rs-closure-type.ct-seasonal {
    background: var(--success-bg);
    color: var(--success-text);
}
.rs-closure-type.ct-maintenance {
    background: var(--warning-bg);
    color: var(--warning-text);
}
.rs-closure-type.ct-privateevent {
    background: var(--gold-subtle);
    color: var(--gold);
}
.rs-closure-type.ct-other {
    background: var(--gold-tint);
    color: var(--muted);
}
.rs-closure-note {
    font-size: 10px;
    color: var(--dim);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rs-closure-edit,
.rs-closure-del {
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: all 0.15s;
    white-space: nowrap;
}
.rs-closure-edit:hover {
    border-color: var(--gold-border);
    color: var(--gold);
}
.rs-closure-del {
    color: #fff;
    border-color: rgba(220,50,50,0.6);
    background: rgba(200,40,40,0.7);
}
.rs-closure-del:hover {
    background: rgba(220,50,50,0.9);
    border-color: rgba(240,60,60,0.8);
}
.rs-no-closures {
    text-align: center;
    padding: 14px;
    color: var(--dim);
    font-size: 12px;
}


/* ---- Responsive ---- */

@media (max-width: 720px) {
  .list-row { flex-direction: column; align-items: stretch; }
  .list-actions { justify-content: flex-end; }
}