/* ============================================
   TraumGmbH — Components
   Buttons, Inputs, Badges, Pills, Cards,
   Toast, Modal, Loading, Empty States
   ============================================ */

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-accent { background: var(--accent-pale); color: var(--accent); }
.badge-success { background: var(--success-pale); color: var(--success); }
.badge-warning { background: var(--warning-pale); color: var(--warning); }
.badge-info { background: var(--info-pale); color: var(--info); }
.badge-count {
  background: var(--accent); color: white;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}

/* === STATUS PILLS === */
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.2px; white-space: nowrap;
}
.pill-draft { background: #fef6e4; color: #92700c; }
.pill-done { background: var(--success-pale); color: var(--success); }
.pill-open { background: var(--info-pale); color: var(--info); }
.pill-sent { background: var(--success-pale); color: var(--success); }
.pill-late { background: var(--danger-pale); color: var(--accent); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 24px;
  background: var(--accent); color: white; border: none; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 700; font-family: var(--font); cursor: pointer;
  transition: background 0.12s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn-full { width: 100%; }
.btn-back {
  width: 36px; height: 36px; padding: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sec); transition: background 0.1s;
}
.btn-back:hover { background: var(--border); }
.btn-ghost {
  background: none; border: 1px solid var(--border); color: var(--text-sec);
  padding: 10px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; font-family: var(--font); cursor: pointer;
  transition: all 0.1s;
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* === INPUTS === */
.inp {
  width: 100%; padding: 13px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 16px; font-family: var(--font); outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: white; }
.inp::placeholder { color: var(--text-muted); }
.inp-label { display: block; font-size: 13px; color: var(--text-sec); margin-bottom: 6px; font-weight: 600; }
.inp-group { margin-bottom: 18px; }
.inp-search { padding-left: 42px; }

/* === SEARCH BAR === */
.search { position: relative; margin: 16px 24px; }
.search-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* === FILTER TABS === */
.filters {
  display: flex; gap: 8px; padding: 0 24px 14px;
  overflow-x: auto; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.ftab {
  padding: 8px 16px; background: var(--bg-white);
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 13px; color: var(--text-sec); white-space: nowrap;
  cursor: pointer; font-family: var(--font); font-weight: 500;
  transition: all 0.1s;
}
.ftab:hover { border-color: var(--text-muted); }
.ftab.on { background: var(--accent); color: white; border-color: var(--accent); font-weight: 700; }

/* === VIEW TOGGLE === */
.vtog {
  display: flex; margin: 14px 24px;
  background: var(--bg-input); border-radius: var(--r-sm); padding: 3px;
}
.vtog-b {
  flex: 1; padding: 8px; background: none; border: none;
  border-radius: 8px; font-size: 12px; font-weight: 600;
  font-family: var(--font); color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.vtog-b.on { background: var(--bg-white); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }

/* === CARDS === */
.card {
  margin: 0 24px 10px; padding: 16px 18px;
  background: var(--bg-white); border-radius: var(--r);
  border: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.card:hover { background: #fdfdfb; }
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-title { font-weight: 700; font-size: 15px; }
.card-sub { font-size: 12px; color: var(--text-sec); margin-top: 3px; line-height: 1.4; }
.card-arr { color: var(--text-muted); }

/* === STAT CARDS === */
.stats { display: flex; gap: 10px; padding: 0 24px; margin-top: 16px; }
.stat {
  flex: 1; padding: 16px 12px; background: var(--bg-white);
  border-radius: var(--r); border: 1px solid var(--border);
  text-align: center;
}
.stat-v { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.stat-l { font-size: 10px; color: var(--text-sec); font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-v.red { color: var(--accent); }
.stat-v.org { color: var(--warning); }
.stat-v.grn { color: var(--success); }

/* === TOAST === */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
  padding: 12px 24px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 100; transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--accent); color: white; }

/* === LOADING === */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 0;
}

/* === EMPTY STATE === */
.empty {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-ic { margin-bottom: 12px; }
.empty-text { font-size: 14px; font-weight: 500; }

/* === MODAL === */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3);
  z-index: 60; display: none; align-items: flex-end; justify-content: center;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--bg-white); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 500px; max-height: 80vh;
  padding: 24px; overflow-y: auto;
}
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 20px;
}

/* === Desktop button variants & stats === */
@media (min-width: 768px) {
  .desktop-main .stats { gap: 16px; margin-top: 0; }
  .desktop-main .stat { padding: 24px 16px; }
  .desktop-main .stat-v { font-size: 32px; }

  .btn-sm {
    padding: 8px 14px; font-size: 12px; font-weight: 600;
    border-radius: 8px; border: none; cursor: pointer;
    font-family: var(--font);
    display: inline-flex; align-items: center; gap: 5px;
    transition: all 0.1s;
  }
  .btn-sm-accent { background: var(--accent); color: white; }
  .btn-sm-accent:hover { background: var(--accent-hover); }
  .btn-sm-ghost {
    background: none; border: 1px solid var(--border); color: var(--text-sec);
  }
  .btn-sm-ghost:hover { border-color: var(--text-muted); color: var(--text); }
  .btn-sm-danger { background: var(--danger-pale); color: var(--accent); }
  .btn-sm-danger:hover { background: #f9ddd9; }
  .btn-save {
    background: var(--accent); color: white;
    padding: 10px 20px; border: none; border-radius: var(--r-sm);
    font-size: 14px; font-weight: 700; font-family: var(--font);
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    transition: background 0.1s;
  }
  .btn-save:hover { background: var(--accent-hover); }
  .btn-save:disabled { opacity: 0.5; cursor: not-allowed; }
}