/* public/assets/css/main.css
   LagerPilot Design System (Base)
   - modern, responsive, wartungsfreundlich
   - Seiten-spezifische Styles: in extra Dateien (dashboard.css, bestand.css, ...)
*/

/* =========================
   1) Tokens / Theme
   ========================= */
:root{
  /* Layout */
  --container: 1600px;
  --pad: 16px;
  --gap: 12px;

  /* Radius */
  --r-xl: 22px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  /* Typography */
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Light theme (default for all pages) */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface2: #fafafa;
  --text: #111;
  --muted: rgba(17,17,17,0.68);

  --border: rgba(17,17,17,0.10);
  --border2: rgba(17,17,17,0.16);

  --shadow: 0 10px 28px rgba(0,0,0,0.08);
  --shadow2: 0 16px 46px rgba(0,0,0,0.12);

  /* Accents */
  --primary: #111;
  --primary2: #000;
  --danger: #e03131;

  /* Forms */
  --input-bg: #fff;
  --input-border: rgba(17,17,17,0.16);

  /* Touch */
  --tap: rgba(0,0,0,0.08);
}

/* Dashboard (dark) kann per body class wechseln:
   <body class="theme-dark">
*/
body.theme-dark{
  color-scheme: dark;

  --bg: #070a10;
  --surface: rgba(16, 18, 24, 0.60);
  --surface2: rgba(16, 18, 24, 0.42);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);

  --border: rgba(255,255,255,0.14);
  --border2: rgba(255,255,255,0.20);

  --shadow: 0 14px 44px rgba(0,0,0,0.22);
  --shadow2: 0 18px 60px rgba(0,0,0,0.28);

  --primary: rgba(255,255,255,0.92);
  --primary2: rgba(255,255,255,1);

  --input-bg: rgb(0, 0, 0);
  --input-border: rgba(255,255,255,0.16);

  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(120,180,255,0.28), transparent 55%),
    radial-gradient(900px 600px at 80% 0%, rgba(25,179,107,0.18), transparent 55%),
    radial-gradient(900px 700px at 70% 90%, rgba(255,170,0,0.10), transparent 60%),
    linear-gradient(180deg, #0b0f17 0%, #070a10 100%);
}

/* =========================
   2) Global Reset
   ========================= */
*,
*::before,
*::after{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img{ max-width: 100%; display:block; }

a{ color: inherit; }

/* Touch-friendly sizes + iOS Zoom verhindern */
input, select, button, textarea{
  min-height: 44px;
  font-size: 16px;
}

/* Tap highlight */
@media (hover: none) and (pointer: coarse){
  a, button, input, select, textarea, .btn{
    -webkit-tap-highlight-color: var(--tap);
  }
}

/* =========================
   3) Layout: Topbar / Container
   ========================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: #111;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

/* Dark theme Topbar: glass */
body.theme-dark .topbar{
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(14px);
}

.topbar__inner{
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand__title{
  font-weight: 1000;
  font-size: 16px;
  letter-spacing: .2px;
}

.brand__meta{
  opacity: .75;
  font-size: 12px;
  margin-top: 2px;
}

.container{
  max-width: var(--container);
  margin: 18px auto;
  padding: 0 var(--pad);
}

/* =========================
   4) Surfaces / Cards
   ========================= */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

body.theme-dark .card{
  backdrop-filter: blur(14px);
}

/* Headings */
h1{
  margin: 0 0 6px 0;
  font-size: 22px;
  letter-spacing: .2px;
}
.muted{ color: var(--muted); margin: 0 0 14px 0; }
.small{ font-size: 12px; }
.mono{ font-family: var(--mono); font-weight: 800; }

/* =========================
   5) Grid / Row helpers
   ========================= */
.grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
.row{ display: flex; gap: var(--gap); align-items: end; margin-top: 6px; }
.row > div{ min-width: 0; }
.row__grow{ flex: 1; min-width: 0; }

@media (max-width: 900px){
  .grid{ grid-template-columns: 1fr; }
}

/* =========================
   6) Forms
   ========================= */
label{
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 800;
  letter-spacing: .2px;
}

input, select, textarea{
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus{
  border-color: rgba(120,180,255,0.55);
  box-shadow: 0 0 0 4px rgba(120,180,255,0.18);
}

/* =========================
   7) Buttons
   ========================= */
.actions{ display: flex; gap: 10px; align-items: end; }

.btn{
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .10s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
}

.btn:hover{
  filter: brightness(0.985);
  border-color: rgba(120,180,255,0.35);
  box-shadow: 0 14px 30px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}
.btn:active{ transform: translateY(0px); }

.btn--primary{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
body.theme-dark .btn--primary{
  background: rgba(255,255,255,0.92);
  color: #070a10;
  border-color: rgba(255,255,255,0.92);
}
.btn--danger{
  border-color: rgba(224,49,49,0.35);
  background: rgba(224,49,49,0.10);
}
.btn--xs{
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--r-md);
}

/* =========================
   8) Divider / Messages
   ========================= */
.divider{ height: 1px; background: rgba(0,0,0,0.08); margin: 16px 0; }
body.theme-dark .divider{ background: rgba(255,255,255,0.10); }

.msg{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
}
body.theme-dark .msg{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

.msg--ok{
  background: rgba(25,179,107,0.10);
  border-color: rgba(25,179,107,0.26);
}
.msg--err{
  background: rgba(255,80,80,0.10);
  border-color: rgba(255,80,80,0.28);
}

/* =========================
   9) Tables (Desktop) + Mobile Card-Table
   ========================= */
.tablewrap{
  overflow: auto;
  margin-top: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--r-lg);
  -webkit-overflow-scrolling: touch;
}
body.theme-dark .tablewrap{ border-color: rgba(255,255,255,0.10); }

.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th, .table td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: left;
}
body.theme-dark .table th,
body.theme-dark .table td{ border-bottom-color: rgba(255,255,255,0.10); }

.table th{
  background: rgba(0,0,0,0.02);
  font-size: 12px;
  color: rgba(0,0,0,0.65);
  position: sticky;
  top: 0;
  z-index: 1;
}
body.theme-dark .table th{
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
}

/* Row hover */
.table tbody tr{
  transition: transform .12s ease, filter .12s ease;
  cursor: pointer;
}
.table tbody tr:hover{
  filter: brightness(0.99);
}
body.theme-dark .table tbody tr:hover{
  filter: brightness(1.06);
}

/* Badges */
.badge{
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,0.14);
  background: rgba(0,0,0,0.03);
}
body.theme-dark .badge{
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}

.badge--on{
  background: rgba(25,179,107,0.10);
  border-color: rgba(25,179,107,0.26);
}
.badge--off{
  background: rgba(255,80,80,0.10);
  border-color: rgba(255,80,80,0.28);
}

/* Mobile table -> cards (nur wenn du data-label in td setzt) */
@media (max-width: 760px){
  .container{ padding: 0 12px; margin: 12px auto; }
  .card{ padding: 14px; border-radius: var(--r-lg); }

  .row{
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap);
  }
  .actions{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .actions .btn{ width: 100%; }

  .table{ min-width: 0; width: 100%; border-collapse: separate; border-spacing: 5px 10px; }
  .table thead{ display: none; }

  .table tbody tr{
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
  }

  .table tbody td{
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    text-align: left;
  }
  body.theme-dark .table tbody td{ border-bottom-color: rgba(255,255,255,0.10); }

  .table tbody td:last-child{ border-bottom: 0; }

  .table tbody td::before{
    content: attr(data-label);
    font-weight: 800;
    color: var(--muted);
    flex: 0 0 42%;
  }
  .table tbody td > *{ max-width: 58%; }

  .btn--xs{
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }
}

/* =========================
   10) Modal (generic)
   ========================= */
.modal[hidden]{ display: none; }
.modal{ position: fixed; inset: 0; z-index: 9999; }
.modal__backdrop{ position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal__card{
  position: relative;
  max-width: 520px;
  margin: 20px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  box-shadow: var(--shadow2);
}
body.theme-dark .modal__card{ backdrop-filter: blur(14px); }

.modal__top{ display: flex; justify-content: space-between; align-items: center; gap: 10px; }
