/* search.css — Charts durchsuchen */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #1a1a2e;
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-back {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  transition: background 0.15s;
  white-space: nowrap;
}
.header-back:hover { background: rgba(255,255,255,0.18); color: white; }

.header-title h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: 0.02em; }

.admin-badge {
  display: inline-block;
  background: #e49836;
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 0.75rem;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  font-size: 0.82rem;
}

.header-auth-email {
  color: rgba(255,255,255,0.7);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-auth a, .header-auth button {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.header-auth a:hover, .header-auth button:hover { background: rgba(255,255,255,0.22); }

/* ── Layout ── */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Search card ── */
.search-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 8px rgba(0,0,0,0.04);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ── Quick filter bar ── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-bar input[type="text"] {
  flex: 1;
  min-width: 140px;
  padding: 0.55rem 0.8rem;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #1a1a1a;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-bar input[type="text"]:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74,111,165,0.14);
}
.filter-bar input[type="text"]::placeholder { color: #bbb; }

.btn-search {
  background: #1a1a2e;
  color: white;
  border: none;
  padding: 0.55rem 1.5rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-search:hover:not(:disabled) { background: #2d2d50; }
.btn-search:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-reset {
  background: none;
  border: 1px solid #d5d5d5;
  color: #666;
  padding: 0.55rem 1rem;
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-reset:hover { border-color: #4a6fa5; color: #4a6fa5; }

/* ── Collapsible sections ── */
details {
  border: 1px solid #e8eaf0;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

details > summary {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: #f8f9fa;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: '▶';
  font-size: 0.65rem;
  color: #aaa;
  transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { background: #eef2fa; }

.details-content {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.details-content.full-width {
  grid-template-columns: 1fr;
}

/* ── Form fields ── */
.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 0.3rem;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  font-size: 0.88rem;
  color: #1a1a1a;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74,111,165,0.14);
}

.field input::placeholder { color: #bbb; }

.section-separator {
  grid-column: 1 / -1;
  border: none;
  border-top: 1px solid #eee;
  margin: 0.25rem 0;
}

.section-label {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-top: 0.25rem;
}

/* ── Results ── */
#resultsInfo {
  font-size: 0.84rem;
  color: #666;
  margin-bottom: 1rem;
  min-height: 1.2em;
}

#resultsInfo.loading { color: #888; font-style: italic; }
#resultsInfo.error { color: #a52020; }

#resultsList {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Result card ── */
.result-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 8px rgba(0,0,0,0.04);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-card.is-main { border-left: 4px solid #e49836; }

.result-info { flex: 1; min-width: 0; }

.result-name {
  font-size: 0.98rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.badge-main { color: #e49836; font-size: 1.05rem; }

.badge-own {
  font-size: 0.68rem;
  font-weight: 600;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
}

.result-user-email {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 0.25rem;
}

.result-row {
  font-size: 0.8rem;
  color: #666;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin-bottom: 0.2rem;
}

.result-row span { white-space: nowrap; }

.meta-label {
  font-weight: 600;
  color: #aaa;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-saved {
  font-size: 0.73rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ── Card actions ── */
.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: flex-start;
  flex-wrap: wrap;
}

.btn-load {
  background: #1a1a2e;
  color: white;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-load:hover { background: #2d2d50; }
.btn-load:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Responsive ── */
@media (max-width: 820px) {
  header { padding: 0.9rem 1.25rem; }
  .header-auth-email { display: none; }
}

@media (max-width: 640px) {
  .filter-bar { flex-direction: column; }
  .filter-bar input[type="text"] { width: 100%; }
  .result-card { flex-direction: column; }
  .result-actions { width: 100%; }
}

@media (max-width: 480px) {
  header { padding: 0.7rem 1rem; }
  main { padding: 1.25rem 1rem; }
  .search-card { padding: 1rem; }
}
