/* ===== Reset & Base ===== */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #f6f7f8;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #68707a;
  --border: #e5e7eb;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);

  --accent: #2563eb;        /* Primärfarbe (Blau) */
  --accent-600: #1e40af;
  --secondary: #6b7280;     /* Sekundärfarbe (Grau) */
  --secondary-600: #4b5563;

  --radius: 14px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 28px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #151923;
    --text: #e5e7eb;
    --muted: #9aa3af;
    --border: #262a35;
    --shadow: 0 6px 28px rgba(0,0,0,0.4);

    --accent: #60a5fa;
    --accent-600: #3b82f6;
    --secondary: #94a3b8;
    --secondary-600: #64748b;
  }
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-3);
}

/* ===== Layout ===== */
.container {
  width: min(1100px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo {
  width: 140px;
  height: auto;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: clamp(1.2rem, 1.2rem + 1vw, 1.8rem);
  color: var(--muted);
  font-weight: 600;
}

.actions {
  display: flex;
  justify-content: end;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

/* ===== Tiles (als <a>, gesamte Karte klickbar) ===== */
.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  min-height: 140px;
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
}

.tile:hover,
.tile:focus-visible,
.tile:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.tile .tile-body {
  display: grid;
  gap: var(--space-2);
}

.tile-title {
  font-weight: 600;
  word-break: break-word;
}

.tile-meta {
  color: var(--muted);
  font-size: .9rem;
  display: flex;
  gap: .5ch;
  flex-wrap: wrap;
}

/* Aktionen (optischer Button, nicht interaktiv) */
.tile .tile-actions {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
}

/* Keine speziellen Folder-Styles (gleich wie Datei) */
.tile.folder {}

/* ===== Buttons (optisch) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .7rem 1rem;
  min-height: 44px; /* Touch-Ziel */
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color .18s ease, border-color .18s ease, transform .06s ease, color .18s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* Der Button ist nur Deko – keine eigenen Pointer-Events */
.btn-static {
  pointer-events: none;
  cursor: inherit;
}

/* Sekundär-Button (Zurück) */
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--secondary);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--secondary-600);
}

/* ===== Leerer Zustand ===== */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ===== Accessibility ===== */
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .35); /* Akzent-Fokus */
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
