/* ============================================================
   /new/ Material Design — Base
   ============================================================ */

:root {
  --ink:        #1D2331;
  --paper:      #F4F6FA;
  --paper-2:    #FFFFFF;
  --line:       #E1E5EE;
  --line-2:     #C9CFD9;
  --mute:       #5B6470;

  --accent:     #3F51B5;
  --accent-2:   #5C6BC0;
  --accent-3:   #303F9F;
  --accent-soft:rgba(63, 81, 181, .10);

  --success:    #00897B;
  --warning:    #FB8C00;
  --danger:     #E53935;

  --radius:     12px;
  --radius-sm:  8px;
  --shadow-1:   0 1px 2px rgba(29,35,49,.06), 0 1px 3px rgba(29,35,49,.08);
  --shadow-2:   0 4px 6px -1px rgba(29,35,49,.08), 0 2px 4px -1px rgba(29,35,49,.06);
  --shadow-3:   0 10px 15px -3px rgba(29,35,49,.10), 0 4px 6px -2px rgba(29,35,49,.05);
  --transition: 150ms cubic-bezier(.4,0,.2,1);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; display: flex; flex-direction: column; }

h1, h2, h3, h4 {
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 .5em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.10rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-3); text-decoration: underline; }

/* --------- App-Shell (Header + Main + Footer) --------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}
.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
}
.app-header .brand img { width: 32px; height: 32px; display: block; }
.app-header .spacer { flex: 1; }
.app-header .nav-link {
  color: var(--ink);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.app-header .nav-link:hover { background: var(--accent-soft); text-decoration: none; }

.app-main { flex: 1; padding: 24px 16px 48px; }
.container { max-width: 1080px; margin: 0 auto; }
.container-narrow { max-width: 480px; margin: 0 auto; }

.app-footer {
  padding: 20px 16px 40px;
  color: var(--mute);
  font-size: .85rem;
  text-align: center;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

/* --------- Material Card --------- */

.mat-card {
  background: var(--paper-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 24px;
}
.mat-card + .mat-card { margin-top: 20px; }

/* --------- Form-Feld (Material outlined) --------- */

.mat-field {
  position: relative;
  margin-bottom: 16px;
}
.mat-field label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--mute);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.mat-field .field-help {
  display: block;
  font-size: .75rem;
  color: var(--mute);
  margin-top: 4px;
}
.mat-input,
.mat-field input[type="text"],
.mat-field input[type="email"],
.mat-field input[type="password"],
.mat-field input[type="search"],
.mat-field input[type="number"],
.mat-field input:not([type]),
.mat-field select,
.mat-field textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.mat-input:focus,
.mat-field input:focus,
.mat-field select:focus,
.mat-field textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --------- Buttons --------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: .95rem;
  font-weight: 500;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  font-family: inherit;
  min-height: 44px; /* touch-target */
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-1);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-2); box-shadow: var(--shadow-2); text-decoration: none; color: #fff; }
.btn-primary:active:not(:disabled) { background: var(--accent-3); }

.btn-text {
  background: transparent;
  color: var(--accent);
  padding: 10px 12px;
}
.btn-text:hover:not(:disabled) { background: var(--accent-soft); text-decoration: none; }

.btn-block { display: flex; width: 100%; }

/* --------- Alerts / Toasts --------- */

.mat-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: .95rem;
  border-left: 4px solid var(--line-2);
  background: #F1F3F8;
  color: var(--ink);
}
.mat-alert.success { border-color: var(--success); background: rgba(0,137,123,.08); }
.mat-alert.warning { border-color: var(--warning); background: rgba(251,140,0,.08); }
.mat-alert.danger  { border-color: var(--danger);  background: rgba(229,57,53,.08); }

/* --------- Auth-Layout (Login / Register / Forgot / Reset) --------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(180deg, var(--paper) 0%, #E9EDF5 100%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--paper-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  padding: 32px 28px;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.auth-brand img { width: 56px; height: 56px; }
.auth-brand .tagline { font-size: .85rem; color: var(--mute); }

.auth-alt {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: .9rem;
  color: var(--mute);
}
.auth-alt a { margin-left: 6px; }

/* --------- Responsive Rules ---------
   Mobile-Layout unter 768px OR Tablet-Hochformat (<=1024 UND portrait) */

@media (max-width: 768px), (max-width: 1024px) and (orientation: portrait) {
  h1 { font-size: 1.5rem; }
  .app-main { padding: 16px 12px 40px; }
  .mat-card { padding: 20px 16px; border-radius: var(--radius-sm); }
  .auth-card { padding: 28px 20px; }
  .app-header .nav-link { padding: 8px; }
}

/* --------- Avatar --------- */
.pt-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-weight: 500;
  text-align: center;
  font-family: inherit;
  line-height: 1;
  user-select: none;
  vertical-align: middle;
  flex-shrink: 0;
}
img.pt-avatar {
  object-fit: cover;
  background: var(--line);
}
.pt-avatar-lg   { width: 120px; height: 120px; font-size: 48px; }
.pt-avatar-md   { width:  56px; height:  56px; font-size: 22px; }
.pt-avatar-sm   { width:  32px; height:  32px; font-size: 13px; }
.avatar-upload {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0; margin-bottom: 12px;
}
.avatar-upload input[type=file] { font-size: .9rem; }

/* --------- Utility --------- */

.text-mute   { color: var(--mute); }
.text-center { text-align: center; }
.mt-1 { margin-top:  8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom:  8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* --------- Material-Symbols-Icons (global) --------- */

.msi {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  display: inline-block;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* --------- Header-Nav-Links (Icon + Label) --------- */

.nav-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-icon-link .msi { font-size: 22px; color: var(--accent); }

/* Mobile: nur Icons zeigen, Labels ausblenden */
@media (max-width: 860px) {
  .app-header .nav-link-label { display: none; }
  .app-header { gap: 4px; }
  .app-header .nav-icon-link { padding: 8px; }
}

/* --------- Footer-Links + Rechtsseiten --------- */

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.footer-links a { color: var(--mute); }
.footer-links a:hover { color: var(--accent); }

.legal-text h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--mute);
  margin: 24px 0 6px;
}
.legal-text h1 + h2 { margin-top: 8px; }
.legal-text p { margin: 0 0 12px; }

/* --------- Desktop: 2-Spalten-Raster für Karten-Seiten --------- */

@media (min-width: 769px) and (orientation: landscape), (min-width: 1025px) {
  .grid-2-desktop {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
  }
  .grid-2-desktop > .mat-card { margin-top: 0; }
  .grid-2-desktop > .mat-card + .mat-card { margin-top: 0; }
}
