/* =====================================================================
   bigaku.studio Kundenportal — Design System
   Stil: minimalistisch, editorial, hochwertig. Creme/Weiß, Gold-Akzent,
   Serifenschrift für Überschriften, moderne Sans-Serif für UI/Text.
   ===================================================================== */

:root {
  --color-bg: #F8F6F1;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F1EDE4;
  --color-text: #121212;
  --color-text-secondary: #6F6B64;
  --color-border: #E8E3D8;
  --color-accent: #A77A3D;
  --color-accent-light: #C79A5C;
  --color-accent-soft: rgba(167, 122, 61, 0.12);
  --color-success: #3F7A5C;
  --color-success-soft: rgba(63, 122, 92, 0.12);
  --color-warning: #B8863B;
  --color-warning-soft: rgba(184, 134, 59, 0.14);
  --color-danger: #A8433A;
  --color-danger-soft: rgba(168, 67, 58, 0.12);

  --shadow-sm: 0 1px 2px rgba(18, 18, 18, 0.04), 0 1px 3px rgba(18, 18, 18, 0.03);
  --shadow-md: 0 4px 16px rgba(18, 18, 18, 0.06), 0 2px 6px rgba(18, 18, 18, 0.04);
  --shadow-lg: 0 12px 32px rgba(18, 18, 18, 0.09);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --sidebar-width: 264px;
  --sidebar-width-tablet: 84px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--color-text);
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-light); }

.text-muted { color: var(--color-text-secondary); }
.text-sm { font-size: 0.85rem; }

/* ---------------------------------------------------------------------
   Auth / Login-Seite
   --------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(167,122,61,0.08), transparent 45%),
    var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px 40px 36px;
}

.auth-wordmark {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 28px;
  display: block;
  color: var(--color-text);
}
.auth-wordmark span { color: var(--color-accent); }

.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.3em; }
.auth-sub { color: var(--color-text-secondary); font-size: 0.92rem; margin-bottom: 28px; }

.auth-footnote {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--color-border);
  padding-top: 18px;
}

/* ---------------------------------------------------------------------
   Formulare
   --------------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--color-text-secondary); }
.checkbox-row input { accent-color: var(--color-accent); }

.field-error { color: var(--color-danger); font-size: 0.8rem; margin-top: 6px; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-text);
  color: #fff;
}
.btn-primary:hover { background: #2a2a2a; color: #fff; }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover { background: var(--color-accent-light); color: #fff; }

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #8f372f; color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   App-Shell: Sidebar + Content
   --------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
  padding: 0 8px;
}
.sidebar-brand span { color: var(--color-accent); }
.sidebar-tagline { font-size: 0.72rem; color: var(--color-text-secondary); padding: 0 8px; margin-bottom: 30px; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; flex: 1; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a:hover { background: var(--color-surface-alt); color: var(--color-text); }
.sidebar-nav a.active { background: var(--color-accent-soft); color: var(--color-accent); font-weight: 600; }
.sidebar-nav .icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer-nav { border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 12px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
}
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.sidebar-user-role { font-size: 0.72rem; color: var(--color-text-secondary); }

/* Mobile Hamburger */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }

/* ---------------------------------------------------------------------
   Content
   --------------------------------------------------------------------- */
.content {
  flex: 1;
  padding: 40px 48px 60px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.page-header .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--color-accent);
  font-weight: 700;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card + .card { margin-top: 20px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title-row h3 { margin: 0; }

.stat-card .stat-label { font-size: 0.78rem; color: var(--color-text-secondary); margin-bottom: 6px; }
.stat-card .stat-value { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 600; }
.stat-card .stat-meta { font-size: 0.78rem; color: var(--color-text-secondary); margin-top: 4px; }

/* Progressbar */
.progress-track {
  width: 100%; height: 8px; border-radius: 99px;
  background: var(--color-surface-alt);
  overflow: hidden;
  margin: 10px 0;
}
.progress-fill { height: 100%; background: var(--color-accent); border-radius: 99px; transition: width 0.3s ease; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { background: var(--color-surface-alt); color: var(--color-text-secondary); }
.badge-accent { background: var(--color-accent-soft); color: var(--color-accent); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------------------------------------------------------------------
   Tabellen
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-text-secondary); font-weight: 600;
  padding: 14px 18px; border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
table.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--color-border); font-size: 0.88rem; vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: rgba(167,122,61,0.03); }

.file-name-cell { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------------------------------------------------------------
   File icons (reines CSS, keine externen Assets nötig)
   --------------------------------------------------------------------- */
.file-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.02em;
  color: #fff; flex-shrink: 0;
}
.file-icon.folder { background: var(--color-accent); }
.file-icon.pdf   { background: #A8433A; }
.file-icon.image { background: #3F7A5C; }
.file-icon.doc   { background: #2E5FA3; }
.file-icon.sheet { background: #3F7A5C; }
.file-icon.slide { background: #B8863B; }
.file-icon.zip   { background: #6F6B64; }
.file-icon.text  { background: #6F6B64; }
.file-icon.file  { background: #948F84; }

/* ---------------------------------------------------------------------
   Breadcrumbs
   --------------------------------------------------------------------- */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--color-text-secondary); margin-bottom: 20px; }
.breadcrumbs a { color: var(--color-text-secondary); }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs .sep { color: var(--color-border); }
.breadcrumbs .current { color: var(--color-text); font-weight: 600; }

/* ---------------------------------------------------------------------
   Toolbar (Suche, Sortierung, Ansicht)
   --------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar-search { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.toolbar-search input {
  width: 100%; padding: 9px 14px 9px 36px; border-radius: 99px;
  border: 1px solid var(--color-border); font-size: 0.85rem; background: var(--color-surface);
}
.toolbar-search::before {
  content: ""; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border: 2px solid var(--color-text-secondary); border-radius: 50%;
}
.view-toggle { display: flex; gap: 4px; background: var(--color-surface-alt); padding: 4px; border-radius: var(--radius-sm); }
.view-toggle a { padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; color: var(--color-text-secondary); font-weight: 600; }
.view-toggle a.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* Grid view */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.file-grid-item {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 18px 14px; text-align: center; transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.file-grid-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.file-grid-item .file-icon { margin: 0 auto 10px; width: 44px; height: 44px; font-size: 0.68rem; }
.file-grid-item .fname { font-size: 0.8rem; font-weight: 500; word-break: break-word; }
.file-grid-item .fmeta { font-size: 0.7rem; color: var(--color-text-secondary); margin-top: 4px; }

/* ---------------------------------------------------------------------
   Pagination
   --------------------------------------------------------------------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 0.82rem; color: var(--color-text-secondary); border: 1px solid transparent;
}
.pagination a:hover { border-color: var(--color-border); color: var(--color-text); }
.pagination .active { background: var(--color-text); color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------------
   Empty States
   --------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-secondary); }
.empty-state .emoji-frame {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center;
  color: var(--color-accent); font-size: 1.4rem;
}
.empty-state h3 { color: var(--color-text); margin-bottom: 6px; }

/* ---------------------------------------------------------------------
   Skeleton Loader
   --------------------------------------------------------------------- */
.skeleton { background: linear-gradient(90deg, var(--color-surface-alt) 25%, #e9e4d8 37%, var(--color-surface-alt) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 8px; }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-row { height: 52px; margin-bottom: 10px; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------------
   Upload Dropzone
   --------------------------------------------------------------------- */
.dropzone {
  border: 2px dashed var(--color-border); border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center; background: var(--color-surface);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone.dragover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.dropzone .dz-icon { width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.dropzone input[type="file"] { display: none; }

.upload-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.upload-item:last-child { border-bottom: none; }
.upload-item .upload-info { flex: 1; min-width: 0; }
.upload-item .upload-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item .progress-track { margin: 6px 0 0; height: 6px; }
.upload-item .upload-status { font-size: 0.75rem; color: var(--color-text-secondary); min-width: 90px; text-align: right; }
.upload-item .upload-status.success { color: var(--color-success); }
.upload-item .upload-status.error { color: var(--color-danger); }

/* ---------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast {
  background: var(--color-text); color: #fff; padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 0.85rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.2s ease;
}
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------------------------------------------
   Modal / Bestätigungsdialog
   --------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(18,18,18,0.45);
  display: none; align-items: center; justify-content: center; z-index: 900; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box { background: var(--color-surface); border-radius: var(--radius-lg); padding: 28px; max-width: 420px; width: 100%; box-shadow: var(--shadow-lg); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.portal-footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--color-border); font-size: 0.78rem; color: var(--color-text-secondary); display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
.portal-footer a { color: var(--color-text-secondary); }
.portal-footer a:hover { color: var(--color-accent); }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-width-tablet); padding: 24px 12px; align-items: center; }
  .sidebar-brand, .sidebar-tagline, .sidebar-nav a span.label, .sidebar-user-name, .sidebar-user-role { display: none; }
  .sidebar-user { justify-content: center; padding: 8px; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .content { padding: 32px 24px 48px; }
}

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px;
    transform: translateX(-100%); transition: transform 0.2s ease; z-index: 200;
    align-items: stretch; padding: 24px 20px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-brand, .sidebar-tagline, .sidebar-nav a span.label, .sidebar-user-name, .sidebar-user-role { display: block; }
  .sidebar-nav a { justify-content: flex-start; }
  .sidebar-user { justify-content: flex-start; }

  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(18,18,18,0.4); z-index: 150; }
  .sidebar-overlay.open { display: block; }

  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 100;
  }
  .mobile-topbar .brand { font-family: var(--font-serif); font-weight: 600; }
  .hamburger-btn { background: none; border: none; cursor: pointer; padding: 6px; }
  .hamburger-btn span { display: block; width: 20px; height: 2px; background: var(--color-text); margin: 4px 0; }

  .content { padding: 24px 16px 40px; }
  .page-header { flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  table.data-table { min-width: 560px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 32px 24px 28px; }
}
