/* Base element styling for the operator portal, on Palary's design system.
 * Component-level styling lives in the `*.module.css` files next to this one.
 */

html {
  background: var(--bg);
}

body {
  height: auto;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  margin: 0;
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}

body,
body div {
  border: 0;
  vertical-align: baseline;
  font-weight: var(--fw-regular);
  margin: 0;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--fg-1);
}

h1 {
  font-size: var(--text-2xl);
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

h2 {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-3);
  margin: var(--space-6) 0 var(--space-2);
}

h3 {
  font-size: var(--text-lg);
  line-height: var(--lh-snug);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug);
  color: var(--fg-1);
  margin: var(--space-6) 0 var(--space-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Links carry the brand colour; the underline offset keeps them legible
   inside dense table rows. */
a {
  color: var(--forest-700);
  text-decoration-color: var(--forest-300);
  text-underline-offset: 2px;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--forest-800);
  text-decoration-color: currentColor;
}

/* A lime focus ring, always visible — the design system forbids removing
   focus styling without a replacement. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--forest-700);
  outline-offset: 2px;
  box-shadow: var(--ring-lime);
  border-radius: var(--radius-xs);
}

input,
select,
textarea,
button {
  box-sizing: border-box;
  max-width: 100%;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--fg-1);
}

input,
select,
textarea {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--forest-700);
  padding: 0;
}

input[type='color'] {
  padding: 2px;
  min-height: 28px;
}

input:hover:not([disabled]),
select:hover:not([disabled]),
textarea:hover:not([disabled]) {
  border-color: var(--forest-400);
}

input[disabled],
select[disabled],
textarea[disabled] {
  background: var(--neutral-100);
  color: var(--fg-3);
}

/* Buttons default to the primary forest fill; components opt out with their
   own class where a quieter treatment is wanted. */
button {
  padding: var(--space-2) var(--space-4);
  background: var(--forest-700);
  color: var(--fg-on-dark);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

button:hover:not([disabled]) {
  background: var(--forest-800);
}

button:active:not([disabled]) {
  transform: scale(0.98);
}

button[disabled] {
  opacity: 0.5;
  cursor: default;
}

label {
  font-size: var(--text-sm);
  color: var(--fg-2);
}

img {
  max-width: 100%;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

/* The page shell: a bone page holding one raised card with the app in it. */
.main {
  padding: 0 var(--space-6) var(--space-8);
}

.container {
  background: var(--bg-raised);
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

@media only screen and (max-width: 860px) {
  .main {
    padding: 0 var(--space-2) var(--space-6);
  }

  .container {
    padding: var(--space-4) var(--space-3);
    border-radius: var(--radius-md);
    box-shadow: none;
  }

  /* 16px verhindert den Auto-Zoom von iOS beim Fokussieren von Eingabefeldern */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  button {
    min-height: 44px;
    font-size: 16px;
  }
}

@media only screen and (max-width: 768px) {
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    -ms-flex: 1; /* IE 10*/
    flex: 1;
  }

  /* nicht 'hide'n, wegen Accessibility*/
  table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  table tr {
    -ms-flex: 1; /* IE 10*/
    flex: 1;
    border-bottom: 2px solid var(--forest-700);
  }

  table tr:nth-child(odd) {
    background: var(--forest-50);
  }

  table td {
    border: none;
    border-bottom: 1px solid var(--border);
    position: relative;
    min-height: 10px;
    overflow-wrap: anywhere;
  }

  /* Nur Zellen mit label-Attribut bekommen die Beschriftungsspalte */
  table td[label] {
    padding-left: 42%;
  }

  table td[label]:before {
    content: attr(label);
    font-weight: var(--fw-semibold);
    color: var(--fg-2);
    min-width: 120px;
    position: absolute;
    top: 0;
    left: 6px;
    width: 40%;
    padding: var(--space-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
