:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-border: #dde1e6;
    --color-text: #1f2430;
    --color-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-customer: #15803d;
    --color-customer-bg: #f0fdf4;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
    font-size: 1.75rem;
}

.subtitle {
    color: var(--color-muted);
    margin-top: 0;
}

.sync-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sync-status {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.tab-button {
    background: none;
    color: var(--color-muted);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 0.6rem 1.1rem;
    border-bottom: 2px solid transparent;
}

.tab-button:hover:not(:disabled) {
    background: var(--color-surface);
}

.tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.search-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.search-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.autocomplete {
    position: relative;
}

#address-input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.suggestions {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 10;
    max-height: 240px;
    overflow-y: auto;
}

.suggestions.hidden {
    display: none;
}

.suggestions li {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.suggestions li:hover,
.suggestions li.active {
    background: var(--color-bg);
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1.1rem;
    background: var(--color-primary);
    color: white;
    transition: background 0.15s ease;
}

button:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

button:disabled {
    background: #b7c3e0;
    cursor: not-allowed;
}

#search-button {
    margin-top: 1rem;
}

.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.9rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.search-filters label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
    cursor: pointer;
}

.results-meta {
    color: var(--color-muted);
    font-size: 0.9rem;
    min-height: 1.2em;
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.result-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid transparent;
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.result-item.is-customer,
.apotheken-item.is-customer {
    background: var(--color-customer-bg);
    border-left-color: var(--color-customer);
}

.customer-badge {
    display: inline-block;
    background: var(--color-customer);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.result-rank {
    font-weight: 700;
    color: var(--color-muted);
    min-width: 1.5rem;
}

.result-info {
    flex: 1;
}

.result-name {
    font-weight: 600;
}

.result-address {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.result-blister {
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

.result-distance {
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
}

.apotheken-filter {
    margin-bottom: 1rem;
}

.apotheken-filter input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.apotheken-group {
    margin-bottom: 1.5rem;
}

.apotheken-group.hidden {
    display: none;
}

.apotheken-group h2 {
    font-size: 1rem;
    color: var(--color-muted);
    margin: 0 0 0.6rem;
}

.apotheken-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.apotheken-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid transparent;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.apotheken-item-status {
    font-size: 0.8rem;
    font-weight: 600;
    color: #b45309;
    white-space: nowrap;
}

.site-footer {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.site-footer a {
    color: var(--color-muted);
    text-decoration: underline;
}

.site-footer a:hover {
    color: var(--color-primary);
}

.legal-content h2 {
    font-size: 1.1rem;
    margin-top: 1.75rem;
}

.legal-content p,
.legal-content ul {
    line-height: 1.6;
}

.legal-content a {
    color: var(--color-primary);
}

.legal-back {
    margin-top: 2rem;
}

.legal-back a {
    color: var(--color-primary);
}
