/* ================================================================
   Lepori Schule – Materialien-Website
   Design basierend auf dem Lernspiegel-Designsystem
   ================================================================ */

:root {
  --mat-primary:       #1E3A5F;
  --mat-primary-light: #2D5480;
  --mat-primary-dark:  #162D4A;
  --mat-primary-xlight:#EFF4FA;
  --mat-accent:        #3B82F6;
  --mat-accent-light:  #DBEAFE;
  --mat-success:       #22C55E;
  --mat-success-light: #DCFCE7;
  --mat-warning:       #F97316;
  --mat-warning-light: #FEF3C7;
  --mat-danger:        #EF4444;
  --mat-danger-light:  #FEE2E2;

  --mat-text:          #111827;
  --mat-text-secondary:#374151;
  --mat-text-muted:    #6B7280;
  --mat-text-light:    #9CA3AF;

  --mat-bg:            #F1F5F9;
  --mat-bg-card:       #FFFFFF;
  --mat-bg-hover:      #F3F4F6;
  --mat-bg-input:      #F3F4F6;

  --mat-border:        #E5E7EB;
  --mat-border-focus:  #3B82F6;

  --mat-radius-sm:     6px;
  --mat-radius:        10px;
  --mat-radius-lg:     16px;
  --mat-radius-xl:     24px;

  --mat-shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --mat-shadow:        0 4px 12px rgba(0,0,0,.08);
  --mat-shadow-lg:     0 8px 30px rgba(0,0,0,.12);

  --mat-transition:    200ms ease;
  --mat-font:          'Montserrat', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--mat-font);
  background: var(--mat-bg);
  color: var(--mat-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--mat-accent); text-decoration: none; }
a:hover { color: var(--mat-primary); }
/* Formularelemente erben die Seitenschrift statt der System-Schrift des Browsers */
button, input, select, textarea { font-family: inherit; }

/* ── Landing page ───────────────────────────────────────────── */
.mat-landing-body {
  margin: 0; padding: 0;
  background: var(--mat-bg);
  min-height: 100vh;
}
.mat-landing-nav {
  background: var(--mat-primary); padding: 0 1.5rem; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.mat-landing-nav-brand {
  font-size: 1.1rem; font-weight: 700; color: #fff;
  text-decoration: none;
}
.mat-landing-nav-brand:hover { color: #fff; }
.mat-landing-nav-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: .95rem; font-weight: 600;
  color: rgba(255,255,255,.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 40%; pointer-events: none;
}
.mat-landing {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  min-height: calc(100vh - 120px); flex: 1;
  padding: 2rem 1rem; width: 100%;
  max-width: 760px; margin: 3rem auto 0;
}
.mat-landing-hero {
  text-align: center;
  margin-bottom: 1rem;
}
.mat-landing-title {
  font-size: 1.6rem; font-weight: 700; color: var(--mat-primary);
  margin: 0 0 .4rem;
}
.mat-landing-subtitle {
  font-size: .95rem; color: var(--mat-text-muted);
  margin: 0;
}
.mat-landing-cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.5rem; width: 100%; max-width: 720px;
}
.mat-landing-card {
  background: var(--mat-bg-card);
  border-radius: var(--mat-radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--mat-shadow);
}
.mat-landing-card-title {
  font-size: 1rem; font-weight: 700;
  text-align: center; margin: 0 0 1.25rem;
  color: var(--mat-text);
}
.mat-landing-field { margin-bottom: 1.25rem; }
.mat-landing-field-label {
  display: block; font-size: .9rem; font-weight: 600;
  color: var(--mat-text-secondary); margin-bottom: .4rem;
}
.mat-landing-input {
  width: 100%; padding: .75rem 1rem;
  border: 1.5px solid #e5e7eb; border-radius: var(--mat-radius);
  font-size: 1rem; font-family: var(--mat-font);
  background: var(--mat-bg-input); color: var(--mat-text);
  outline: none; transition: box-shadow .2s;
}
.mat-landing-input:focus {
  box-shadow: 0 0 0 2px var(--mat-accent);
}
.mat-landing-input--code {
  text-align: center; font-size: 1.05rem;
  letter-spacing: .02em;
}
.mat-landing-btn {
  display: block;
  width: 100%; padding: .75rem 2rem; border: none; min-height: 44px;
  border-radius: var(--mat-radius);
  font-size: 1rem; font-weight: 600; font-family: var(--mat-font);
  text-align: center;
  background: var(--mat-accent); color: #fff;
  cursor: pointer;
  transition: background .2s, transform .15s;
  margin-top: .5rem;
}
.mat-landing-btn:hover { background: #2563EB; transform: translateY(-1px); color: #fff; }
.mat-landing-btn:active { transform: translateY(0); }
.mat-landing-help {
  margin-top: 1.5rem; font-size: .85rem; text-align: center;
  color: var(--mat-text-muted);
}
.mat-landing-footer {
  border-top: 1px solid var(--mat-border);
  margin-top: 3rem; padding: 1.25rem 1.5rem;
  text-align: center; font-size: .78rem; color: var(--mat-text-muted);
}
.mat-landing-footer > a,
.mat-landing-footer > span { display: block; margin: .15rem 0; }
.mat-landing-footer a { color: var(--mat-text-muted); text-decoration: none; }
.mat-landing-footer a:hover { color: var(--mat-accent); }

@media (max-width: 640px) {
  .mat-landing-cards { grid-template-columns: 1fr; max-width: 400px; }
  .mat-landing-card { padding: 1.5rem 1.25rem; }
  .mat-landing { padding: 2.5rem 1rem 2rem; }
  .mat-landing-nav-title { display: none; }
}

/* ── Scroll Progress ─────────────────────────────────────────── */
#scrollProgress {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 9999;
  background: var(--mat-accent);
  width: 0%; pointer-events: none;
}

/* ── Header (like Lernspiegel/ueben) ─────────────────────────── */
.mat-header {
  background: var(--mat-primary);
  color: #fff;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 100;
}
.mat-header-logo {
  font-size: 1.1rem; font-weight: 700;
  color: #fff; text-decoration: none;
  white-space: nowrap;
}
.mat-header-logo:hover { color: #fff; }
.mat-header-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: .95rem; font-weight: 600;
  color: rgba(255,255,255,.85);
  white-space: nowrap; pointer-events: none;
}
.mat-header-right {
  display: flex; align-items: center; gap: .75rem;
}
.mat-header-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.25); color: #fff;
  font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.mat-header-name {
  font-size: .9rem; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-header-chips {
  display: flex; gap: .5rem; align-items: center;
}
.mat-header-chip {
  font-size: .85rem; font-family: var(--mat-font);
  background: rgba(255,255,255,.18); color: rgba(255,255,255,.85);
  border-radius: 999px; padding: .25rem .75rem;
  white-space: nowrap; text-decoration: none; border: none;
  transition: background .15s; cursor: pointer;
  line-height: 1.6;
}
.mat-header-chip:hover { background: rgba(255,255,255,.3); color: #fff; }
.mat-header-chip.active { background: rgba(255,255,255,.3); color: #fff; }
.mat-header-chip--link { cursor: pointer; }
.mat-header-chip--link:hover { background: rgba(255,255,255,.3); color: #fff; }
.mat-header-logout {
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7); padding: .4rem;
  border-radius: 8px; transition: background .15s, color .15s;
  text-decoration: none; flex-shrink: 0;
  background: none; border: none; cursor: pointer;
}
.mat-header-logout:hover { background: rgba(255,255,255,.12); color: #fff; }
.mat-header-class-select {
  font-size: .8rem; font-family: var(--mat-font); font-weight: 600;
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  padding: .25rem .6rem; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='white'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center;
  padding-right: 1.5rem;
}
.mat-header-class-select option { color: #111; background: #fff; }

.mat-header-toggle {
  display: none; background: none; border: none;
  cursor: pointer; color: rgba(255,255,255,.7); padding: .3rem;
}

/* ── Header dropdown (Pinnwand) ──────────────────────────────── */
.mat-header-dropdown { position: relative; }
.mat-header-dropdown-menu {
  display: none; position: absolute; top: calc(100% + .5rem); right: 0;
  background: var(--mat-bg-card); border-radius: var(--mat-radius);
  box-shadow: var(--mat-shadow-lg); min-width: 280px; max-width: 360px;
  z-index: 200; overflow: hidden;
}
.mat-header-dropdown.open .mat-header-dropdown-menu { display: block; }
.mat-header-dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .6rem .85rem;
  border-bottom: 1px solid var(--mat-border);
}
.mat-header-dropdown-item:last-child { border-bottom: none; }
.mat-header-dropdown-item:hover { background: var(--mat-bg-hover); }
.mat-header-dropdown-name {
  font-size: .82rem; font-weight: 500; color: var(--mat-text);
  flex: 1; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; cursor: pointer;
}
a.mat-header-dropdown-name:hover { color: var(--mat-accent); }
.mat-header-dropdown-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.mat-header-dropdown-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--mat-radius-sm);
  border: none; background: var(--mat-bg-hover);
  font-size: .8rem; cursor: pointer; text-decoration: none;
  transition: background var(--mat-transition);
}
.mat-header-dropdown-btn:hover { background: var(--mat-accent-light); }

/* ── Main content ────────────────────────────────────────────── */
.mat-main {
  max-width: 960px; margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  min-height: 60vh;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.mat-hero {
  text-align: center;
  padding: 2rem 1rem 2rem;
}
.mat-hero h1 {
  font-size: 1.8rem; font-weight: 800; margin: 0 0 .4rem;
  color: var(--mat-text);
}
.mat-hero p {
  font-size: .95rem; color: var(--mat-text-muted);
  max-width: 560px; margin: 0 auto; line-height: 1.65;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.mat-tabs {
  display: flex; gap: .35rem; overflow-x: auto;
  margin-bottom: 1.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mat-tabs::-webkit-scrollbar { display: none; }
.mat-tab {
  padding: .55rem 1.1rem; border: none;
  background: var(--mat-bg-card); border-radius: var(--mat-radius);
  font-size: .82rem; font-weight: 600; font-family: var(--mat-font);
  color: var(--mat-text-muted); cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--mat-shadow-sm);
  transition: color var(--mat-transition), background var(--mat-transition), box-shadow var(--mat-transition);
}
.mat-tab:hover { color: var(--mat-text); box-shadow: var(--mat-shadow); }
.mat-tab.active {
  background: var(--tab-color, var(--mat-accent)); color: var(--tab-text, #fff);
  box-shadow: var(--mat-shadow);
}
/* Kategoriefarbe: Icon inaktiver Tabs tönen, aktiver Tab nach Kontrast */
.mat-tab .cat-icon { color: var(--tab-color, currentColor); }
.mat-tab.active .cat-icon { color: var(--tab-text, #fff); }
.mat-tab-content { display: none; }
.mat-tab-content.active { display: block; }

@media (max-width: 640px) {
  .mat-tab { padding: .5rem .75rem; font-size: .78rem; }
}

/* ── QR landing choices ──────────────────────────────────────── */
.mat-qr-choices {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.25rem; width: 100%; max-width: 500px;
}
.mat-qr-choice {
  background: var(--mat-bg-card); border-radius: var(--mat-radius-lg);
  padding: 2rem 1.5rem; text-align: center; text-decoration: none;
  box-shadow: var(--mat-shadow-sm);
  transition: box-shadow var(--mat-transition), transform var(--mat-transition);
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.mat-qr-choice:hover {
  box-shadow: var(--mat-shadow-lg); transform: translateY(-3px);
}
.mat-qr-choice-icon { font-size: 2.5rem; }
.mat-qr-choice-label {
  font-size: 1.1rem; font-weight: 700; color: var(--mat-text);
}
.mat-qr-choice-desc {
  font-size: .78rem; color: var(--mat-text-muted); line-height: 1.4;
}
@media (max-width: 400px) {
  .mat-qr-choices { grid-template-columns: 1fr; max-width: 280px; }
  .mat-qr-choice { padding: 1.5rem 1rem; }
}

/* ── Search form ─────────────────────────────────────────────── */
.mat-search-form {
  display: flex; gap: .5rem; max-width: 480px; margin: 0 auto;
}
.mat-search-input {
  flex: 1; padding: .65rem 1rem;
  border: none; border-radius: var(--mat-radius);
  font-size: .88rem; font-family: var(--mat-font);
  background: var(--mat-bg-card); color: var(--mat-text);
  outline: none; box-shadow: var(--mat-shadow-sm);
  transition: box-shadow var(--mat-transition);
}
.mat-search-input:focus { box-shadow: 0 0 0 2px var(--mat-accent); }
.mat-search-btn {
  padding: .65rem 1.2rem; border: none; border-radius: var(--mat-radius);
  font-size: .85rem; font-weight: 600; font-family: var(--mat-font);
  background: var(--mat-accent); color: #fff; cursor: pointer;
  transition: background var(--mat-transition);
  white-space: nowrap;
}
.mat-search-btn:hover { background: #2563EB; }

/* ── Category Cards ──────────────────────────────────────────── */
.mat-categories {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.mat-category-card {
  background: var(--mat-bg-card);
  border: none;
  border-radius: var(--mat-radius-lg);
  padding: 1.25rem;
  text-decoration: none; color: inherit;
  transition: box-shadow var(--mat-transition), transform var(--mat-transition);
  box-shadow: var(--mat-shadow-sm);
  display: flex; flex-direction: column; gap: .5rem;
}
.mat-category-card:hover {
  box-shadow: var(--mat-shadow);
  transform: translateY(-2px);
  color: inherit;
}
.mat-category-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.mat-category-card h3 {
  font-size: .93rem; font-weight: 700; margin: 0;
}
.mat-category-card p {
  font-size: .8rem; color: var(--mat-text-muted); margin: 0;
  line-height: 1.55;
}
.mat-category-count {
  font-size: .72rem; font-weight: 600; color: var(--mat-accent);
  margin-top: auto; padding-top: .25rem;
}

/* ── Accordion folders ───────────────────────────────────────── */
.mat-folder { margin-bottom: .25rem; }
.mat-folder-header {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem .5rem;
  background: none; border: none; width: 100%;
  cursor: pointer; font-family: var(--mat-font);
  font-size: .88rem; font-weight: 500; color: var(--mat-text);
  border-bottom: 1px solid var(--mat-border);
  transition: color var(--mat-transition);
  text-align: left;
}
.mat-folder-header:hover { color: var(--mat-accent); }
.mat-folder-icon-wrap { font-size: 1.3rem; line-height: 1; flex-shrink: 0; color: #EAB308; }
/* Ordner gefüllt gelb (wie das frühere Emoji) */
.mat-folder-icon-wrap .ui-icon { fill: #EAB308; }
.mat-folder-icon-open { display: none; }
.mat-folder.open .mat-folder-icon-closed { display: none; }
.mat-folder.open .mat-folder-icon-open { display: inline; }
.mat-folder-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-folder-arrow {
  font-size: 1.1rem; font-weight: 700; color: var(--mat-text-muted);
  transition: transform 300ms ease; flex-shrink: 0;
}
.mat-folder.open .mat-folder-arrow { transform: rotate(90deg); }
.mat-folder-content {
  max-height: 0; overflow: hidden;
  transition: max-height 300ms ease;
  padding-left: .5rem;
}
/* Ordner-Kopfzeile mit Aktions-Button (Admin) */
.mat-folder-bar { display: flex; align-items: center; border-bottom: 1px solid var(--mat-border); }
.mat-folder-bar > .mat-folder-header { flex: 1; min-width: 0; border-bottom: none; }
.mat-folder-add {
  display: inline-flex; align-items: center; gap: .3rem; flex-shrink: 0;
  margin-right: .5rem; padding: .28rem .6rem;
  font-size: .76rem; font-weight: 600; font-family: var(--mat-font);
  color: var(--mat-accent); text-decoration: none; white-space: nowrap;
  background: var(--mat-bg-card); border: 1px solid var(--mat-border);
  border-radius: var(--mat-radius-sm);
  transition: background .15s, color .15s, border-color .15s;
}
.mat-folder-add:hover { background: var(--mat-accent); color: #fff; border-color: var(--mat-accent); }
.mat-folder-add .ui-icon { width: 14px; height: 14px; }

/* ── Material List ───────────────────────────────────────────── */
.mat-list { display: flex; flex-direction: column; gap: .5rem; }

.mat-item {
  background: var(--mat-bg-card);
  border: none;
  border-radius: var(--mat-radius);
  padding: .9rem 1.15rem;
  display: flex; align-items: center; gap: 1rem;
  transition: box-shadow var(--mat-transition);
  text-decoration: none; color: inherit;
  box-shadow: var(--mat-shadow-sm);
}
.mat-item:hover {
  box-shadow: var(--mat-shadow);
  color: inherit;
}
.mat-item-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: .9rem;
}
.mat-item-icon-svg { width: 21px; height: 21px; display: block; }

/* Typ-Icon in Admin-Listen (SVG, ohne farbige Kachel) */
.mat-type-icon { display: inline-flex; align-items: center; flex-shrink: 0; }
.mat-type-icon .mat-item-icon-svg { width: 19px; height: 19px; }
.mat-type-icon--link  { color: #3B82F6; }
.mat-type-icon--file  { color: #059669; }
.mat-type-icon--text  { color: #D97706; }
.mat-type-icon--embed { color: #7C3AED; }

/* Generische UI-Icons (Ordner, Buttons, Badges) */
.ui-icon {
  width: 1em; height: 1em; vertical-align: -0.125em;
  display: inline-block; flex-shrink: 0;
}
.mat-item-btn .ui-icon { width: 17px; height: 17px; }
.mat-badge .ui-icon { width: 13px; height: 13px; vertical-align: -0.15em; }

/* Kategorie-Icons (inline neben Text) */
.cat-icon {
  width: 1.05em; height: 1.05em; vertical-align: -0.16em;
  display: inline-block; flex-shrink: 0;
}
.cat-icon-emoji { display: inline-block; }

/* Icon-Auswahl im Kategorie-Formular */
.cat-icon-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: .4rem; margin-top: .1rem;
}
.cat-icon-opt { position: relative; }
.cat-icon-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.cat-icon-picker .cat-icon-opt label {
  display: flex; align-items: center; justify-content: center;
  height: 46px; margin: 0; border: 1px solid var(--mat-border); border-radius: var(--mat-radius);
  background: var(--mat-bg-input); cursor: pointer; color: var(--mat-text-secondary);
  font-size: 1rem; font-weight: 400;
  transition: border-color var(--mat-transition), background var(--mat-transition);
}
.cat-icon-opt label .cat-icon { width: 22px; height: 22px; vertical-align: 0; }
.cat-icon-opt label .cat-icon-none { font-size: .7rem; color: var(--mat-text-muted); }
.cat-icon-opt input:hover + label { border-color: var(--mat-accent); }
.cat-icon-opt input:checked + label {
  border-color: var(--mat-accent); background: var(--mat-accent-light);
  color: var(--mat-accent); box-shadow: 0 0 0 1px var(--mat-accent);
}
.mat-item-icon--link { background: #DBEAFE; color: #3B82F6; }
.mat-item-icon--file { background: #D1FAE5; color: #059669; }
.mat-item-icon--text { background: #FEF3C7; color: #D97706; }
.mat-item-icon--embed { background: #EDE9FE; color: #7C3AED; }
.mat-item-icon--locked { background: #F1F5F9; color: #94A3B8; }

.mat-item-body { flex: 1; min-width: 0; }
.mat-item-meta { font-size: .72rem; color: var(--mat-text-muted); margin: .15rem 0 0; }
.mat-item-title {
  font-size: .88rem; font-weight: 600; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-item-desc {
  font-size: .76rem; color: var(--mat-text-muted); margin: .15rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mat-item-badge {
  font-size: .68rem; font-weight: 600; padding: .15rem .5rem;
  border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 180px;
}
.mat-item-badge--public { background: #D1FAE5; color: #065F46; }
.mat-item-badge--locked { background: #FEF3C7; color: #92400E; }

/* ── List item wrapper (card with link + actions) ────────── */
.mat-list-item {
  background: var(--mat-bg-card);
  border-radius: var(--mat-radius);
  padding: .9rem 1.15rem;
  display: flex; align-items: center; gap: .75rem;
  box-shadow: var(--mat-shadow-sm);
  transition: box-shadow var(--mat-transition);
}
.mat-list-item:hover { box-shadow: var(--mat-shadow); }

.mat-item-link {
  display: flex; align-items: center; gap: 1rem;
  flex: 1; min-width: 0;
  cursor: pointer; color: inherit;
}

.mat-item-actions {
  display: flex; gap: .35rem; flex-shrink: 0;
}
.mat-item-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--mat-radius-sm);
  border: none; background: var(--mat-bg-hover);
  font-size: .9rem; cursor: pointer; text-decoration: none;
  transition: background var(--mat-transition);
}
.mat-item-btn:hover {
  background: var(--mat-accent-light);
}

.mat-overlay-content { flex: 1; display: flex; min-height: 0; }

@media (max-width: 640px) {
  .mat-list-item { gap: .5rem; padding: .75rem .9rem; }
  .mat-item-actions { gap: .25rem; }
  .mat-item-btn { width: 32px; height: 32px; font-size: .85rem; }
  .mat-item-badge { max-width: 120px; }
}

/* ── Material detail ─────────────────────────────────────────── */
.mat-detail {
  background: var(--mat-bg-card);
  border: none;
  border-radius: var(--mat-radius-lg);
  padding: 2rem;
  box-shadow: var(--mat-shadow-sm);
}
.mat-detail h1 {
  font-size: 1.4rem; font-weight: 800; margin: 0 0 .5rem;
}
.mat-detail-desc {
  font-size: .9rem; color: var(--mat-text-secondary); margin: 0 0 1.5rem;
  line-height: 1.7;
}
.mat-detail-content {
  font-size: .9rem; line-height: 1.7;
}
.mat-detail-content img { max-width: 100%; height: auto; border-radius: var(--mat-radius); }

.mat-detail-action {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.2rem; border-radius: var(--mat-radius);
  font-size: .9rem; font-weight: 600;
  background: var(--mat-accent); color: #fff;
  transition: background var(--mat-transition);
  margin-top: 1rem;
}
.mat-detail-action:hover { background: #2563EB; color: #fff; }

.mat-detail-action--preview {
  background: var(--mat-bg-card); color: var(--mat-text-secondary);
  border: 1px solid var(--mat-border); cursor: pointer;
  font-family: var(--mat-font); margin-top: 0;
}
.mat-detail-action--preview:hover {
  border-color: var(--mat-accent); color: var(--mat-accent);
  background: var(--mat-bg-card);
}

/* ── Preview overlay ─────────────────────────────────────────── */
.mat-overlay {
  display: none; position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  padding: 1.5rem;
  justify-content: center; align-items: center;
}
.mat-overlay.open { display: flex; }

.mat-overlay-inner {
  background: var(--mat-bg-card);
  border-radius: var(--mat-radius-lg);
  width: auto; max-width: 95vw; height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
  overflow: hidden;
}
.mat-overlay.mat-overlay--pdf .mat-overlay-inner {
  width: 95vw; max-width: 1100px;
}
.mat-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--mat-border);
  flex-shrink: 0;
}
.mat-overlay-title {
  font-size: .9rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-overlay-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: var(--mat-text-muted);
  padding: .5rem; min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s;
}
.mat-overlay-close:hover { color: var(--mat-text); }

.mat-overlay-frame { flex: 1; width: 100%; border: none; }
.mat-overlay-html-wrap {
  flex: 1; overflow: auto; background: var(--mat-bg-card);
}
.mat-overlay-html-wrap img { max-width: 100%; height: auto; }
.mat-overlay-html-wrap iframe { width: 100%; min-height: 400px; border: none; }
.mat-overlay-img-wrap {
  flex: 1; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: var(--mat-bg);
}
.mat-overlay-img {
  max-width: 100%; max-height: 85vh; object-fit: contain;
  border-radius: var(--mat-radius);
}
/* Audio: kompakte Box statt Vollhöhe */
.mat-overlay.mat-overlay--audio .mat-overlay-inner {
  width: 95vw; max-width: 560px; height: auto;
}
.mat-overlay-audio-wrap {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
  padding: 2rem 1.5rem; background: var(--mat-bg);
}
.mat-overlay-audio-icon { color: var(--mat-accent); line-height: 0; }
.mat-overlay-audio-icon svg { width: 56px; height: 56px; }
.mat-overlay-audio { width: 100%; }
/* Video: breite Box, Höhe richtet sich nach dem Video */
.mat-overlay.mat-overlay--video .mat-overlay-inner {
  width: 95vw; max-width: 1100px; height: auto;
}
.mat-overlay-video-wrap {
  flex: 1;
  display: flex; justify-content: center; background: #000;
}
.mat-overlay-video {
  display: block; width: 100%;
  max-height: calc(90vh - 70px); /* 70px ≈ Kopfzeile des Overlays */
}
.mat-overlay-media-error {
  width: 100%; margin: 0; padding: 1.5rem; text-align: center;
  font-size: .9rem; color: var(--mat-text-secondary); background: var(--mat-bg);
}

@media (max-width: 640px) {
  .mat-overlay { padding: 0; }
  .mat-overlay-inner { border-radius: 0; height: 100vh; max-width: 100%; }
  .mat-overlay.mat-overlay--audio { padding: 1rem; }
  .mat-overlay.mat-overlay--audio .mat-overlay-inner { border-radius: var(--mat-radius-lg); }
  .mat-overlay.mat-overlay--video .mat-overlay-inner { width: 100%; }
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.mat-breadcrumb {
  display: flex; align-items: center; gap: .3rem;
  font-size: .8rem; color: var(--mat-text-muted);
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.mat-breadcrumb a { color: var(--mat-text-secondary); }
.mat-breadcrumb a:hover { color: var(--mat-accent); }
.mat-breadcrumb-sep { color: var(--mat-border); }

/* ── Section title ───────────────────────────────────────────── */
.mat-section-title {
  font-size: 1.1rem; font-weight: 700; margin: 2rem 0 1rem;
  display: flex; align-items: center; gap: .5rem;
}

/* ── Login form (admin) ──────────────────────────────────────── */
.mat-login-box {
  max-width: 420px; margin: 2rem auto;
  background: var(--mat-bg-card);
  border: none;
  border-radius: var(--mat-radius-lg);
  padding: 2rem;
  box-shadow: var(--mat-shadow);
}
.mat-login-box h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 .3rem; text-align: center; }
.mat-login-box p { font-size: .85rem; color: var(--mat-text-muted); text-align: center; margin: 0 0 1.5rem; }

.mat-form-group { margin-bottom: 1rem; }
.mat-form-group label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--mat-text-secondary); margin-bottom: .35rem;
}
.mat-form-input {
  width: 100%; padding: .6rem .85rem;
  border: none; border-radius: var(--mat-radius);
  font-size: .9rem; font-family: var(--mat-font);
  background: var(--mat-bg-input); color: var(--mat-text);
  outline: none; transition: box-shadow var(--mat-transition);
}
.mat-form-input:focus { box-shadow: 0 0 0 2px var(--mat-accent); }
select.mat-form-input { border: 1px solid var(--mat-border); background: var(--mat-bg-card); }
select.mat-form-input:focus { border-color: var(--mat-accent); }

.mat-form-submit {
  width: 100%; padding: .7rem;
  background: var(--mat-accent); color: #fff;
  border: none; border-radius: var(--mat-radius);
  font-size: .9rem; font-weight: 600; font-family: var(--mat-font);
  cursor: pointer; transition: background var(--mat-transition);
}
.mat-form-submit:hover { background: #2563EB; }

/* ── Flash messages ──────────────────────────────────────────── */
.mat-flash {
  padding: .7rem 1rem; border-radius: var(--mat-radius);
  font-size: .85rem; font-weight: 500; margin-bottom: 1rem;
}
.mat-flash--error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.mat-flash--success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

/* ── Empty state ─────────────────────────────────────────────── */
.mat-empty {
  text-align: center; padding: 3rem 1rem;
  color: var(--mat-text-muted); font-size: .9rem;
}
.mat-empty-icon {
  font-size: 2.5rem; margin-bottom: .75rem; opacity: .5;
}

/* ── Footer ──────────────────────────────────────────────────── */
.mat-footer {
  border-top: 1px solid var(--mat-border);
  margin-top: 3rem; padding: 1.25rem 1.5rem;
  text-align: center; font-size: .78rem; color: var(--mat-text-muted);
}
.mat-footer > a,
.mat-footer > span { display: block; margin: .15rem 0; }
.mat-footer a { color: var(--mat-text-muted); text-decoration: none; }
.mat-footer a:hover { color: var(--mat-accent); }
.mat-footer-sep { color: var(--mat-border); }

/* ── Form label ──────────────────────────────────────────────── */
.mat-form-label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--mat-text-secondary); margin-bottom: .35rem;
}

/* ── Admin area ──────────────────────────────────────────────── */
.mat-admin-body .mat-header {
  background: var(--mat-primary-dark);
  gap: 1rem;
}
/* Zentrierter "Admin"-Titel überlappt sonst die vielen Chips – im Adminbereich ausblenden */
.mat-admin-body .mat-header-title { display: none; }
.mat-admin-body .mat-header-right {
  gap: .4rem;
  justify-content: flex-end;
  min-width: 0;
}
.mat-admin-body .mat-header-chip {
  font-size: .8rem; padding: .22rem .6rem;
}

.mat-admin-card {
  background: var(--mat-bg-card);
  border: none;
  border-radius: var(--mat-radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--mat-shadow-sm);
  margin-bottom: 1rem;
}
.mat-admin-card-title {
  font-size: .95rem; font-weight: 700; margin: 0 0 1rem;
  padding-bottom: .75rem; border-bottom: 1px solid var(--mat-border);
}
.mat-admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-bottom: .5rem;
}
.mat-form-group--full { grid-column: 1 / -1; }

/* Erweiterte Optionen (Datei-Formular & Bulk-Upload) */
.mat-advanced-options {
  padding: 0;
  margin: 1.25rem 0;
}
.mat-advanced-options-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--mat-text-muted);
  margin: 0 0 1rem; padding-bottom: .6rem;
  border-bottom: 1px solid var(--mat-border);
}

.mat-admin-table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
.mat-admin-table th {
  text-align: left; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--mat-text-muted); padding: .5rem .75rem;
  border-bottom: 1.5px solid var(--mat-border);
}
.mat-admin-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--mat-border);
  vertical-align: middle;
}
.mat-admin-table tr:last-child td { border-bottom: none; }
.mat-admin-table tr:hover td { background: var(--mat-bg-hover); }

.mat-btn-admin {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem 1rem; border-radius: 10px;
  font-family: var(--mat-font); font-size: .82rem; font-weight: 600; line-height: 1.2;
  background: var(--mat-accent); color: #fff;
  border: none;
  cursor: pointer; text-decoration: none;
  transition: background var(--mat-transition), box-shadow var(--mat-transition), transform var(--mat-transition);
}
.mat-btn-admin:hover { background: #2563EB; color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.mat-btn-admin:active { transform: translateY(1px); }

.mat-btn-admin--ghost {
  background: transparent; color: var(--mat-text-secondary);
  border: 1px solid var(--mat-border);
}
.mat-btn-admin--ghost:hover { border-color: var(--mat-accent); color: var(--mat-accent); background: transparent; }

.mat-btn-admin--small {
  padding: .45rem .85rem; font-size: .8rem; min-height: 34px;
}
/* Destruktive Aktion: dezent getönt, erst beim Hover kräftig rot */
.mat-btn-admin--danger {
  background: rgba(239,68,68,.10); color: #DC2626;
  border: 1px solid rgba(239,68,68,.30);
}
.mat-btn-admin--danger:hover {
  background: #EF4444; color: #fff; border-color: #EF4444;
  box-shadow: 0 2px 8px rgba(220,38,38,.28);
}

/* Auswahl-Checkboxen in der Materialliste */
input.bulk-cb {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 0; flex-shrink: 0;
  border: 2px solid var(--mat-text-muted); border-radius: 6px;
  background: var(--mat-bg-card); cursor: pointer;
  display: inline-grid; place-content: center;
  transition: background var(--mat-transition), border-color var(--mat-transition);
}
input.bulk-cb::before {
  content: ""; width: 10px; height: 10px; transform: scale(0);
  transition: transform .12s ease-in-out; background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input.bulk-cb:hover { border-color: var(--mat-accent); }
input.bulk-cb:checked { background: var(--mat-accent); border-color: var(--mat-accent); }
input.bulk-cb:checked::before { transform: scale(1); }
input.bulk-cb:focus-visible { outline: 2px solid var(--mat-accent); outline-offset: 2px; }

/* Suche in der Materialliste */
.mat-search { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.mat-search-field { position: relative; flex: 1 1 16rem; min-width: 14rem; display: flex; align-items: center; }
.mat-search-icon {
  position: absolute; left: .85rem; display: flex; align-items: center;
  color: var(--mat-text-muted); pointer-events: none;
}
.mat-search-icon .ui-icon { width: 18px; height: 18px; }
.mat-search-input {
  width: 100%; font-family: var(--mat-font); font-size: .92rem; color: var(--mat-text);
  padding: .6rem 1rem .6rem 2.5rem; border: 1px solid var(--mat-border);
  border-radius: 999px; background: var(--mat-bg-card);
  transition: border-color var(--mat-transition), box-shadow var(--mat-transition);
}
.mat-search-input::placeholder { color: var(--mat-text-muted); }
.mat-search-input:focus { outline: none; border-color: var(--mat-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.mat-search-select {
  font-family: var(--mat-font); font-size: .88rem; color: var(--mat-text);
  padding: .55rem 1.1rem; border: 1px solid var(--mat-border); border-radius: 999px;
  background: var(--mat-bg-card); cursor: pointer;
  transition: border-color var(--mat-transition), box-shadow var(--mat-transition);
}
.mat-search-select:focus { outline: none; border-color: var(--mat-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.mat-filter-chip {
  display: inline-block;
  padding: .25rem .65rem; border-radius: 20px;
  font-size: .78rem; font-weight: 600;
  background: var(--mat-bg-card); color: var(--mat-text-secondary);
  border: 1px solid var(--mat-border);
  text-decoration: none;
  transition: all var(--mat-transition);
}
.mat-filter-chip:hover { border-color: var(--mat-accent); color: var(--mat-accent); }
.mat-filter-chip.active { background: var(--mat-accent); color: #fff; border-color: var(--mat-accent); }

/* ── Load more button ────────────────────────────────────────── */
.mat-btn-loadmore {
  display: inline-block; padding: .5rem 1.5rem;
  border: 1px solid var(--mat-border); border-radius: 999px;
  background: var(--mat-bg-card); color: var(--mat-text-secondary);
  font-size: .82rem; font-weight: 600; font-family: var(--mat-font);
  cursor: pointer; transition: all var(--mat-transition);
}
.mat-btn-loadmore:hover {
  border-color: var(--mat-accent); color: var(--mat-accent);
  background: var(--mat-primary-xlight);
}

/* ── Bulk action bar ─────────────────────────────────────────── */
.mat-bulk-bar {
  display: flex; align-items: center; gap: .75rem;
  background: var(--mat-accent-light); border-radius: var(--mat-radius);
  padding: .5rem 1rem; margin-bottom: .75rem;
}

/* ── Drag & Drop ────────────────────────────────────────────── */
.mat-drag-handle {
  cursor: grab; color: var(--mat-text-muted); font-size: 1.1rem;
  user-select: none; text-align: center;
}
.mat-drag-handle:active { cursor: grabbing; }
.mat-dragging { opacity: .4; }
.mat-drag-over td { background: var(--mat-primary-xlight) !important; }
.mat-sortable-table tr[draggable="true"] { transition: opacity .15s; }

/* ── Bulk upload ────────────────────────────────────────────── */
.mat-bulk-dropzone {
  border: 2px dashed var(--mat-border); border-radius: var(--mat-radius-lg);
  padding: 2rem; text-align: center; cursor: pointer;
  transition: border-color var(--mat-transition), background var(--mat-transition);
  color: var(--mat-text-muted); font-size: .85rem;
}
.mat-bulk-dropzone:hover,
.mat-bulk-dropzone.dragover {
  border-color: var(--mat-accent); background: var(--mat-primary-xlight);
  color: var(--mat-text-secondary);
}
.mat-bulk-dropzone-icon { font-size: 2rem; margin-bottom: .5rem; opacity: .5; }
.mat-bulk-file-list { margin-top: 1rem; text-align: left; }
.mat-bulk-file-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .5rem; font-size: .82rem;
  border-bottom: 1px solid var(--mat-border);
}
.mat-bulk-file-item:last-child { border-bottom: none; }
.mat-bulk-file-remove {
  background: none; border: none; cursor: pointer;
  color: var(--mat-text-muted); font-size: .9rem;
}
.mat-bulk-file-remove:hover { color: #EF4444; }

/* ── Student selector ───────────────────────────────────────── */
.mat-student-select { position: relative; }
.mat-student-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem .85rem; border: none;
  border-radius: var(--mat-radius); background: var(--mat-bg-input);
  font-size: .85rem; cursor: pointer;
  transition: box-shadow var(--mat-transition);
}
.mat-student-toggle:hover { box-shadow: 0 0 0 2px var(--mat-accent); }
.mat-student-list {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--mat-bg-card); border: 1px solid var(--mat-border);
  border-radius: var(--mat-radius); box-shadow: var(--mat-shadow);
  max-height: 200px; overflow-y: auto; z-index: 10; margin-top: .25rem;
}
.mat-student-list.open { display: block; }
.mat-student-option {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; font-size: .82rem; cursor: pointer;
  transition: background .1s;
}
.mat-student-option:hover { background: var(--mat-bg-hover); }

.mat-badge {
  font-size: .72rem; font-weight: 600; padding: .15rem .45rem;
  border-radius: 4px; white-space: nowrap;
}
.mat-badge--public { background: #D1FAE5; color: #065F46; }
.mat-badge--locked { background: #FEF3C7; color: #92400E; }
.mat-badge--draft { background: #F3F4F6; color: #6B7280; }
.mat-badge--scheduled { background: #EDE9FE; color: #5B21B6; }
.mat-badge--students { background: #DBEAFE; color: #1E40AF; margin-left: .2rem; }

/* ── Responsive ──────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 768px) {
  .mat-hero { padding: 2rem .75rem 1.5rem; }
  .mat-hero h1 { font-size: 1.5rem; }
  .mat-overlay-inner { height: 95vh; }
  .mat-detail { padding: 1.5rem; }
}

/* Mobile */
@media (max-width: 640px) {
  /* Header */
  .mat-header-title { display: none; }
  .mat-header-right { display: none; }
  .mat-header-right.open {
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: center;
    position: absolute; top: 60px; left: 0; right: 0;
    background: var(--mat-primary); border-bottom: 1px solid rgba(255,255,255,.1);
    padding: 1rem 1.5rem; gap: .75rem; box-shadow: var(--mat-shadow);
    z-index: 99;
  }
  .mat-header-toggle { display: block; }
  .mat-header-dropdown-menu {
    position: fixed; top: auto; right: 1rem; left: 1rem;
    min-width: auto; max-width: none;
  }

  /* Hero + Search */
  .mat-hero { padding: 1.5rem .5rem 1.25rem; }
  .mat-hero h1 { font-size: 1.3rem; }
  .mat-hero p { font-size: .88rem; }
  .mat-search-form { max-width: 100%; }

  /* Content */
  .mat-main { padding: 1rem 1rem 3rem; }
  .mat-categories { grid-template-columns: 1fr; }
  .mat-detail { padding: 1rem; }
  .mat-detail h1 { font-size: 1.15rem; }

  /* Tabs */
  .mat-tab { padding: .45rem .85rem; font-size: .78rem; }

  /* List items */
  .mat-list-item { padding: .75rem .9rem; gap: .5rem; }
  .mat-item-link { gap: .65rem; }
  .mat-item-badge { max-width: 120px; }
  .mat-item-actions { gap: .25rem; }
  .mat-item-btn { width: 32px; height: 32px; font-size: .85rem; }

  /* Folders */
  .mat-folder-header { padding: .55rem .25rem; font-size: .84rem; }

  /* Overlay */
  .mat-overlay { padding: 0; }
  .mat-overlay-inner { border-radius: 0; height: 100vh; max-width: 100%; }
  .mat-overlay-header { padding: .5rem 1rem; }
  .mat-overlay-title { font-size: .82rem; }
  .mat-overlay-close { font-size: 2rem; }

  /* Admin */
  /* !important, damit auch Inline-Overrides (z.B. 1fr 2fr 1fr) mobil einspaltig werden */
  .mat-admin-grid { grid-template-columns: 1fr !important; }
  .mat-admin-card { padding: 1rem; }
  .mat-admin-table { font-size: .75rem; }
  .mat-admin-table th { padding: .4rem .5rem; }
  .mat-admin-table td { padding: .4rem .5rem; }

  /* Footer */
  .mat-footer { padding: 1rem; font-size: .72rem; }

  /* Landing */
  .mat-landing-cards { grid-template-columns: 1fr; max-width: 400px; gap: 1rem; }
  .mat-landing-card { padding: 1.5rem 1.25rem; }
  .mat-landing { padding: 1.25rem .75rem; }
  .mat-landing-nav { padding: 0 .875rem; }
  .mat-landing-nav-title { display: none; }
}

/* Small phones */
@media (max-width: 400px) {
  .mat-hero h1 { font-size: 1.15rem; }
  .mat-search-form { flex-direction: column; }
  .mat-search-btn { width: 100%; }
  .mat-item-badge { display: none; }
  .mat-list-item { padding: .65rem .75rem; }
  .mat-landing-card { padding: 1.5rem 1.25rem; }
  .mat-login-box { padding: 1.25rem 1rem; }
}
