/* ============================================
   BAUSITE Geo — Rapport-Modul Stylesheet
   Tagesrapport, Fotodokumentation, Dashboard
   ============================================ */

/* ── Modal / Overlay ── */
.rapport-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 28, 51, 0.6);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
  animation: rapport-fadeIn 0.2s ease;
}

@keyframes rapport-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rapport-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: rapport-slideUp 0.25s ease;
}

@keyframes rapport-slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.rapport-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border, #E2E8F0);
  background: var(--navy, #1B2A4A);
  border-radius: 16px 16px 0 0;
}

.rapport-modal-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.rapport-modal-header .rapport-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.rapport-modal-header .rapport-close:hover {
  background: rgba(239, 68, 68, 0.8);
}

.rapport-modal-body {
  padding: 24px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

/* ── Form Elements ── */
.rapport-form-group {
  margin-bottom: 18px;
}

.rapport-form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy, #1B2A4A);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.rapport-form-row {
  display: flex;
  gap: 12px;
}

.rapport-form-row .rapport-form-group {
  flex: 1;
}

.rapport-input,
.rapport-select,
.rapport-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--text, #1E293B);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.rapport-input:focus,
.rapport-select:focus,
.rapport-textarea:focus {
  outline: none;
  border-color: var(--orange, #E8833A);
  box-shadow: 0 0 0 3px rgba(232, 131, 58, 0.12);
}

.rapport-textarea {
  min-height: 80px;
  resize: vertical;
}

.rapport-select {
  cursor: pointer;
}

/* ── Section Headers ── */
.rapport-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--orange, #E8833A);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border, #E2E8F0);
}

.rapport-section-title:first-child {
  margin-top: 0;
}

/* ── Dynamic Tables ── */
.rapport-table-wrap {
  overflow-x: auto;
  margin-bottom: 8px;
}

.rapport-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rapport-table th {
  background: var(--navy, #1B2A4A);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.rapport-table th:first-child {
  border-radius: 6px 0 0 0;
}

.rapport-table th:last-child {
  border-radius: 0 6px 0 0;
}

.rapport-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border, #E2E8F0);
  vertical-align: middle;
}

.rapport-table td input,
.rapport-table td select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  background: #fff;
}

.rapport-table td input:focus,
.rapport-table td select:focus {
  outline: none;
  border-color: var(--orange, #E8833A);
}

.rapport-table .row-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(239, 68, 68, 0.08);
  color: #EF4444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.rapport-table .row-remove:hover {
  background: #EF4444;
  color: #fff;
}

.rapport-add-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(232, 131, 58, 0.08);
  border: 1px dashed var(--orange, #E8833A);
  border-radius: 6px;
  color: var(--orange, #E8833A);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.rapport-add-row:hover {
  background: var(--orange, #E8833A);
  color: #fff;
  border-style: solid;
}

/* ── Signature Canvas ── */
.rapport-signature-wrap {
  position: relative;
  display: inline-block;
}

.rapport-signature-canvas {
  width: 300px;
  height: 100px;
  border: 2px solid var(--border, #E2E8F0);
  border-radius: 8px;
  cursor: crosshair;
  background: #fff;
  touch-action: none;
}

.rapport-signature-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  background: rgba(100, 116, 139, 0.1);
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: var(--slate, #64748B);
  cursor: pointer;
}

.rapport-signature-clear:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
}

/* ── Buttons ── */
.rapport-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.rapport-btn-primary {
  background: var(--orange, #E8833A);
  color: #fff;
}

.rapport-btn-primary:hover {
  background: var(--orange-dark, #D06B24);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 131, 58, 0.3);
}

.rapport-btn-secondary {
  background: var(--navy, #1B2A4A);
  color: #fff;
}

.rapport-btn-secondary:hover {
  background: var(--navy-light, #2A3F6A);
}

.rapport-btn-ghost {
  background: transparent;
  color: var(--slate, #64748B);
  border: 1px solid var(--border, #E2E8F0);
}

.rapport-btn-ghost:hover {
  background: var(--light, #F5F7FA);
  color: var(--navy, #1B2A4A);
}

.rapport-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border, #E2E8F0);
  background: var(--light, #F5F7FA);
  border-radius: 0 0 16px 16px;
}

/* ── Rapport List ── */
.rapport-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.rapport-list-item:hover {
  border-color: var(--orange, #E8833A);
  box-shadow: 0 2px 12px rgba(232, 131, 58, 0.1);
  transform: translateY(-1px);
}

.rapport-list-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rapport-list-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy, #1B2A4A);
}

.rapport-list-baustelle {
  font-size: 11px;
  color: var(--slate, #64748B);
}

.rapport-list-actions {
  display: flex;
  gap: 4px;
}

.rapport-list-actions button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border, #E2E8F0);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.rapport-list-actions button:hover {
  background: var(--navy, #1B2A4A);
  border-color: var(--navy, #1B2A4A);
  color: #fff;
}

/* ── Photo Upload ── */
.rapport-photo-dropzone {
  border: 2px dashed var(--border, #E2E8F0);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--lighter, #FAFBFC);
}

.rapport-photo-dropzone:hover,
.rapport-photo-dropzone.dragover {
  border-color: var(--orange, #E8833A);
  background: rgba(232, 131, 58, 0.04);
}

.rapport-photo-dropzone-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.rapport-photo-dropzone-text {
  font-size: 13px;
  color: var(--slate, #64748B);
  font-weight: 600;
}

.rapport-photo-dropzone-hint {
  font-size: 11px;
  color: var(--slate, #64748B);
  opacity: 0.7;
  margin-top: 4px;
}

.rapport-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.rapport-photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.rapport-photo-thumb:hover {
  border-color: var(--orange, #E8833A);
}

.rapport-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rapport-photo-thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Lightbox ── */
.rapport-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: rapport-fadeIn 0.2s ease;
}

.rapport-lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  position: relative;
}

.rapport-lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.rapport-lightbox-info {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #fff;
}

.rapport-lightbox-info h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.rapport-lightbox-info p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin: 2px 0;
}

.rapport-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  background: var(--orange, #E8833A);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ── Dashboard ── */
.rapport-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.rapport-dash-card {
  background: #fff;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.15s;
}

.rapport-dash-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.rapport-dash-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate, #64748B);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.rapport-dash-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy, #1B2A4A);
  line-height: 1.1;
}

.rapport-dash-card-value.orange {
  color: var(--orange, #E8833A);
}

.rapport-dash-card-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate, #64748B);
  margin-left: 4px;
}

.rapport-dash-card-sub {
  font-size: 11px;
  color: var(--slate, #64748B);
  margin-top: 4px;
}

/* ── Chart ── */
.rapport-chart-wrap {
  background: #fff;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.rapport-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy, #1B2A4A);
  margin-bottom: 12px;
}

.rapport-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding-bottom: 24px;
  position: relative;
}

.rapport-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.rapport-bar-fill {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  transition: height 0.4s ease;
}

.rapport-bar-fill.navy {
  background: var(--navy, #1B2A4A);
}

.rapport-bar-fill.orange {
  background: var(--orange, #E8833A);
}

.rapport-bar-label {
  position: absolute;
  bottom: -20px;
  font-size: 9px;
  font-weight: 600;
  color: var(--slate, #64748B);
  white-space: nowrap;
}

.rapport-bar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  color: var(--navy, #1B2A4A);
  margin-bottom: 2px;
}

/* ── Tabs ── */
.rapport-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--light, #F5F7FA);
  border-radius: 10px;
  padding: 3px;
}

.rapport-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate, #64748B);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.rapport-tab.active {
  background: #fff;
  color: var(--navy, #1B2A4A);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.rapport-tab:hover:not(.active) {
  color: var(--navy, #1B2A4A);
}

/* ── Map Pick Mode ── */
.rapport-map-pick-banner {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--orange, #E8833A);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  z-index: 9100;
  box-shadow: 0 4px 16px rgba(232, 131, 58, 0.4);
  animation: rapport-slideUp 0.3s ease;
}

/* ── Photo Map Marker ── */
.rapport-photo-marker {
  width: 32px;
  height: 32px;
  background: var(--orange, #E8833A);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.15s;
}

.rapport-photo-marker:hover {
  transform: scale(1.2);
}

/* ── Empty State ── */
.rapport-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate, #64748B);
}

.rapport-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.rapport-empty-text {
  font-size: 14px;
  font-weight: 600;
}

.rapport-empty-hint {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.7;
}

/* ── Scrollbar within modals ── */
.rapport-modal-body::-webkit-scrollbar {
  width: 4px;
}

.rapport-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.rapport-modal-body::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 2px;
}

/* ── Print CSS ── */
@media print {
  body * {
    visibility: hidden;
  }

  .rapport-print-area,
  .rapport-print-area * {
    visibility: visible !important;
  }

  .rapport-print-area {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
    padding: 20mm;
    font-size: 11pt;
    color: #000;
  }

  .rapport-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24pt;
    padding-bottom: 12pt;
    border-bottom: 2pt solid #1B2A4A;
  }

  .rapport-print-logo {
    font-size: 18pt;
    font-weight: 800;
    color: #1B2A4A;
  }

  .rapport-print-logo span {
    color: #E8833A;
  }

  .rapport-print-company {
    text-align: right;
    font-size: 9pt;
    color: #333;
    line-height: 1.6;
  }

  .rapport-print-title {
    font-size: 16pt;
    font-weight: 800;
    color: #1B2A4A;
    margin-bottom: 16pt;
  }

  .rapport-print-section {
    margin-bottom: 14pt;
  }

  .rapport-print-section h3 {
    font-size: 10pt;
    font-weight: 700;
    color: #1B2A4A;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1pt solid #ccc;
    padding-bottom: 4pt;
    margin-bottom: 8pt;
  }

  .rapport-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    margin-bottom: 8pt;
  }

  .rapport-print-table th {
    background: #1B2A4A;
    color: #fff;
    font-size: 8pt;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6pt 8pt;
    text-align: left;
  }

  .rapport-print-table td {
    padding: 5pt 8pt;
    border-bottom: 0.5pt solid #ddd;
  }

  .rapport-print-row {
    display: flex;
    justify-content: space-between;
    padding: 3pt 0;
    font-size: 10pt;
  }

  .rapport-print-row span:first-child {
    color: #666;
  }

  .rapport-print-row span:last-child {
    font-weight: 700;
  }

  .rapport-print-signature {
    margin-top: 24pt;
    padding-top: 12pt;
    border-top: 1pt solid #ccc;
  }

  .rapport-print-signature img {
    max-height: 60pt;
  }

  .rapport-print-footer {
    position: fixed;
    bottom: 10mm;
    left: 20mm;
    right: 20mm;
    font-size: 8pt;
    color: #999;
    text-align: center;
    border-top: 0.5pt solid #ddd;
    padding-top: 4pt;
  }

  /* Hide non-print */
  .rapport-overlay,
  .rapport-modal-footer,
  .rapport-close,
  .rapport-btn,
  .no-print {
    display: none !important;
  }
}
