* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  min-height: 100vh;
  padding: 30px 20px;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  background: #fafafa;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.header {
  padding: 36px 40px 24px;
  text-align: center;
  background: #fafafa;
}

.icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #7a9b8e 0%, #6a8a7d 100%);
  border-radius: 16px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(122, 155, 142, 0.3);
  position: relative;
}

.icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  background: inherit;
  border-radius: 20px;
  opacity: 0.15;
  z-index: -1;
}

.icon i {
  width: 30px;
  height: 30px;
  color: white;
  stroke-width: 2.5;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 16px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.tab-btn {
  padding: 14px 28px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  background: white;
  color: #6c757d;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.tab-btn i {
  width: 18px;
  height: 18px;
}

.tab-btn:hover {
  border-color: #7a9b8e;
  color: #7a9b8e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(122, 155, 142, 0.2);
}

.tab-btn.active {
  background: linear-gradient(135deg, #7a9b8e 0%, #6a8a7d 100%);
  border-color: #7a9b8e;
  color: white;
  box-shadow: 0 6px 20px rgba(122, 155, 142, 0.3);
}

.tab-content {
  display: none;
  padding: 40px;
}

.tab-content.active {
  display: block;
  animation: fadeSlideIn 0.5s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Table Controls */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
  flex-wrap: wrap;
}

.search-container {
  position: relative;
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #6c757d;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon i {
  width: 18px;
  height: 18px;
  color: #6c757d;
}

.search-icon svg {
  width: 100%;
  height: 100%;
}

.search-container input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s;
  background: white;
  color: #212529;
  box-sizing: border-box;
}

.search-container input:hover {
  border-color: #ced4da;
}

.search-container input:focus {
  outline: none;
  border-color: #7a9b8e;
  box-shadow: 0 0 0 4px rgba(122, 155, 142, 0.12);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-controls label {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
}

.pagination-controls select {
  padding: 8px 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: #212529;
  cursor: pointer;
  transition: all 0.3s;
}

.pagination-controls select:hover {
  border-color: #ced4da;
}

.pagination-controls select:focus {
  outline: none;
  border-color: #7a9b8e;
  box-shadow: 0 0 0 4px rgba(122, 155, 142, 0.12);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  flex-wrap: wrap;
  gap: 16px;
}

.pagination-info {
  font-size: 14px;
  color: #6c757d;
  font-weight: 600;
}

.pagination-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  color: #495057;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.pagination-btn:hover:not(:disabled) {
  border-color: #7a9b8e;
  color: #7a9b8e;
  background: #f0f7f4;
}

.pagination-btn.active {
  background: linear-gradient(135deg, #7a9b8e 0%, #6a8a7d 100%);
  border-color: #7a9b8e;
  color: white;
  box-shadow: 0 4px 12px rgba(122, 155, 142, 0.3);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn i {
  width: 18px;
  height: 18px;
}

.pagination-ellipsis {
  padding: 0 8px;
  color: #6c757d;
  font-weight: 600;
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 2px solid #e9ecef;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table thead {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.data-table th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e9ecef;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f3f5;
  color: #212529;
  font-size: 14px;
}

.data-table tbody tr {
  transition: background 0.2s;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.loading-row {
  text-align: center;
  padding: 40px !important;
}

.loading-row .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e9ecef;
  border-top: 3px solid #7a9b8e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

.loading-row span {
  color: #6c757d;
  font-size: 14px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.spinning {
  animation: spin 0.7s linear infinite;
}

.expand-btn {
  background: linear-gradient(135deg, #7a9b8e 0%, #6a8a7d 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.expand-btn:hover {
  box-shadow: 0 4px 12px rgba(122, 155, 142, 0.3);
  transform: translateY(-2px);
}

.expand-btn i {
  width: 14px;
  height: 14px;
}

.edit-btn {
  background: white;
  color: #495057;
  border: 2px solid #e9ecef;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.edit-btn:hover {
  border-color: #7a9b8e;
  color: #7a9b8e;
  background: #f0f7f4;
  transform: translateY(-2px);
}

.edit-btn i {
  width: 14px;
  height: 14px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-schnellanalyse {
  background: #fff3cd;
  color: #856404;
}

.badge-detailanalyse {
  background: #d1ecf1;
  color: #0c5460;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
}

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

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 40px;
  max-width: min(500px, 90vw);
  width: 100%;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content.large {
  max-width: min(900px, 90vw);
  max-height: 90vh;
  padding: 0;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 40px 24px;
  border-bottom: 2px solid #e9ecef;
  flex-shrink: 0;
}

.close-btn {
  width: 36px;
  height: 36px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.close-btn:hover {
  border-color: #dc3545;
  background: #fff5f5;
}

.close-btn i {
  width: 18px;
  height: 18px;
  color: #6c757d;
}

.close-btn:hover i {
  color: #dc3545;
}

.modal-body {
  color: #212529;
  padding: 40px;
  overflow-y: auto;
  flex: 1;
  /* Custom scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #7a9b8e #f1f3f5;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f3f5;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #7a9b8e;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #6a8a7d;
}

.detail-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border-left: 4px solid #7a9b8e;
}

.detail-section h3 {
  font-size: 18px;
  font-weight: 700;
  color: #7a9b8e;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section h3 i {
  width: 20px;
  height: 20px;
}

.detail-grid {
  display: grid;
  gap: 16px;
}

/* 3-column grid for sections with exactly 3 items */
.detail-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* 2-column grid for sections with more than 3 items */
.detail-grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Responsive: 3-column grid */
@media (max-width: 1200px) {
  .detail-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .detail-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive: 2-column grid */
@media (max-width: 900px) {
  .detail-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 16px;
  font-weight: 600;
  color: #212529;
}

.detail-item-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label-compact {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.5;
}

.detail-label-compact .detail-answer {
  color: #212529;
  text-transform: none;
}

.detail-value-compact {
  font-size: 14px;
  font-weight: 500;
  color: #212529;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-value-compact div {
  line-height: 1.5;
}

.wohnung-item {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.wohnung-item h4 {
  font-size: 16px;
  font-weight: 700;
  color: #7a9b8e;
  margin-bottom: 12px;
}

.wohnung-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Responsive wohnung-grid */
@media (max-width: 1200px) {
  .wohnung-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .wohnung-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .wohnung-grid {
    grid-template-columns: 1fr;
  }
}

/* Form Elements */
.form-group {
  margin-bottom: 12px;
}

.modal-body .form-group {
  margin-bottom: 0;
}

.modal-body .detail-section .form-group {
  margin-bottom: 0;
}

.modal-body .hint-text {
  font-size: 13px;
  color: #6c757d;
  margin-top: 8px;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.modal-body .hint-text i {
  width: 18px;
  height: 18px;
  color: #6c757d;
  flex-shrink: 0;
}

.modal-body input[type='text'],
.modal-body input[type='email'],
.modal-body input[type='number'],
.modal-body input[type='date'],
.modal-body select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s;
  background: white;
  color: #212529;
  box-sizing: border-box;
}

.modal-body input:hover,
.modal-body select:hover {
  border-color: #ced4da;
}

.modal-body input:focus,
.modal-body select:focus {
  outline: none;
  border-color: #7a9b8e;
  box-shadow: 0 0 0 4px rgba(122, 155, 142, 0.12);
}

.modal-body label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #212529;
  font-size: 13px;
}

.btn-secondary {
  background: #e9ecef;
  color: #495057;
  border: 2px solid #e9ecef;
  padding: 15px 34px;
}

.btn-secondary:hover {
  background: #dee2e6;
  border-color: #ced4da;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #212529;
  font-size: 14px;
}

.input-with-unit {
  position: relative;
}

.input-with-unit input {
  padding-right: 60px;
}

.input-with-unit .unit {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.wohnungen-list {
  margin-top: 16px;
}

.wohnung-item-edit {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.wohnung-item-edit h4 {
  font-size: 16px;
  font-weight: 700;
  color: #7a9b8e;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wohnung-item-edit h4 i {
  width: 18px;
  height: 18px;
}

.wohnung-item-edit .detail-grid {
  margin-top: 12px;
}

.wohnung-item-edit .special-questions {
  margin-top: 16px;
  padding: 16px;
  background: #fff8e1;
  border: 2px solid #ffe082;
  border-radius: 8px;
}

.wohnung-item-edit .special-questions label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  font-weight: 500;
}

.wohnung-item-edit .special-questions input[type='radio'] {
  width: auto;
  margin: 0;
  accent-color: #7a9b8e;
}

input {
  width: 100%;
  padding: 15px 18px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  color: #212529;
}

select {
  width: 100%;
  padding: 15px 18px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  color: #212529;
  box-sizing: border-box;
}

input:hover {
  border-color: #ced4da;
}

select:hover {
  border-color: #ced4da;
}

input:focus {
  outline: none;
  border-color: #7a9b8e;
  box-shadow: 0 0 0 4px rgba(122, 155, 142, 0.12);
}

select:focus {
  outline: none;
  border-color: #7a9b8e;
  box-shadow: 0 0 0 4px rgba(122, 155, 142, 0.12);
}

.btn {
  padding: 17px 36px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: inherit;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #7a9b8e 0%, #6a8a7d 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(122, 155, 142, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(122, 155, 142, 0.4);
  transform: translateY(-3px);
}

.btn-primary:active {
  transform: translateY(-1px);
}

.settings-container {
  max-width: 800px;
  margin: 0 auto;
}

.error-box {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
  border: 2px solid #dc3545;
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 16px;
  color: #721c24;
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  align-items: center;
  gap: 12px;
}

.error-box i {
  width: 20px;
  height: 20px;
  color: #dc3545;
  flex-shrink: 0;
}

.error-box i[data-lucide='check-circle'] {
  color: #28a745;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.empty-state i {
  width: 64px;
  height: 64px;
  color: #adb5bd;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
}

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .container {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  .header {
    padding: 32px 24px 24px;
  }

  .content {
    padding: 0 24px 36px;
  }

  .tab-content {
    padding: 0px;
  }

  .tabs {
    flex-direction: column;
  }

  .tab-btn {
    width: 100%;
  }

  .table-controls .btn-new-analysis .btn-text {
    display: none;
  }
  .table-controls .btn-new-analysis {
    padding: 10px 14px;
    min-width: auto;
  }
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-container {
    max-width: 100%;
  }

  .pagination-controls {
    width: 100%;
    justify-content: space-between;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .pagination-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }

  .table-container {
    overflow-x: scroll;
  }

  .data-table {
    min-width: 800px;
  }

  .modal-content {
    padding: 24px;
    margin: 10px;
  }

  .modal-content.large {
    padding: 0;
  }

  .detail-grid.grid-3,
  .detail-grid.grid-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-header {
    padding: 24px 24px 16px;
  }

  .modal-form-actions .btn {
    font-size: 13px;
    padding: 10px 18px;
  }
}

/* Switch styling for Bezeichnung label */
.label-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.leerstand-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.leerstand-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.leerstand-slider {
  position: absolute;
  inset: 0;
  background: #e9ecef;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px #dee2e6;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.leerstand-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.leerstand-switch input:checked + .leerstand-slider {
  background: linear-gradient(135deg, #7a9b8e 0%, #6a8a7d 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 8px 22px rgba(122, 155, 142, 0.28);
}

.leerstand-switch input:checked + .leerstand-slider::before {
  transform: translateX(20px);
}

.leerstand-switch-right {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.leerstand-switch-label {
  font-size: 14px;
  color: #6c757d;
  font-weight: 600;
}
