/* Reset & base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* App container — full viewport, centered content */
.app-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Form groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

/* Form controls */
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* Validation: missing required field */
.form-control.missing {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}
.char-counter {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding-right: 0.25rem;
}
.char-counter.warn {
    color: var(--warning);
}
.char-counter.full {
    color: var(--danger);
    font-weight: 600;
}

/* Dropdown arrow */
select.form-control {
    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='%236e6e73' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Spacer pushes button to bottom area */
.spacer {
    flex: 1;
    min-height: 2rem;
}

/* Save button */
.btn-save {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ffffff;
    background: var(--accent);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 1rem;
}

.btn-save:active {
    transform: scale(0.97);
    background: var(--accent-hover);
}

.btn-save:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.btn-save.saving {
    background: var(--text-muted);
    pointer-events: none;
}

/* Action row (Bearbeiten / Karte) */
.action-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.btn-action {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    color: #fff;
}

.btn-action:active {
    transform: scale(0.97);
}

.btn-action:disabled {
    background: #a1a1a6;
    cursor: not-allowed;
}

.btn-edit {
    background: #ff3b30;
}

.btn-edit:active:not(:disabled) {
    background: #d32f2f;
}

.btn-map {
    background: #0071e3;
}

.btn-map:active:not(:disabled) {
    background: #005bb5;
}

/* Loading state for selects */
.form-control.loading {
    color: #a1a1a6;
}

/* ── Photo section ───────────────────────────────────────────── */
.photo-section {
    margin-bottom: 1rem;
}

.btn-photo {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--bg-card);
    border: 1px dashed var(--accent);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-photo:active {
    background: #f0f4ff;
}

.photo-preview {
    position: relative;
    margin-top: 0.75rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    max-height: 200px;
}

.photo-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
}

.btn-remove-photo {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.photo-preview.hidden {
    display: none;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .app-container {
        padding: 1.5rem 1rem;
    }
    .form-control {
        font-size: 1rem;
        padding: 0.75rem 0.875rem;
    }
    .btn-save {
        font-size: 1rem;
        padding: 0.875rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .app-container {
        max-width: 520px;
        padding: 2rem;
    }
}

@media (min-width: 769px) {
    .app-container {
        padding: 3rem 2rem;
    }
}
