/* ============================================================
   base.css – Design-System: CSS Variables, Reset, Typografie
   Friseurtermin SaaS · helles, frisches, modernes Design
   ============================================================ */

:root {
  /* Primärfarben */
  --c-primary:        #6366f1; /* Indigo */
  --c-primary-hover:  #4f46e5;
  --c-primary-light:  #eef2ff;
  --c-primary-dark:   #3730a3;

  /* Akzent */
  --c-accent:         #f59e0b; /* Amber */
  --c-accent-light:   #fffbeb;

  /* Graustufen */
  --c-white:          #ffffff;
  --c-gray-50:        #f8fafc;
  --c-gray-100:       #f1f5f9;
  --c-gray-200:       #e2e8f0;
  --c-gray-300:       #cbd5e1;
  --c-gray-400:       #94a3b8;
  --c-gray-500:       #64748b;
  --c-gray-600:       #475569;
  --c-gray-700:       #334155;
  --c-gray-800:       #1e293b;
  --c-gray-900:       #0f172a;

  /* Semantisch */
  --c-success:        #10b981;
  --c-success-light:  #d1fae5;
  --c-error:          #ef4444;
  --c-error-light:    #fee2e2;
  --c-warning:        #f59e0b;
  --c-warning-light:  #fef3c7;
  --c-info:           #3b82f6;
  --c-info-light:     #dbeafe;

  /* Text */
  --c-text:           var(--c-gray-800);
  --c-text-muted:     var(--c-gray-500);
  --c-text-light:     var(--c-gray-400);

  /* Hintergründe */
  --c-bg:             var(--c-gray-50);
  --c-surface:        var(--c-white);
  --c-border:         var(--c-gray-200);

  /* Sidebar */
  --c-sidebar-bg:     var(--c-gray-900);
  --c-sidebar-text:   var(--c-gray-300);
  --c-sidebar-active: var(--c-primary);
  --c-sidebar-hover:  rgba(255,255,255,.06);
  --sidebar-w:        240px;

  /* Layout */
  --topbar-h:         56px;
  --radius:           10px;
  --radius-sm:        6px;
  --radius-lg:        16px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow:           0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:        0 8px 24px rgba(0,0,0,.12);

  /* Übergänge */
  --transition:       .15s ease;
}

/* ---- Reset ---- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ---- Typografie ---- */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem;     font-weight: 600; }

.text-sm   { font-size: .8125rem; }
.text-xs   { font-size: .75rem; }
.text-muted { color: var(--c-text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-weight: 500;
  font-size: .875rem;
  line-height: 1;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary   { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }

.btn-secondary { background: var(--c-white); color: var(--c-gray-700); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-gray-100); }

.btn-danger    { background: var(--c-error); color: #fff; border-color: var(--c-error); }
.btn-danger:hover { background: #dc2626; }

.btn-ghost     { background: transparent; color: var(--c-gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--c-gray-100); }

.btn-sm { padding: .35rem .75rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: .5rem; }

/* ---- Formulare ---- */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group + .form-group { margin-top: .875rem; }

label {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--c-gray-700);
}
label .req { color: var(--c-error); margin-left: .15rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-white);
  color: var(--c-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
input.is-invalid, select.is-invalid { border-color: var(--c-error); }
textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: .775rem;
  color: var(--c-text-muted);
}
.form-error {
  font-size: .775rem;
  color: var(--c-error);
}

/* ---- Cards ---- */
.card {
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
}
.card-body  { padding: 1.25rem 1.5rem; }
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.card-header h2, .card-header h3 { margin: 0; }

/* ---- Tabellen ---- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; }
.data-table th {
  text-align: left;
  font-size: .775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  padding: .65rem 1rem;
  border-bottom: 1.5px solid var(--c-border);
  white-space: nowrap;
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-gray-100);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--c-gray-50); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
  line-height: 1;
}
.badge-success  { background: var(--c-success-light); color: #065f46; }
.badge-error    { background: var(--c-error-light);   color: #991b1b; }
.badge-warning  { background: var(--c-warning-light); color: #92400e; }
.badge-info     { background: var(--c-info-light);    color: #1e40af; }
.badge-gray     { background: var(--c-gray-100);      color: var(--c-gray-600); }
.badge-primary  { background: var(--c-primary-light); color: var(--c-primary-dark); }

/* ---- Flash-Nachrichten ---- */
.flash {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.flash--success { background: var(--c-success-light); color: #065f46; border-color: #6ee7b7; }
.flash--error   { background: var(--c-error-light);   color: #991b1b; border-color: #fca5a5; }
.flash--warning { background: var(--c-warning-light); color: #92400e; border-color: #fcd34d; }
.flash--info    { background: var(--c-info-light);    color: #1e40af; border-color: #93c5fd; }
.flash__icon    { font-size: 1rem; flex-shrink: 0; }

/* ---- Modals ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; }
.modal-body   { padding: 1.5rem; flex: 1; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
.modal-close {
  background: none; border: none;
  color: var(--c-text-muted);
  font-size: 1.25rem; line-height: 1;
  padding: .25rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.modal-close:hover { color: var(--c-text); }

/* ---- Avatar ---- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--c-primary-light);
  color: var(--c-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .875rem;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.125rem; }

/* ---- KPI-Karten ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.kpi-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.kpi-label  { font-size: .775rem; color: var(--c-text-muted); font-weight: 500; margin-bottom: .35rem; }
.kpi-value  { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.kpi-sub    { font-size: .8rem; color: var(--c-text-muted); margin-top: .3rem; }
.kpi-icon   { font-size: 1.5rem; margin-bottom: .5rem; }

/* ---- Utility ---- */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-0  { padding: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 1.25rem 0;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

/* ---- Login-Layout (zentriert) ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--c-gray-100) 0%, var(--c-primary-light) 100%);
}
.login-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.login-logo {
  display: flex; align-items: center; gap: .6rem;
  font-size: 1.25rem; font-weight: 700;
  color: var(--c-gray-900);
  margin-bottom: 1.75rem;
}
.login-logo-icon {
  width: 40px; height: 40px;
  background: var(--c-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.25rem;
}

/* ---- Admin-Layout (Sidebar + Content) ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .6rem;
  color: #fff;
  font-weight: 700; font-size: 1rem;
  text-decoration: none;
}
.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: var(--c-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-section {
  padding: .875rem .75rem .375rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-gray-500);
}
.sidebar-nav { padding: .5rem .5rem; flex: 1; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--c-sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  margin-bottom: 1px;
}
.sidebar-link:hover { background: var(--c-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-link.active { background: var(--c-primary); color: #fff; }
.sidebar-link-icon { width: 18px; text-align: center; flex-shrink: 0; opacity: .75; }
.sidebar-link.active .sidebar-link-icon,
.sidebar-link:hover  .sidebar-link-icon { opacity: 1; }
.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .65rem;
  border-radius: var(--radius-sm);
  color: var(--c-sidebar-text);
  font-size: .8125rem;
}
.sidebar-user-name  { font-weight: 600; color: var(--c-gray-200); }
.sidebar-user-role  { font-size: .725rem; color: var(--c-gray-500); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}
.topbar-title { font-size: 1.0625rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.page-content { padding: 1.5rem; flex: 1; }

/* Sidebar-Toggle für Mobile */
.sidebar-toggle {
  display: none;
  background: none; border: none;
  color: var(--c-text);
  font-size: 1.25rem; padding: .25rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .login-card { padding: 1.75rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
