/* ═══════════════════════════════════════════════════════════
   Fahrrad-Manager – Frontend CSS   v1.0   Autor: Alexandra
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

/* ── Basis ──────────────────────────────────────────────────────────────── */
.fm-wrap {
    font-family: 'Nunito', sans-serif;
    color: #1e293b;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    box-sizing: border-box;
}
.fm-wrap *, .fm-wrap *::before, .fm-wrap *::after { box-sizing: inherit; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.fm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: all 0.18s ease;
    line-height: 1.4;
    white-space: nowrap;
}
.fm-btn-lg  { padding: 12px 28px; font-size: 15px; }
.fm-btn-sm  { padding: 6px 13px;  font-size: 13px; }

/* Blau – primär */
.fm-btn-primary {
    background: #1d4ed8;
    color: #ffffff !important;
    border-color: #1d4ed8;
}
.fm-btn-primary:hover {
    background: #1e40af;
    border-color: #1e40af;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(29,78,216,0.35);
    text-decoration: none;
}

/* Sekundär – helles Blau */
.fm-btn-secondary {
    background: #eff6ff;
    color: #1d4ed8 !important;
    border-color: #93c5fd;
}
.fm-btn-secondary:hover {
    background: #dbeafe;
    border-color: #60a5fa;
    text-decoration: none;
}

/* Outline neutral */
.fm-btn-outline {
    background: #fff;
    color: #475569 !important;
    border-color: #cbd5e1;
}
.fm-btn-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b !important;
    text-decoration: none;
}

/* Gefahr */
.fm-btn-danger {
    background: #fff;
    color: #dc2626 !important;
    border-color: #fca5a5;
}
.fm-btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
    text-decoration: none;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.fm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid #e2e8f0;
}
.fm-header-left { display: flex; align-items: center; gap: 14px; }
.fm-logo        { font-size: 42px; line-height: 1; }
.fm-title       { font-size: 24px; font-weight: 800; color: #1e293b; margin: 0; line-height: 1.2; }
.fm-subtitle    { font-size: 14px; color: #64748b; margin: 2px 0 0; }

/* ── Leer-Zustand ───────────────────────────────────────────────────────── */
.fm-empty {
    text-align: center;
    padding: 4rem 1rem;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
}
.fm-empty-icon { font-size: 56px; margin-bottom: 1rem; }
.fm-empty p    { color: #64748b; margin-bottom: 1.5rem; font-size: 16px; }

/* ── Karten-Grid ────────────────────────────────────────────────────────── */
.fm-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax(210px, 1fr) );
    gap: 1.25rem;
}

.fm-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
    display: flex;
    flex-direction: column;
}
.fm-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 6px 20px rgba(29,78,216,0.12);
    transform: translateY(-2px);
}

.fm-card-foto {
    height: 160px;
    overflow: hidden;
    background: #f1f5f9;
}
.fm-card-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fm-card-foto-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 48px;
    color: #cbd5e1;
}

.fm-card-body  { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.fm-card-name  { font-size: 15px; font-weight: 800; color: #1e293b; margin: 0; }
.fm-card-sub   { font-size: 13px; color: #64748b; margin: 0; }

.fm-badges     { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.fm-badge {
    font-size: 11px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 5px;
    padding: 2px 8px;
    font-weight: 600;
    white-space: nowrap;
}

.fm-card-merkmal {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.fm-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

/* ── Zurück-Link ────────────────────────────────────────────────────────── */
.fm-back {
    display: inline-block;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 1.25rem;
    transition: color 0.15s;
}
.fm-back:hover { color: #1e40af; text-decoration: underline; }

/* ── Formular-Header ────────────────────────────────────────────────────── */
.fm-form-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}
.fm-form-header h2 { font-size: 20px; font-weight: 800; margin: 0; }

/* ── Sektionen ──────────────────────────────────────────────────────────── */
.fm-section {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.fm-section-title {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 1rem;
}

/* ── Formular-Grid ──────────────────────────────────────────────────────── */
.fm-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.fm-field-full { grid-column: 1 / -1; }

.fm-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.fm-required { color: #dc2626; }

.fm-field input[type="text"],
.fm-field input[type="date"],
.fm-field textarea,
.fm-form input[type="text"],
.fm-form input[type="date"],
.fm-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    color: #1e293b;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    background: #fafafa;
}
.fm-field input:focus,
.fm-field textarea:focus,
.fm-form input:focus,
.fm-form textarea:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29,78,216,0.12);
    background: #fff;
}
.fm-field textarea, .fm-form textarea { resize: vertical; }

/* ── Foto-Upload ────────────────────────────────────────────────────────── */
.fm-foto-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.fm-foto-slot {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    transition: border-color 0.18s;
}
.fm-foto-slot:hover { border-color: #93c5fd; }
.fm-foto-nr {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.fm-foto-empty      { font-size: 40px; margin: 8px 0; color: #cbd5e1; }
.fm-foto-preview    { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.fm-foto-hinweis    { font-size: 11px; color: #94a3b8; margin: 4px 0; }
.fm-file-input      { width: 100%; font-size: 12px; color: #64748b; cursor: pointer; }

/* ── PDF ────────────────────────────────────────────────────────────────── */
.fm-pdf-vorhanden {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.fm-pdf-hinweis { font-size: 13px; color: #64748b; }

/* ── Formular-Aktionen ──────────────────────────────────────────────────── */
.fm-form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* ── Nachrichten ────────────────────────────────────────────────────────── */
.fm-msg {
    margin-top: 1rem;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}
.fm-msg-ok  { background: #f0fdf4; color: #166534; border: 1.5px solid #86efac; }
.fm-msg-err { background: #fef2f2; color: #dc2626; border: 1.5px solid #fca5a5; }

/* ── Detail-Ansicht ─────────────────────────────────────────────────────── */
.fm-detail-galerie {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}
.fm-galerie-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    display: block;
    transition: opacity 0.15s;
}
.fm-galerie-item:hover img { opacity: 0.85; }
.fm-detail-galerie-placeholder {
    font-size: 80px;
    text-align: center;
    padding: 2rem 0;
    color: #cbd5e1;
}

.fm-detail-titel    { margin-bottom: 1.5rem; }
.fm-detail-titel h2 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.fm-detail-titel p  { color: #64748b; margin: 0; font-size: 15px; }

.fm-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.fm-detail-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 14px;
}
.fm-detail-label { display: block; font-size: 11px; color: #94a3b8; font-weight: 700;
                   text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fm-detail-wert  { font-size: 15px; font-weight: 700; color: #1e293b; }

.fm-merkmal-text { font-size: 15px; line-height: 1.7; color: #374151; margin: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .fm-form-grid  { grid-template-columns: 1fr; }
    .fm-foto-grid  { grid-template-columns: 1fr; }
    .fm-grid       { grid-template-columns: 1fr; }
    .fm-header     { flex-direction: column; align-items: flex-start; }
    .fm-form-actions { flex-direction: column; }
    .fm-btn-lg     { width: 100%; justify-content: center; }
}

/* ── PDF-Thumbnail ──────────────────────────────────────────────────────── */
.fm-card-pdf-thumb {
    margin-top: 8px;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
}
.fm-card-pdf-thumb a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.fm-card-pdf-thumb img {
    width: 48px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.fm-card-pdf-thumb span {
    font-size: 12px;
    color: #1d4ed8;
    font-weight: 600;
}
.fm-card-pdf-thumb a:hover img { opacity: 0.8; }
.fm-card-pdf-thumb a:hover span { text-decoration: underline; }

.fm-pdf-thumb-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
.fm-pdf-thumb-img {
    max-width: 220px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: box-shadow 0.18s;
}
.fm-pdf-thumb-img:hover {
    box-shadow: 0 4px 16px rgba(29,78,216,0.18);
}

.fm-pdf-thumb-form {
    display: block;
    max-width: 160px;
    border-radius: 6px;
    border: 1.5px solid #e2e8f0;
    margin-bottom: 6px;
}

/* ── PDF.js Canvas Thumbnails ── */
canvas.fm-pdf-canvas {
    display: block;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    background: #f8fafc;
    max-width: 100%;
}

/* ── v1.2.0 – Neue Felder ── */
.fm-badge-nutzer { background: #ede9fe; color: #5b21b6; }
.fm-badge-ip     { background: #dbeafe; color: #1e40af; font-family: monospace; font-size: 11px; }

.fm-detail-section-secure {
    border: 1px solid #fde68a;
    background: #fffbeb;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}
.fm-detail-section-secure h3 { color: #92400e; }

.fm-pin-value {
    font-family: monospace;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: #1e40af;
}

/* ── PDF löschen Button ── */
.fm-pdf-vorhanden {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.fm-pdf-hinweis {
    color: #6b7280;
    font-size: 12px;
    width: 100%;
}

/* ── v1.3.0 – Multi-Upload & Datei-Verwaltung ── */
.fm-upload-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 12px;
}
.fm-upload-label span {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

/* ── Foto-Grid ── */
.fm-dateien-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

/* Foto-Karte: Bild oben, Löschen-Button darunter */
.fm-datei-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 110px;
}
.fm-datei-item img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    display: block;
}

/* Mülleimer-Button — gemeinsam für Foto & PDF */
.fm-datei-del {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
    white-space: nowrap;
}
.fm-datei-del:hover { background: #b91c1c; }
.fm-datei-del svg   { flex-shrink: 0; }

/* ── PDF-Grid (Kacheln) ── */
.fm-dateien-pdf-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.fm-datei-pdf-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 110px;
}
.fm-datei-pdf-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    width: 110px;
    min-height: 140px;
}
.fm-datei-pdf-preview canvas {
    display: block;
    max-width: 100%;
}
.fm-datei-pdf-name {
    font-size: 10px;
    color: #475569;
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
    max-width: 110px;
}
.fm-datei-pdf-del { width: 100%; }

/* Vorschau neu hochgeladener Dateien */
.fm-preview-item { opacity: 0.8; }
.fm-preview-name {
    font-size: 10px;
    color: #64748b;
    text-align: center;
    word-break: break-all;
    max-width: 110px;
}
.fm-pdf-icon { font-size: 32px; }

/* ── v1.4.0 – Unterschriften ── */
.fm-unterschrift-section {
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    background: #f8faff;
    margin-top: 1.5rem;
}
.fm-unterschriften-liste { display: flex; flex-direction: column; gap: 14px; margin-bottom: 1.5rem; }

.fm-unterschrift-eintrag {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fm-unterschrift-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.fm-unterschrift-meta strong { font-size: 14px; color: #1e293b; }
.fm-unterschrift-datum  { color: #64748b; font-size: 12px; }
.fm-unterschrift-bemerkung {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
}
.fm-unterschrift-bild {
    max-width: 100%;
    max-height: 120px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    display: block;
}
.fm-unterschrift-leer { color: #94a3b8; font-size: 13px; font-style: italic; margin: 0 0 1rem; }

/* Formular */
.fm-unterschrift-formular {
    border-top: 1px solid #e2e8f0;
    padding-top: 1.25rem;
    margin-top: 0.5rem;
}
.fm-unterschrift-formular h4 { margin: 0 0 .75rem; font-size: 15px; color: #1e293b; }

/* Canvas */
.fm-sign-canvas-wrap {
    position: relative;
    width: 100%;
    background: #fff;
    border: 2px dashed #94a3b8;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    cursor: crosshair;
    touch-action: none;
}
.fm-sign-canvas-wrap canvas {
    display: block;
    width: 100%;
    touch-action: none;
}
.fm-sign-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #cbd5e1;
    font-size: 13px;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity .2s;
    margin: 0;
}
.fm-sign-canvas-wrap:active .fm-sign-hint,
.fm-sign-canvas-wrap.fm-signed .fm-sign-hint { opacity: 0; }

.fm-sign-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Mobil-optimiert */
@media (max-width: 480px) {
    .fm-sign-actions { flex-direction: column; }
    .fm-sign-actions .fm-btn { width: 100%; text-align: center; }
}


/* ── v1.5.0 – Kennwort & Bemerkungen ── */
.fm-pw-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.fm-pw-wrap input {
    flex: 1;
}
.fm-pw-toggle {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.2s;
}
.fm-pw-toggle:hover { background: #e2e8f0; }

.fm-pw-detail-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fm-pw-hidden {
    font-family: monospace;
    font-size: 15px;
    letter-spacing: 0.1em;
    color: #1e293b;
}
.fm-pw-reveal-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #475569;
    transition: background 0.2s;
}
.fm-pw-reveal-btn:hover { background: #e2e8f0; color: #1e293b; }
