/* =================================================================
   Workflow-Erweiterung für das-energieberater-team.de
   © Dipl.-Ing. Rolf Krause · Alle Rechte vorbehalten
   Ergänzt style.css um Workflow-Sidebar, Stepper, CSV-Import
   ================================================================= */

/* ── LAYOUT: SIDEBAR + CONTENT ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 120px);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ── SIDEBAR (Workflow) ── */
.workflow-sidebar {
  width: 300px;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  height: calc(100vh - 120px);
}

.wf-header {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.wf-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 4px;
}
.wf-progress {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Phasen */
.wf-phase { margin-bottom: 2px; }
.wf-phase-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.wf-phase-header:hover { background: var(--bg-light); }
.wf-phase-icon { font-size: 16px; flex-shrink: 0; }
.wf-phase-name { font-size: 0.8125rem; font-weight: 600; color: var(--text); flex: 1; }
.wf-phase-chevron {
  font-size: 16px;
  color: var(--text-light);
  transition: transform 0.2s;
}
.wf-phase.active .wf-phase-name { color: var(--primary); }
.wf-phase.done .wf-phase-name { color: var(--success); }

/* Schritte */
.wf-steps { display: none; padding: 0 0 8px; }
.wf-steps.open { display: block; }
.wf-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 20px 8px 28px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
}
.wf-step:hover { background: var(--bg-light); text-decoration: none; }
.wf-step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--text-light);
  margin-top: 4px;
  flex-shrink: 0;
}
.wf-step.active .wf-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,160,210,0.2);
}
.wf-step.done .wf-step-dot {
  background: var(--success);
  border-color: var(--success);
}
.wf-step-content { flex: 1; min-width: 0; }
.wf-step-name { display: block; font-size: 0.8125rem; font-weight: 500; }
.wf-step-desc { display: block; font-size: 0.6875rem; color: var(--text-light); margin-top: 1px; }
.wf-step.active .wf-step-name { color: var(--primary); font-weight: 600; }
.wf-step-badge {
  font-size: 0.625rem;
  background: rgba(0,160,210,0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Workflow-Actions */
.wf-actions {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.wf-btn {
  display: block;
  text-align: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.wf-btn-next {
  background: var(--primary);
  color: #fff;
}
.wf-btn-next:hover { background: var(--accent); text-decoration: none; color: #fff; }
.wf-btn-back {
  background: var(--bg-light);
  color: var(--text-light);
}
.wf-btn-back:hover { background: var(--border); text-decoration: none; }
.wf-btn-export {
  background: var(--success);
  color: #fff;
}
.wf-btn-export:hover { opacity: 0.9; }

.wf-import {
  padding: 12px 20px;
  text-align: center;
}
.wf-import-label {
  font-size: 0.75rem;
  color: var(--text-light);
  cursor: pointer;
  text-decoration: underline;
}
.wf-import-label:hover { color: var(--accent); }

/* ── CONTENT AREA (Workflow) ── */
.content-area {
  flex: 1;
  min-width: 0;
  padding: 0;
}
.content-area .tool-wrapper {
  max-width: 100%;
  overflow-x: hidden;
}

/* ── STARTSEITE ── */
.start-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}
.start-page h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
  line-height: 1.15;
}
.start-page .accent {
  color: var(--accent);
}
.start-lead {
  font-size: 1.0625rem;
  color: var(--text-light);
  margin-bottom: 2.5rem;
  max-width: 600px;
}
.workflow-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.wf-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.wf-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,160,210,0.12);
  transform: translateY(-2px);
  text-decoration: none;
}
.wf-card-icon { font-size: 2rem; margin-bottom: 1rem; }
.wf-card h2 { font-size: 1.375rem; font-weight: 700; color: var(--primary-dark); margin: 0 0 0.5rem; }
.wf-card p { font-size: 0.875rem; color: var(--text-light); line-height: 1.5; margin: 0; }
.wf-card .start-arrow {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

/* CSV Import */
.import-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  border: 2px dashed var(--border);
}
.import-box h3 { font-size: 1rem; color: var(--primary-dark); margin: 0 0 0.5rem; }
.import-box p { font-size: 0.8125rem; color: var(--text-light); margin: 0 0 1rem; }
.import-box label {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: var(--bg-light);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  transition: background 0.15s;
}
.import-box label:hover { background: var(--border); }

/* Platzhalter */
.placeholder-page {
  max-width: 640px;
  margin: 5rem auto;
  text-align: center;
  padding: 1.5rem;
}
.placeholder-page h1 { margin-bottom: 1rem; }
.placeholder-page p { color: var(--text-light); }

/* ── MOBILE ── */
@media (max-width: 1024px) {
  .workflow-sidebar { width: 260px; }
}

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .workflow-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
    overflow-y: auto;
  }
  .workflow-cards { grid-template-columns: 1fr; }

  /* Tool-Wrapper: volle Breite, kein Overflow */
  .content-area .tool-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .content-area { padding: 12px 8px; }

  /* Workflow-Step-Phasen: horizontal scrollbar */
  .workflow-phases { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 8px; padding-bottom: 8px; }
  .workflow-phases .phase-card { min-width: 120px; flex-shrink: 0; padding: 12px 10px; }
  .workflow-phases .phase-card .phase-label { font-size: 10px; }
  .workflow-phases .phase-card .phase-name { font-size: 12px; }

  /* Tool-Toolbar: wrap */
  .tool-toolbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .tool-toolbar .btn { font-size: 12px; padding: 6px 12px; }

  /* Sidebar Toggle für Mobile */
  .sidebar-toggle {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    text-align: center;
    margin-bottom: 8px;
  }
  .sidebar-toggle::after { content: ' ▼'; font-size: 10px; }
  .sidebar-collapsed .workflow-sidebar { display: none; }
  .sidebar-collapsed .sidebar-toggle::after { content: ' ▶'; }
}

/* Tablet: Sidebar schmaler */
@media (min-width: 769px) and (max-width: 1024px) {
  .workflow-sidebar { width: 240px; }
  .sidebar-toggle { display: none; }
}
@media (min-width: 1025px) {
  .sidebar-toggle { display: none; }
}
