/* Rakenne- ja komponenttityylit. Ei väriarvoja suoraan tässä tiedostossa —
   kaikki nojaa custom propertyihin (--color-*, --font-display), joiden arvot
   tulevat aktiivisesta teematiedostosta (static/css/active-theme.css).
   Uutta teemaa lisättäessä tätä tiedostoa ei tarvitse koskea. */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--color-page-background, radial-gradient(ellipse at top, var(--color-dark-red), var(--color-bg) 60%, var(--color-bg-dark)));
  color: var(--color-text);
  font-family: var(--font-display);
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--color-gold-bright);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}

a {
  color: var(--color-gold-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page-shell {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2vw 3vw;
}

/* ---------- Logo / landing ---------- */

/* Logo and content sit side by side as real flex siblings, instead of the
   logo floating absolutely over the content — that previously let the logo
   visually overlap the first user button instead of making room for it. */
.landing-layout {
  display: flex;
  align-items: flex-start;
  gap: 3vw;
}

.logo-wrapper {
  flex: 0 0 auto;
  margin: 0;
}

.logo-wrapper img {
  width: 16vw;
  max-width: 220px;
  min-width: 90px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(201, 162, 39, 0.5));
}

.landing-content {
  flex: 1 1 auto;
  min-width: 0;
}

/* Below this width the logo is dropped entirely rather than crowding the
   user-select buttons, which are the priority on a small kiosk screen. */
@media (max-width: 640px) {
  .logo-wrapper {
    display: none;
  }
}

.landing-footer {
  text-align: center;
  margin-top: 3vh;
}

.instructions-link-subtle {
  display: inline-block;
  padding: 0.3em 0.9em;
  color: var(--color-gold);
  opacity: 0.75;
  font-size: 0.9em;
  border-bottom: 1px solid transparent;
}

.instructions-link-subtle:hover {
  opacity: 1;
  border-bottom-color: var(--color-gold);
  text-decoration: none;
}

.info-image {
  display: block;
  width: 60vw;
  max-width: 420px;
  min-width: 160px;
  height: auto;
  margin: 2em auto 0;
  filter: drop-shadow(0 0 12px rgba(201, 162, 39, 0.4));
}

/* ---------- User select buttons ---------- */

.user-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2em;
  justify-content: center;
  margin-top: 2em;
}

.user-button {
  padding: 1em 1.6em;
  background: linear-gradient(180deg, var(--color-dark-red), var(--color-black));
  border: 2px solid var(--color-gold);
  border-radius: 10px;
  color: var(--color-text);
  font-size: 1.1em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.user-button:hover, .user-button:focus {
  transform: translateY(-2px);
  box-shadow: 0 0 14px rgba(201, 162, 39, 0.6);
}

.user-button.selected {
  border-color: var(--color-gold-bright);
  box-shadow: 0 0 18px rgba(232, 199, 94, 0.8);
}

/* ---------- PIN entry ---------- */

.pin-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  margin-top: 2em;
}

.pin-panel.visible {
  display: flex;
}

.pin-input {
  font-size: 2em;
  letter-spacing: 0.5em;
  text-align: center;
  width: 6em;
  padding: 0.3em;
  background: var(--color-black);
  border: 2px solid var(--color-gold);
  border-radius: 8px;
  color: var(--color-gold-bright);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 4em);
  gap: 0.6em;
}

.pin-keypad button {
  font-size: 1.5em;
  padding: 0.6em 0;
  background: linear-gradient(180deg, var(--color-dark-red), var(--color-black));
  border: 2px solid var(--color-gold);
  border-radius: 10px;
  color: var(--color-text);
  cursor: pointer;
  touch-action: manipulation;
}

.pin-keypad button:active {
  background: var(--color-gold);
  color: var(--color-black);
}

.pin-keypad .pin-key-action {
  color: var(--color-gold-bright);
}

.pin-entry-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  align-items: stretch;
}

.pin-submit-big {
  font-size: 1.6em;
  padding: 0 0.9em;
  min-width: 4.5em;
  border-radius: 10px;
  touch-action: manipulation;
}

.pin-field {
  letter-spacing: 0.4em;
  font-variant-numeric: tabular-nums;
}

.pin-field-active {
  border-color: var(--color-gold-bright);
  box-shadow: 0 0 10px rgba(232, 199, 94, 0.6);
}

form .pin-keypad {
  margin-top: 1em;
  justify-content: center;
}

.error-message {
  color: #ff8888;
  min-height: 1.4em;
  font-weight: bold;
}

/* ---------- Kiosk layout ---------- */

.kiosk-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6em;
  border-bottom: 2px solid var(--color-gold);
  padding-bottom: 0.6em;
  margin-bottom: 1em;
}

.kiosk-header-left {
  display: flex;
  align-items: baseline;
  gap: 0.8em;
  flex-wrap: wrap;
}

.kiosk-header-left h1 {
  margin: 0;
}

.kiosk-header-right {
  display: flex;
  align-items: center;
  gap: 0.8em;
}

.balance-display {
  font-size: 1.3em;
  color: var(--color-gold-bright);
}

.btn-logout {
  padding: 0.4em 0.9em;
  border: 1px solid var(--color-gold);
  border-radius: 6px;
  background: var(--color-black);
  color: var(--color-text);
  cursor: pointer;
}

.category-block {
  margin-bottom: 1.4em;
}

.category-title {
  font-size: 1.1em;
  border-bottom: 1px solid var(--color-gold);
  padding-bottom: 0.2em;
  margin-bottom: 0.6em;
  opacity: 0.9;
}

.category-separator {
  border: none;
  border-top: 1px dashed rgba(201, 162, 39, 0.5);
  margin: 1.4em 0;
}

.product-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
}

.product-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 7.5em;
  padding: 0.7em 1em;
  background: linear-gradient(180deg, var(--color-dark-red), var(--color-black));
  border: 2px solid var(--color-gold);
  border-radius: 8px;
  color: var(--color-text);
  cursor: pointer;
}

.product-button:hover {
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
}

.product-button .product-price {
  color: var(--color-gold-bright);
  font-size: 0.9em;
}

/* ---------- Cart ---------- */

.cart-actions {
  position: sticky;
  top: 0;
  display: flex;
  gap: 1em;
  padding: 0.8em 0;
  background: var(--color-bg);
  z-index: 5;
}

.cart-actions button {
  flex: 1;
  padding: 0.8em;
  font-size: 1.1em;
  border-radius: 8px;
  border: 2px solid var(--color-gold);
  cursor: pointer;
  font-weight: bold;
}

.btn-confirm {
  background: var(--color-gold);
  color: var(--color-black);
}

.btn-cancel {
  background: var(--color-danger);
  color: var(--color-text);
}

.cart-list {
  list-style: none;
  padding: 0;
  margin: 0.6em 0;
  border: 1px solid var(--color-gold);
  border-radius: 8px;
  min-height: 3em;
}

.cart-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em 0.8em;
  border-bottom: 1px solid rgba(201, 162, 39, 0.3);
}

.cart-list li:last-child {
  border-bottom: none;
}

.cart-remove-btn {
  background: none;
  border: 1px solid var(--color-gold);
  color: var(--color-gold-bright);
  border-radius: 4px;
  cursor: pointer;
  padding: 0.1em 0.6em;
}

.cart-total {
  text-align: right;
  font-size: 1.2em;
  color: var(--color-gold-bright);
  margin-top: 0.4em;
}

.supply-link {
  display: inline-block;
  padding: 0.5em 1em;
  border: 1px solid var(--color-gold);
  border-radius: 6px;
}

/* ---------- Forms (supply / admin) ---------- */

form.panel {
  background: var(--color-panel-bg, rgba(16, 0, 0, 0.5));
  border: 1px solid var(--color-gold);
  border-radius: 10px;
  padding: 1.2em;
  margin-bottom: 1.4em;
  max-width: 480px;
}

label {
  display: block;
  margin-top: 0.8em;
  margin-bottom: 0.2em;
}

input, select, textarea {
  width: 100%;
  padding: 0.5em;
  background: var(--color-black);
  border: 1px solid var(--color-gold);
  border-radius: 6px;
  color: var(--color-text);
  font-family: var(--font-display);
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

button, .btn {
  padding: 0.6em 1.2em;
  border-radius: 6px;
  border: 1px solid var(--color-gold);
  background: var(--color-dark-red);
  color: var(--color-text);
  cursor: pointer;
}

button:hover {
  background: var(--color-gold);
  color: var(--color-black);
}

/* ---------- Admin ---------- */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin-bottom: 1.4em;
}

.admin-nav a {
  padding: 0.5em 1em;
  border: 1px solid var(--color-gold);
  border-radius: 6px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.4em;
}

table.data-table th, table.data-table td {
  border: 1px solid rgba(201, 162, 39, 0.4);
  padding: 0.5em 0.7em;
  text-align: left;
}

table.data-table th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--color-gold-bright);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  align-items: end;
  margin-bottom: 1em;
}

.filter-bar > div {
  display: flex;
  flex-direction: column;
}

.muted {
  opacity: 0.7;
  font-size: 0.9em;
}
