/* Label-Generator V2 – Gestaltung angelehnt an V1 (Tailwind/Flowbite), ohne Build-Schritt */

@font-face { font-family: 'Figtree'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/Figtree-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/Figtree-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/Figtree-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Figtree'; font-weight: 800; font-style: normal; font-display: swap; src: url('../fonts/Figtree-ExtraBold.ttf') format('truetype'); }

:root {
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --red-600: #dc2626;
    --red-50: #fef2f2;
    --amber-700: #b45309;
    --radius: 0.5rem;
    --shadow: 0 2px 15px -3px rgba(0, 0, 0, .07), 0 10px 20px -2px rgba(0, 0, 0, .04);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-100);
    -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

/* Links: dezente Unterstreichung, beim Überfahren kräftiger */
a {
    color: var(--blue-600);
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, .3);
    text-decoration-thickness: 1px;
    text-underline-offset: .2em;
    transition: color .15s, text-decoration-color .15s;
}
a:hover { color: #1d4ed8; text-decoration-color: currentColor; }
a:focus-visible { border-radius: 2px; }

/* Externe Textlinks mit kleinem Pfeil kennzeichnen */
a[target="_blank"]:not(.store-badge):not(.btn)::after {
    content: '';
    display: inline-block;
    width: .7em;
    height: .7em;
    margin-left: .2em;
    vertical-align: .05em;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M7 17 17 7M9 7h8v8'/%3e%3c/svg%3e") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M7 17 17 7M9 7h8v8'/%3e%3c/svg%3e") center / contain no-repeat;
    opacity: .7;
}
p { margin: 0 0 .5rem; }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: 1rem; }

.container { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }

/* ---------- Kopf ---------- */
.site-header { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1); }
.header-inner { display: flex; align-items: center; gap: 2.5rem; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.header-logo { display: block; height: 6rem; width: auto; }
.header-title { flex: 1; display: flex; flex-direction: column; }
.header-name { font-weight: 600; font-size: 1.25rem; line-height: 1.75rem; }
.header-links { display: flex; flex-direction: column; font-size: .875rem; padding-right: .75rem; }
.header-links a { color: inherit; text-decoration: none; }
.header-links a:hover { text-decoration: underline; text-decoration-color: var(--gray-300); }

@media (max-width: 640px) {
    .header-inner { gap: 1rem; padding-top: 1rem; padding-bottom: 1rem; }
    .header-logo { height: 3.5rem; }
    .header-name { font-size: 1.1rem; }
    .header-title { font-size: .875rem; }
    .header-links { padding-right: 0; }
}

/* ---------- Karten ---------- */
.section { padding-top: .5rem; padding-bottom: .5rem; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { border-bottom: 2px solid #f5f5f5; padding: 1rem; font-size: 1.25rem; font-weight: 500; line-height: 1.75rem; }
.card-head-flex { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-body { padding: 1rem; }
.section:first-child .card-body { padding: 1.5rem; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .editor-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Akkordeon ---------- */
.accordion { margin-top: 1rem; border: 1px solid var(--gray-200); }
.accordion summary {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .75rem 1.25rem; font-weight: 500; color: var(--gray-500); cursor: pointer; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
    content: ''; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform .15s; margin-right: .25rem;
}
.accordion[open] summary::after { transform: rotate(-135deg); }
.accordion summary:hover { background: var(--gray-100); }
.accordion-body { padding: 1.25rem; border-top: 1px solid var(--gray-200); color: var(--gray-500); }
.accordion-body ul { margin: 0 0 .5rem; padding-left: 2.5rem; }
.accordion-small { margin-top: .5rem; border-radius: .375rem; }
.accordion-small summary { padding: .5rem .75rem; font-size: .875rem; }
.accordion-small .accordion-body { padding: 1rem .75rem; color: inherit; }

/* App-Hinweis im Akkordeon */
.app-hint {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem;
    margin: .75rem 0 1rem; padding: .875rem 1rem; border: 1px solid var(--gray-200); border-radius: var(--radius);
    background: var(--gray-50); color: var(--gray-700);
}
.app-hint-links { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.store-badge { display: inline-flex; align-items: center; height: 40px; }
.store-badge img { display: block; }
.badge-apple { height: 40px; width: auto; }
/* Das Google-Badge enthält vorgegebenen Freiraum, daher größer und mit negativem Rand */
.badge-google { height: 59px; width: auto; margin: -9.5px -9px; }

/* ---------- Formular ---------- */
.form-row { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; padding-bottom: 1rem; }
.form-row:first-child { gap: 1rem .5rem; }
.field { display: flex; flex-direction: column; min-width: 8rem; }
.field-grow { flex: 1 1 18rem; }
.field-full { flex-basis: 100%; }
.field label:first-child { font-size: .875rem; font-weight: 500; color: var(--gray-700); }

input[type="text"], input[type="number"], select {
    margin-top: .25rem; width: 100%; font: inherit; color: var(--gray-900); background-color: #fff;
    border: 1px solid var(--gray-300); border-radius: .375rem; padding: .5rem .75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
select {
    appearance: none; padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right .5rem center; background-repeat: no-repeat; background-size: 1.5em 1.5em;
}
input:focus, select:focus, button:focus-visible, summary:focus-visible, a:focus-visible {
    outline: 2px solid transparent; box-shadow: 0 0 0 3px rgba(59, 130, 246, .35); border-color: var(--blue-500);
}
input.is-invalid { border-color: var(--red-600); }
.field-error { color: var(--red-600); font-size: .875rem; margin: .5rem 0 0; }
.hint { font-size: .875rem; color: var(--gray-500); margin: .75rem 0 0; }

/* Schalter */
.toggle { position: relative; display: inline-block; width: 2.75rem; height: 1.5rem; margin-top: .5rem; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle-track { position: absolute; inset: 0; background: var(--gray-200); border-radius: 9999px; transition: background .15s; }
.toggle-track::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 1.25rem; height: 1.25rem;
    background: #fff; border: 1px solid var(--gray-300); border-radius: 9999px; transition: transform .15s;
}
.toggle input:checked + .toggle-track { background: var(--blue-600); }
.toggle input:checked + .toggle-track::after { transform: translateX(1.25rem); border-color: #fff; }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px rgba(59, 130, 246, .35); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem;
    font: inherit; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    border-radius: .375rem; border: 1px solid transparent; cursor: pointer; transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gray-800); color: #fff; }
.btn-primary:hover { background: var(--gray-700); }
.btn-secondary { background: #fff; color: var(--gray-700); border-color: var(--gray-300); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-light { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.btn-light:hover { background: var(--gray-200); }
.btn-icon {
    border: 1px solid var(--gray-300); background: #fff; border-radius: .375rem; width: 2rem; height: 2rem;
    font-size: 1.25rem; line-height: 1; cursor: pointer; color: var(--gray-700);
}
.btn-icon:disabled { opacity: .4; cursor: default; }
.icon { width: 1.5rem; height: 1.5rem; flex: none; }
.icon-sm { width: 1rem; height: 1rem; flex: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding-top: 1.25rem; }
.actions-result { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
@media (max-width: 480px) { .actions-result > .icon { display: none; } }
.stale-note { font-size: .875rem; color: var(--amber-700); }

.link-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }
.link-result { display: flex; gap: .5rem; margin-top: .75rem; max-width: 36rem; }
.link-result input { margin-top: 0; font-size: .875rem; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--gray-100); }
.link-list li div { min-width: 0; display: flex; flex-direction: column; }
.link-list a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* ---------- Vorschau ---------- */
.preview { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.preview-empty { padding-top: 1rem; text-align: center; }
.preview-overflow { margin: 0; padding: .5rem .75rem; border-radius: .375rem; background: #fffbeb; color: var(--amber-700); font-size: .875rem; text-align: center; }
.preview-warning { padding-top: .5rem; font-size: .875rem; font-weight: 600; text-align: center; }
.preview-stats { display: flex; gap: 1.25rem; font-size: .875rem; color: var(--gray-500); }
.preview-stats strong { color: var(--gray-900); }
.label-preview { zoom: 1.35; }
.label-preview .lbl { position: relative; border: 1px solid var(--gray-300); border-radius: 1.5mm; background: #fff; }

.sheet-preview-wrap { width: 100%; max-width: 22rem; margin-top: .5rem; }
.sheet-preview-nav { display: flex; align-items: center; justify-content: space-between; font-size: .875rem; margin-bottom: .5rem; }
.sheet-preview { position: relative; width: 100%; overflow: hidden; border: 1px solid var(--gray-200); box-shadow: var(--shadow); background: #fff; }
.sheet-preview .sheet { transform-origin: 0 0; position: absolute; top: 0; left: 0; }

/* ---------- Etiketten & Bögen (Bildschirm und Druck) ---------- */
.sheet { position: relative; width: 210mm; height: 296.5mm; overflow: hidden; background: #fff; }
.sheet .lbl { position: absolute; }
.lbl { overflow: hidden; color: #000; font-family: 'Figtree', Arial, sans-serif; }
.lbl-frame { outline: 0.2mm solid #a0a0a0; outline-offset: -0.1mm; border-radius: 1.5mm; }
.lbl-inner { display: flex; align-items: center; width: 100%; height: 100%; }
.lbl-text { flex: 1 1 auto; min-width: 0; max-height: 100%; overflow: hidden; text-align: left; overflow-wrap: anywhere; }
.lbl-qr { flex: none; }
.lbl-qr svg { display: block; width: 100%; height: 100%; }

/* ---------- Modale Dialoge ---------- */
.modal {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center;
    padding: 1rem; overflow-y: auto; background: rgba(17, 24, 39, .5);
}
.modal-box { position: relative; width: 100%; max-width: 28rem; margin: auto 0; background: #fff; border-radius: var(--radius); box-shadow: 0 10px 25px rgba(0, 0, 0, .2); }
.modal-md { max-width: 42rem; }
.modal-lg { max-width: 64rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200); }
.modal-head h3 { margin: 0; font-size: 1.25rem; font-weight: 600; }
.modal-close {
    width: 2rem; height: 2rem; border: 0; border-radius: var(--radius); background: transparent;
    color: var(--gray-400); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-900); }
.modal-body { padding: 1.25rem; }
.modal-foot { display: flex; flex-direction: column; align-items: center; padding: 1rem; border-top: 1px solid var(--gray-200); font-size: .875rem; color: var(--gray-500); }
.modal-foot p { margin: 0 0 .25rem; }

.prose { color: var(--gray-500); }
.prose h4 { margin: 1.25rem 0 .5rem; font-size: 1.25rem; font-weight: 600; color: var(--gray-500); }
.prose h4:first-child { margin-top: 0; }
.prose p { margin-bottom: .75rem; }
.prose ul { margin: 0 0 .75rem; padding-left: 1.5rem; }
.prose .strong-dark { margin: 1rem 0 .25rem; font-weight: 600; color: var(--gray-900); }
.prose .strong-dark:first-child { margin-top: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; gap: .5rem; } }
.chip { display: inline-block; font-weight: 600; border: 1px solid var(--gray-300); border-radius: .375rem; padding: 0 .35rem; margin: .1rem 0; }
.small { font-size: .875rem; }
.muted { color: var(--gray-400); }

/* ---------- Was ist neu? ---------- */
.whatsnew { color: var(--gray-700); }
.whatsnew-highlight {
    padding: 1rem 1.25rem; margin-bottom: 1rem; border-radius: var(--radius);
    background: #eff6ff; border: 1px solid #bfdbfe;
}
.whatsnew-highlight p { margin: 0; }
.whatsnew-highlight p + p { margin-top: .35rem; }
.whatsnew-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-600); }
.whatsnew-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.whatsnew-list { margin: 0; padding-left: 1.25rem; }
.whatsnew-list li { margin-bottom: .5rem; }
.whatsnew-foot { align-items: flex-end; }

/* ---------- Einwilligung ---------- */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 1rem; pointer-events: none; }
.consent-box {
    pointer-events: auto; max-width: 48rem; margin: 0 auto; background: #fff; border: 1px solid var(--gray-200);
    border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 1.25rem; font-size: .9rem; color: var(--gray-700);
}
.consent-title { font-weight: 600; font-size: 1rem; color: var(--gray-900); }
.consent-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; margin-top: .75rem; }
@media (max-width: 480px) { .consent-actions .btn { flex: 1; justify-content: center; } }

/* ---------- Hinweis-Toast ---------- */
.toast {
    position: fixed; top: 1.25rem; right: 1.25rem; z-index: 70; max-width: 22rem;
    background: var(--gray-800); color: #fff; padding: .75rem 1rem; border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .2); font-size: .9rem;
}
.toast-error { background: var(--red-600); }

/* ---------- Fuß ---------- */
.site-footer { padding: 1rem; text-align: center; font-size: .875rem; color: var(--gray-400); }
.footer-links a { color: var(--gray-500); text-decoration: none; }
.footer-links a:hover { color: var(--gray-900); text-decoration: underline; text-decoration-color: var(--gray-300); }

/* ---------- Druckbereich ---------- */
#print-root { display: none; }

@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; width: 210mm; }
    body > *:not(#print-root) { display: none !important; }
    #print-root { display: block !important; }
    #print-root .sheet { break-after: page; page-break-after: always; }
    #print-root .sheet:last-child { break-after: auto; page-break-after: auto; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
