/* ===========================================================================
   Fotografen-Portal — gemeinsames Design
   Ueberschriften: Sora. Fliesstext: Inter. Beide lokal gehostet (kein CDN,
   DSGVO-konform). Schrift-Dateien unter /assets/fonts/.
   Reines CSS, kein Framework.
   =========================================================================== */

/* ---------- Lokale Web-Fonts (woff2, self-hosted) ---------- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/inter-700.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/sora-400.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/sora-500.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/sora-600.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/sora-700.woff2') format('woff2'); }

:root {
  /* Kern-Palette */
  --ink:          #40403D;
  --ink-light:    #6B6B68;
  --ink-muted:    #9A9A97;
  /* Hinweis: Variablen heissen aus historischen Gruenden weiter "sage",
     tragen jetzt aber einen gedaempften Schieferblau-Ton (Marco-Wunsch). */
  --sage:         #8AA0B8;
  --sage-dark:    #6B7F99;
  --sage-light:   #C3D0DE;
  --sage-pale:    #E9EEF4;
  --sand:         #D9D3C4;
  --sand-pale:    #EDE9DE;
  --camel:        #BE9F7C;
  --camel-dark:   #735239;
  --camel-light:  #E6D4BF;
  --camel-pale:   #F3EBDE;
  --canvas:       #F3F4F8;
  --white:        #FFFFFF;

  /* Status (gedaempft, nie grell) */
  --success:      #4F6E8C;
  --success-bg:   #E9EEF4;
  --warning:      #8A6F4E;
  --warning-bg:   #F3EBDE;
  --danger:       #8A6560;
  --danger-bg:    #F0E5E3;

  /* Borders */
  --border:        rgba(64, 64, 61, 0.08);
  --border-strong: rgba(64, 64, 61, 0.14);

  /* Schatten */
  --shadow-xs: 0 1px 2px rgba(64,64,61,0.04);
  --shadow-sm: 0 2px 4px rgba(64,64,61,0.06), 0 1px 2px rgba(64,64,61,0.04);
  --shadow-md: 0 4px 12px rgba(64,64,61,0.08), 0 2px 4px rgba(64,64,61,0.05);
  --shadow-lg: 0 12px 32px rgba(64,64,61,0.10), 0 4px 8px rgba(64,64,61,0.06);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scrollbar-gutter: stable; }

/* Scrollbalken im Design (Sage statt Browser-Grau). */
* { scrollbar-width: thin; scrollbar-color: var(--sage-light) var(--sage-pale); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--sage-pale); }
::-webkit-scrollbar-thumb { background: var(--sage-light); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--sage); }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;            /* 16px */
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Sora', system-ui, sans-serif; font-weight: 400; letter-spacing: -0.01em; color: #556295; }
h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.3rem; }

a { color: var(--sage-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow {
  font-size: 0.9375rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-muted);
}

.muted { color: var(--ink-muted); }
.serif { font-family: 'Sora', system-ui, sans-serif; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 1rem 'Inter', sans-serif;
  padding: 10px 20px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background 200ms var(--ease-smooth), border-color 200ms var(--ease-smooth);
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #FFFFFF; color: #556295; border-color: #556295; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: #F3F4F8; text-decoration: none; }
.btn-ghost { background: #FFFFFF; color: #556295; border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: #F3F4F8; border-color: #556295; text-decoration: none; }
.btn-danger { background: transparent; color: #8A6560; border-color: rgba(160,120,112,0.3); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); border-color: #A07870; color: #6E4E49; }
.btn-sm { padding: 6px 12px; font-size: 0.9375rem; }
/* Reiner Icon-Button (kein Text), quadratisch. */
.btn-icon { padding: 7px; line-height: 0; }
.btn-icon svg { display: block; }

/* ---------- Inputs ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 0.9375rem; font-weight: 500; color: var(--ink-light); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: 400 1rem 'Inter', sans-serif; line-height: 1.4; color: var(--ink);
  background: var(--white); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 14px;
  transition: border 150ms var(--ease-smooth), box-shadow 150ms var(--ease-smooth);
}
/* Selects exakt auf Input-Höhe bringen: native Optik aus, eigener Chevron. */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B6B68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(138,160,184,0.18);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.checkline { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.checkline input { width: auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-xs);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: var(--radius-xs); font: 500 0.9375rem 'Inter', sans-serif;
  letter-spacing: 0.01em; background: var(--sage-pale); color: var(--sage-dark);
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.9375rem; font-weight: 600; color: var(--ink-light); padding: 10px 12px; border-bottom: 1px solid var(--border-strong); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(138,160,184,0.06); }
.mono { font-family: ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', monospace; font-size: 0.9rem; }

/* ---------- App-Shell (Admin) ----------
   Sidebar ueber die volle Hoehe (Brand oben drin), Topbar nur ueber dem Inhalt. */
.shell { display: grid; grid-template-columns: 280px 1fr; grid-template-rows: 64px 1fr; min-height: 100vh; grid-template-areas: "sidebar topbar" "sidebar content"; }
.topbar { grid-area: topbar; background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.sidebar { grid-area: sidebar; background: #F3F4F8; border-right: 1px solid var(--border); padding: 0 14px 20px; }
/* Brand oben + feiner Trennstrich zur Navigation darunter. */
.sidebar .brand { font-family: 'Sora', system-ui, sans-serif; font-weight: 400; font-size: 1.4rem; color: #556295; line-height: 1.15;
  padding: 20px 10px 18px; margin: 0 4px 14px; border-bottom: 1px solid rgba(85, 98, 149, 0.18); }
.content { grid-area: content; padding: 32px 32px 80px; max-width: 1400px; width: 100%; margin: 0 auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm);
  color: #AFB6D1; font-weight: 500; cursor: pointer; border-left: 3px solid transparent;
  transition: background 160ms var(--ease-smooth), color 160ms var(--ease-smooth);
}
.nav-item:hover { background: rgba(85, 98, 149, 0.06); color: #556295; text-decoration: none; }
.nav-item.active { color: #556295; border-left-color: #556295; background: #FFFFFF; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-strong); margin-bottom: 24px; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 12px 18px; font: 500 1rem 'Inter', sans-serif; color: var(--ink-light);
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: color 160ms var(--ease-smooth), border-color 160ms var(--ease-smooth);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--sage-dark); border-bottom-color: var(--sage); }

/* ---------- Login-Split ---------- */
.login { display: grid; grid-template-columns: 45% 55%; min-height: 100vh; }
.login .panel-sage { background: linear-gradient(150deg, var(--sage) 0%, var(--sage-dark) 100%); color: var(--white); display: flex; flex-direction: column; justify-content: center; padding: 64px; }
.login .panel-sage .brand { font-family: 'Sora', system-ui, sans-serif; font-weight: 400; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.05; }
.login .panel-sage p { margin-top: 16px; font-size: 1.125rem; opacity: 0.92; max-width: 30ch; }
.login .panel-form { background: var(--white); display: flex; align-items: center; justify-content: center; padding: 48px; }
.login .panel-form form { width: 100%; max-width: 360px; }

/* ---------- Galerie-Grid (Kundenansicht) ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-xs); position: relative; }
.tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--sand-pale); cursor: pointer; }
.tile .tile-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; gap: 8px; }
.tile.selected { outline: 3px solid #556295; outline-offset: -3px; }
.tile-check { position: absolute; top: 8px; left: 8px; z-index: 2; background: rgba(255,255,255,0.9); border-radius: var(--radius-xs); padding: 3px; line-height: 0; box-shadow: var(--shadow-xs); }
.tile-check input { width: 18px; height: 18px; cursor: pointer; margin: 0; accent-color: #556295; }

/* ---------- Hilfen ---------- */
.page-head { margin-bottom: 28px; }
.page-head h1 { margin-bottom: 6px; }
.stack > * + * { margin-top: 16px; }
.flex { display: flex; align-items: center; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: var(--white); padding: 14px 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: all 250ms var(--ease-smooth); z-index: 100; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #6E4E49; }
.empty { text-align: center; color: var(--ink-muted); padding: 48px 16px; }

/* Modal / Drawer */
.overlay { position: fixed; inset: 0; background: rgba(64,64,61,0.35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.modal { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 48px); overflow: auto; padding: 28px; }
.modal h2 { margin-bottom: 18px; }
.lightbox { position: fixed; inset: 0; background: rgba(40,40,38,0.92); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 24px; }
.lightbox img { max-width: 88vw; max-height: 90vh; object-fit: contain; box-shadow: var(--shadow-lg); }
.lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 2rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 160ms var(--ease-smooth);
}
.lightbox .lb-nav:hover { background: rgba(255,255,255,0.28); }
.lightbox .lb-prev { left: 24px; }
.lightbox .lb-next { right: 24px; }
.lightbox .lb-close {
  position: absolute; top: 20px; right: 24px; width: 44px; height: 44px;
  border-radius: 50%; border: none; background: rgba(255,255,255,0.14); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 160ms var(--ease-smooth);
}
.lightbox .lb-close:hover { background: rgba(255,255,255,0.28); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "content"; }
  .sidebar { display: none; }
  .login { grid-template-columns: 1fr; }
  .login .panel-sage { min-height: 200px; padding: 40px; }
}
