/* =============================================================================
   WBA Mobile Erfassung – Frontend CSS v1.8
   Redesign: Schwarz / Vollbild / Serifenlos / Eckige Buttons
   ============================================================================= */

:root {
    --wine:      #8B1A1A;
    --wine-dark: #5c1010;
    --wine-light:#b52a2a;
    --gold:      #c8a96e;
    --bg:        #000000;
    --surface:   #111111;
    --surface2:  #1a1a1a;
    --surface3:  #222222;
    --border:    rgba(139,26,26,.4);
    --border2:   rgba(255,255,255,.08);
    --text:      #ffffff;
    --text-muted:#888888;
    --green:     #00cc44;
    --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

body.admin-bar #wpadminbar { display: none !important; }
body.admin-bar { margin-top: 0 !important; }

/* ---------- Page Layout --------------------------------------------------- */
#wba-app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: var(--bg);
}

/* ---------- Header -------------------------------------------------------- */
.wba-header {
    background: var(--wine-dark);
    padding: 14px 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--wine);
}
.wba-header-title {
    font-family: var(--font);
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    line-height: 1.2;
    text-transform: uppercase;
}
.wba-header-title small {
    display: block;
    font-size: .62rem;
    font-weight: 400;
    opacity: .6;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-top: 2px;
}
.wba-counter-badge {
    background: var(--wine);
    border: none;
    color: #fff;
    border-radius: 0;
    padding: 6px 14px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font);
    letter-spacing: .04em;
}

/* ---------- PWA Install Banner -------------------------------------------- */
#wba-install-banner {
    background: var(--surface2);
    border-bottom: 1px solid var(--gold);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
#wba-install-banner .banner-icon { font-size: 1.4rem; flex-shrink: 0; }
#wba-install-banner .banner-text { flex: 1; font-size: .8rem; line-height: 1.4; color: var(--gold); }
#wba-install-banner .banner-text strong { display: block; color: #fff; margin-bottom: 1px; }
.wba-btn-install {
    background: var(--gold);
    color: #000;
    border: none;
    border-radius: 0;
    padding: 8px 16px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.wba-btn-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

/* ---------- Main Content -------------------------------------------------- */
.wba-main {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
}

/* ---------- Card ---------------------------------------------------------- */
.wba-card {
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border);
    width: 100%;
}
.wba-card-header {
    background: var(--surface2);
    padding: 10px 16px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--gold);
    border-bottom: 1px solid var(--border);
    font-family: var(--font);
}

/* ---------- Square Photo Area --------------------------------------------- */
.wba-photo-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}
.wba-photo-wrap:active { opacity: .85; }

#wba-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.wba-photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    background: #080808;
}
.wba-photo-placeholder .ph-icon { font-size: 4rem; opacity: .2; }
.wba-photo-placeholder .ph-text {
    font-size: .9rem;
    font-weight: 600;
    opacity: .45;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.wba-photo-placeholder .ph-hint {
    font-size: .7rem;
    opacity: .25;
    text-align: center;
    padding: 0 32px;
}

/* Foto-Buttons */
.wba-photo-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}
.wba-photo-btns button {
    background: var(--surface2);
    border: none;
    color: var(--text);
    padding: 18px 8px;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: .05em;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
}
.wba-photo-btns button:active { background: var(--wine-dark); }
.wba-photo-btns button .btn-icon { font-size: 1.2rem; }

/* ---------- EAN / Barcode ------------------------------------------------- */
.wba-ean-section { padding: 14px 16px; }

.wba-ean-row {
    display: flex;
    gap: 0;
    align-items: stretch;
    border: 1px solid var(--border);
}
.wba-ean-input {
    flex: 1;
    background: var(--surface2);
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text);
    font-size: 1.05rem;
    padding: 14px 16px;
    font-family: 'Courier New', 'Menlo', monospace;
    letter-spacing: .06em;
    -webkit-appearance: none;
    outline: none;
    min-width: 0;
    transition: background .1s;
}
.wba-ean-input:focus  { background: var(--surface3); }
.wba-ean-input::placeholder {
    color: var(--text-muted);
    font-size: .82rem;
    font-family: var(--font);
    letter-spacing: 0;
}
.wba-ean-input.ean-valid   { color: var(--green); }
.wba-ean-input.ean-invalid { color: #ff4444; }

.wba-ean-scan-btn {
    background: var(--wine-dark);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    padding: 14px 20px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
}
.wba-ean-scan-btn:active { background: var(--wine-light); }

.wba-ean-hint {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* EAN Error/Hint */
.wba-ean-hint[style*="color:#e05c5e"],
.wba-ean-hint[style*="color:"] {
    background: rgba(255,68,68,.07);
    border-left: 3px solid #ff4444;
    padding: 6px 10px;
    margin-top: 8px;
}

/* Scanner */
#wba-scanner-wrap {
    display: none;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--wine);
}
#wba-scanner-video { width: 100%; display: block; max-height: 220px; object-fit: cover; }
.wba-scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.wba-scanner-line {
    width: 80%;
    height: 2px;
    background: var(--wine-light);
    box-shadow: 0 0 8px var(--wine-light);
    animation: scanline 1.8s ease-in-out infinite;
}
@keyframes scanline {
    0%, 100% { transform: translateY(-35px); opacity: .3; }
    50%       { transform: translateY(35px);  opacity: 1;  }
}
.wba-scanner-stop {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,.75);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    padding: 6px 12px;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    pointer-events: all;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ---------- Notiz --------------------------------------------------------- */
.wba-notiz-section { padding: 0 16px 14px; }
.wba-notiz-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .95rem;
    padding: 12px 16px;
    font-family: var(--font);
    -webkit-appearance: none;
    outline: none;
    border-radius: 0;
}
.wba-notiz-input:focus { border-color: rgba(139,26,26,.8); background: var(--surface3); }
.wba-notiz-input::placeholder { color: var(--text-muted); }

/* ---------- Bestätigen-Button --------------------------------------------- */
#wba-confirm-section { padding: 0; }
.wba-confirm-btn {
    width: 100%;
    background: #005c1c;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--font);
    letter-spacing: .06em;
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
    border-radius: 0;
}
.wba-confirm-btn:active { background: #003d12; }

/* ---------- Status-Meldung ----------------------------------------------- */
.wba-save-status { margin: 0; padding: 0; }
.wba-save-status--success {
    background: rgba(0,92,28,.25);
    border-left: 4px solid var(--green);
    color: #4dff88;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.55;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0,204,68,.15);
}
.wba-save-status--error {
    background: rgba(200,0,0,.1);
    border-left: 4px solid #ff3333;
    color: #ff6666;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.5;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,51,51,.15);
}

/* ---------- Capture List -------------------------------------------------- */
.wba-list-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-wrap: wrap;
    gap: 10px;
}
.wba-list-title {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--gold);
}
.wba-list-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.wba-btn-sm {
    background: var(--surface3);
    border: 1px solid var(--border2);
    color: var(--text-muted);
    padding: 8px 14px;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: .04em;
    -webkit-tap-highlight-color: transparent;
    transition: color .1s, background .1s;
    border-radius: 0;
}
.wba-btn-sm:active { color: #fff; background: var(--wine-dark); }

.wba-btn-batch {
    background: var(--wine);
    border: none;
    color: #fff;
    padding: 8px 18px;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    letter-spacing: .05em;
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
    border-radius: 0;
}
.wba-btn-batch:active { background: var(--wine-light); }
.wba-btn-batch:disabled { opacity: .45; cursor: default; }

/* Captures Grid */
.wba-captures-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #111;
}
.wba-capture-thumb {
    aspect-ratio: 1 / 1;
    position: relative;
    background: #0a0a0a;
    overflow: hidden;
}
.wba-capture-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wba-capture-thumb .thumb-ean {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.82);
    color: #fff;
    font-size: .57rem;
    padding: 4px 6px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    letter-spacing: .03em;
}
.wba-capture-thumb .thumb-delete {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0,0,0,.75);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff;
    width: 24px;
    height: 24px;
    font-size: .68rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 0;
}
.wba-capture-thumb:hover .thumb-delete,
.wba-capture-thumb.selected .thumb-delete { display: flex; }

/* Empty state */
.wba-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}
.wba-empty-state .empty-icon { font-size: 2.5rem; opacity: .2; margin-bottom: 12px; }
.wba-empty-state p { font-size: .85rem; line-height: 1.7; }

/* ---------- iOS-Hinweis --------------------------------------------------- */
#wba-ios-hint {
    display: none;
    background: var(--surface2);
    border-bottom: 1px solid var(--gold);
    padding: 14px 16px;
    font-size: .82rem;
    color: var(--gold);
    line-height: 1.6;
}
#wba-ios-hint strong { color: #fff; }
#wba-ios-hint .ios-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    margin: -4px -4px 0 8px;
}

/* ---------- Upload Overlay ------------------------------------------------ */
.wba-upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.wba-upload-overlay.active { opacity: 1; pointer-events: all; }
.wba-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(139,26,26,.2);
    border-top-color: var(--wine-light);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wba-overlay-msg {
    color: var(--text);
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ---------- Scrollbar ----------------------------------------------------- */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--wine-dark); }

/* ---------- Desktop limit ------------------------------------------------- */
@media (min-width: 520px) {
    #wba-app { max-width: 480px; margin: 0 auto; border-right: 1px solid #181818; border-left: 1px solid #181818; }
    body { background: #050505; }
}
