@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --border-h:     #c7d2fe;
  --text:         #0f172a;
  --text-2:       #1e293b;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;

  --primary:      #6366f1;
  --primary-h:    #4f46e5;
  --primary-soft: #eef2ff;
  --primary-glow: rgba(99,102,241,.22);

  --green:        #10b981;
  --green-soft:   #ecfdf5;
  --red:          #ef4444;
  --red-soft:     #fef2f2;
  --amber:        #d97706;
  --amber-soft:   #fffbeb;

  --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 4px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,.1),  0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 8px 32px rgba(15,23,42,.12), 0 4px 8px rgba(15,23,42,.04);

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 16px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
a   { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }
main { padding: 2.5rem 0 5rem; }

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 100;
}

header::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
}

header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
nav { display: flex; align-items: center; gap: 0.75rem; }

.nav-tabs {
  display: flex;
  gap: 0.2rem;
  background: var(--bg);
  padding: 0.2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nav-tabs a {
  padding: 0.375rem 0.9rem;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nav-tabs a:hover { color: var(--text-2); background: rgba(255,255,255,.6); }
.nav-tabs a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs), 0 0 0 1px rgba(0,0,0,.05);
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.95rem;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff !important;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  box-shadow: 0 2px 6px var(--primary-glow);
  transition: all 0.15s ease;
}
.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid;
}
.alert-success { background: var(--green-soft); border-color: #a7f3d0; color: #065f46; }
.alert-error   { background: var(--red-soft);   border-color: #fecaca; color: #991b1b; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-h), #6d28d9);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-1px);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-h);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: var(--red-soft);
  border-color: var(--red);
}

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.badge-youtube { background: #fee2e2; color: #b91c1c; }
.badge-rss     { background: var(--amber-soft); color: var(--amber); border: 1px solid #fde68a; }

/* ── Meta ────────────────────────────────────────────────────────────────── */
.meta { font-size: 0.8rem; color: var(--text-muted); }

/* ── Feed cards (Feeds view) ─────────────────────────────────────────────── */
.grid-feeds { display: flex; flex-direction: column; gap: 0.75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  border-color: var(--border-h);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-title { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary); text-decoration: none; }

/* ── Feed tag (news list) ────────────────────────────────────────────────── */
.feed-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
  border: 1px solid;
}
.feed-tag:hover { opacity: 0.85; transform: scale(1.03); text-decoration: none; }
.feed-tag-rss     { background: var(--amber-soft); color: var(--amber);  border-color: #fde68a; }
.feed-tag-youtube { background: #fee2e2;           color: #b91c1c;       border-color: #fecaca; }

/* ── Item list (News + Feed view) ────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 0.75rem; }

.item-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.375rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}
.item-card:hover {
  border-color: var(--border-h);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Stretched link: gesamte Kachel ist klickbar */
.item-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

/* Feed-Tag und andere Links bleiben über dem Overlay klickbar */
.feed-tag { position: relative; z-index: 1; }

.item-card .thumb {
  flex-shrink: 0;
  width: 152px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.item-body { flex: 1; min-width: 0; }

.item-title { font-weight: 600; font-size: 0.975rem; line-height: 1.4; }
.item-title a { color: var(--text-2); }
.item-title a:hover { color: var(--primary); text-decoration: none; }

.item-desc {
  font-size: 0.835rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 5rem 2rem; color: var(--text-muted); }
.empty p { font-size: 1.05rem; margin-bottom: 1.25rem; }

/* ── Form ────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.125rem; }
label  { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.35rem; color: var(--text-2); }

input[type=text], input[type=url], input[type=password] {
  width: 100%;
  padding: 0.625rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=text]:hover, input[type=url]:hover, input[type=password]:hover { border-color: var(--border-h); }
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

/* ── Pager ───────────────────────────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.pager-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s;
}
.pager-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-h);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.pager-disabled { color: var(--text-faint); cursor: default; box-shadow: none; }
.pager-disabled:hover { transform: none; background: var(--surface); border-color: var(--border); box-shadow: none; }

.pager-pages { display: flex; gap: 0.25rem; }

.pager-page {
  min-width: 2.25rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-align: center;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.875rem;
  transition: all 0.15s;
}
.pager-page:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--border-h);
  text-decoration: none;
}
.pager-current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.pager-ellipsis { padding: 0.45rem 0.25rem; color: var(--text-faint); font-size: 0.875rem; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── YouTube embed ───────────────────────────────────────────────────────── */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
}
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.video-description {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-muted);
  padding: 1.25rem 1.375rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── Item detail ─────────────────────────────────────────────────────────── */
.item-teaser {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1.75rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.item-content {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-2);
}
.item-content > * + * { margin-top: 1.25rem; }
.item-content h2, .item-content h3, .item-content h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2rem;
  letter-spacing: -0.015em;
}
.item-content h2 { font-size: 1.35rem; }
.item-content h3 { font-size: 1.15rem; }
.item-content h4 { font-size: 1rem; }
.item-content ul, .item-content ol { padding-left: 1.6rem; }
.item-content li + li { margin-top: 0.4rem; }
.item-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.item-content a:hover { color: var(--primary-h); }
.item-content img { max-width: 100%; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.item-content pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.125rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}
.item-content code { background: var(--surface-2); padding: 0.15em 0.35em; border-radius: 4px; font-size: 0.875em; border: 1px solid var(--border); }
.item-content pre code { background: none; padding: 0; border: none; font-size: inherit; }
.item-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.875rem 1.25rem;
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
}

/* ── Nav user dropdown ───────────────────────────────────────────────────── */
.nav-user { position: relative; }

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-user-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-h);
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 190px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.open { display: block; }

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  background: transparent;
  border: none;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s;
  line-height: 1.4;
}
.user-dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.user-dropdown form { border-top: 1px solid var(--border); }
.user-dropdown-logout:hover { background: var(--red-soft); color: var(--red); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.5rem;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  padding: 2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }

.modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* ── Login page ──────────────────────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 2rem;
}
