/**
 * HeroWerk Kundenportal — Styles
 *
 * CI B2 konform: Barlow/Inter, Chartreuse/Schiefer/Sand
 * Dark-Mode Default (wie Website v4)
 * Mobile-first, Responsive
 *
 * @version 1.0.0
 */

/* ============================================================
   CSS Custom Properties — CI-Farben & Typografie
   ============================================================ */
:root {
  /* Farben */
  --hero-green: #B7D900;
  --meister-schiefer: #1C2B36;
  --bernstein: #E8A838;
  --fundament-sand: #F4F1EA;
  --nacht-schwarz: #0A0A0A;
  --charcoal: #2D2D2D;
  --muted: #9A9A9A;
  --white: #FFFFFF;
  --error: #E74C3C;
  --success: #27AE60;

  /* Typografie */
  --font-headline: 'Barlow', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Abstände */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  /* Radien */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Schatten */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);

  /* Übergänge */
  --transition: 0.2s ease;
}

/* ============================================================
   Reset & Basis
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--nacht-schwarz);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--hero-green);
  text-decoration: none;
  transition: opacity var(--transition);
}

a:hover {
  opacity: 0.8;
}

h1, h2, h3, h4 {
  font-family: var(--font-headline);
  font-weight: 800;
  line-height: 1.2;
}

/* ============================================================
   Login-Seite
   ============================================================ */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
  text-align: center;
}

.login-logo {
  width: 200px;
  height: auto;
  margin-bottom: var(--space-xl);
}

.login-card {
  background: var(--charcoal);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.login-card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ============================================================
   Formular-Elemente
   ============================================================ */
.form-input {
  width: 100%;
  padding: 14px var(--space-md);
  background: var(--nacht-schwarz);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--hero-green);
}

.form-input::placeholder {
  color: var(--muted);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px var(--space-lg);
  background: var(--hero-green);
  color: var(--nacht-schwarz);
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(183, 217, 0, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px var(--space-md);
  background: transparent;
  color: var(--hero-green);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid var(--hero-green);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: rgba(183, 217, 0, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* ============================================================
   Dashboard Layout
   ============================================================ */
.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.portal-header {
  background: var(--meister-schiefer);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  height: 36px;
  width: auto;
}

.header-title {
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--white);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.customer-name {
  font-size: 0.875rem;
  color: var(--muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  transition: color var(--transition);
}

.btn-logout:hover {
  color: var(--white);
}

/* Main Content */
.portal-main {
  flex: 1;
  padding: var(--space-lg);
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   Begrüßung
   ============================================================ */
.welcome-section {
  margin-bottom: var(--space-xl);
}

.welcome-section h1 {
  font-size: 1.75rem;
  margin-bottom: var(--space-xs);
}

.welcome-section .subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ============================================================
   Karten (generisch)
   ============================================================ */
.card {
  background: var(--charcoal);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.card-header h2 {
  font-size: 1.2rem;
}

.card-header .card-icon {
  font-size: 1.3rem;
}

/* ============================================================
   Timeline
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 40px;
}

/* Vertikale Linie */
.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.timeline-step {
  position: relative;
  padding-bottom: var(--space-lg);
  padding-left: var(--space-md);
}

.timeline-step:last-child {
  padding-bottom: 0;
}

/* Kreis-Indikator */
.timeline-step .step-dot {
  position: absolute;
  left: -33px;
  top: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 1;
}

/* Zustände */
.timeline-step.done .step-dot {
  background: var(--hero-green);
  color: var(--nacht-schwarz);
}

.timeline-step.active .step-dot {
  background: var(--hero-green);
  color: var(--nacht-schwarz);
  box-shadow: 0 0 0 4px rgba(183, 217, 0, 0.25);
  animation: pulse 2s infinite;
}

.timeline-step.pending .step-dot {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(183, 217, 0, 0.25); }
  50% { box-shadow: 0 0 0 8px rgba(183, 217, 0, 0.1); }
}

.step-label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
}

.timeline-step.done .step-label {
  color: var(--hero-green);
}

.timeline-step.active .step-label {
  color: var(--white);
}

.timeline-step.pending .step-label {
  color: var(--muted);
}

.step-info {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.timeline-step.active .step-info {
  color: rgba(255, 255, 255, 0.8);
}

.step-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ============================================================
   Fördervorschuss-Karte
   ============================================================ */
.fv-card {
  border: 2px solid var(--hero-green);
}

.fv-amount {
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 2rem;
  color: var(--hero-green);
  margin: var(--space-md) 0 var(--space-sm);
}

.fv-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.fv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.fv-row .fv-label {
  color: var(--muted);
}

.fv-row .fv-value {
  font-weight: 600;
}

/* Status-Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(183, 217, 0, 0.15);
  color: var(--hero-green);
}

.badge-amber {
  background: rgba(232, 168, 56, 0.15);
  color: var(--bernstein);
}

.badge-red {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error);
}

/* ============================================================
   Dokumente
   ============================================================ */
.doc-list {
  list-style: none;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background var(--transition);
}

.doc-item:last-child {
  border-bottom: none;
}

.doc-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.doc-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.doc-icon {
  font-size: 1.2rem;
  width: 32px;
  text-align: center;
}

.doc-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.doc-item.pending .doc-name {
  color: var(--muted);
}

.doc-status {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  background: rgba(183, 217, 0, 0.1);
  color: var(--hero-green);
  border: 1px solid rgba(183, 217, 0, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-download:hover {
  background: rgba(183, 217, 0, 0.2);
}

/* ============================================================
   Kontaktbereich
   ============================================================ */
.contact-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-lg);
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--meister-schiefer);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--hero-green);
}

.contact-details {
  flex: 1;
}

.contact-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.contact-role {
  font-size: 0.8rem;
  color: var(--muted);
}

.contact-phone {
  font-size: 0.85rem;
  color: var(--hero-green);
}

.message-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.last-message {
  padding: var(--space-md);
  background: rgba(183, 217, 0, 0.05);
  border-left: 3px solid var(--hero-green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: var(--space-md);
}

.last-message .msg-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

.last-message .msg-text {
  font-size: 0.9rem;
}

/* ============================================================
   Termine
   ============================================================ */
.appointment-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.appointment-item:last-child {
  border-bottom: none;
}

.appointment-date {
  text-align: center;
  min-width: 56px;
}

.appointment-date .day {
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--hero-green);
  line-height: 1;
}

.appointment-date .month {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}

.appointment-info h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.appointment-info p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ============================================================
   Alert / Status-Meldungen
   ============================================================ */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}

.alert-success {
  background: rgba(39, 174, 96, 0.15);
  color: var(--success);
  border: 1px solid rgba(39, 174, 96, 0.3);
}

.alert-error {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.alert-info {
  background: rgba(183, 217, 0, 0.1);
  color: var(--hero-green);
  border: 1px solid rgba(183, 217, 0, 0.2);
}

.alert-amber {
  background: rgba(232, 168, 56, 0.1);
  color: var(--bernstein);
  border: 1px solid rgba(232, 168, 56, 0.2);
}

/* ============================================================
   Ladeanimation
   ============================================================ */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl);
  gap: var(--space-md);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--hero-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ============================================================
   Footer
   ============================================================ */
.portal-footer {
  padding: var(--space-lg);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.portal-footer a {
  color: var(--muted);
}

.portal-footer a:hover {
  color: var(--white);
}

/* ============================================================
   Responsive — Tablet (>= 768px)
   ============================================================ */
@media (min-width: 768px) {
  .portal-main {
    padding: var(--space-xl) var(--space-xxl);
  }

  .welcome-section h1 {
    font-size: 2rem;
  }

  .fv-amount {
    font-size: 2.5rem;
  }
}

/* ============================================================
   Responsive — Mobile (<= 480px)
   ============================================================ */
@media (max-width: 480px) {
  .portal-header {
    padding: var(--space-sm) var(--space-md);
  }

  .header-title {
    display: none;
  }

  .portal-main {
    padding: var(--space-md);
  }

  .card {
    padding: var(--space-md);
  }

  .fv-amount {
    font-size: 1.6rem;
  }

  .doc-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .contact-info {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================================
   Utility / Hidden
   ============================================================ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
