/* pdf.smartline.info — Reader Styles
 *
 * --c-bg / --c-stage werden inline aus reader.php gesetzt (DB-Wert oder URL-Param ?bg=).
 * Default: weiß. Hier in der CSS nur als Fallback wenn die inline-Variable fehlt.
 */
:root {
    --c-accent: #fbbf24;
    --c-bg: #ffffff;
    --c-stage: #ffffff;
    --c-toolbar: #15171b;
    --c-toolbar-fg: #d6d8dd;
    --c-toolbar-fg-muted: #8b8f96;
    --c-btn-hover: rgba(255,255,255,.08);
    --tb-h: 52px;
}
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    height: 100%;
    background: var(--c-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: var(--c-toolbar-fg);
    overflow: hidden;
    overscroll-behavior: none;
}

.reader {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.stage {
    flex: 1 1 auto;
    position: relative;
    background: var(--c-stage);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
    cursor: pointer;          /* signalisiert: klickbar zum Blättern */
}
.stage.no-click { cursor: default; }

.canvas-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    box-shadow: 0 6px 30px rgba(0,0,0,.18);
}
#page-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    background: #fff;
}
.annotation-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.annotation-layer a {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    background: rgba(251, 191, 36, 0);  /* unsichtbar */
    border-radius: 2px;
    transition: background .15s;
}
.annotation-layer a:hover {
    background: rgba(251, 191, 36, 0.22);
}

/* ── Loading-Spinner ─────────────── */
.loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--c-stage);
    z-index: 5;
    transition: opacity .25s ease;
    color: rgba(0,0,0,.55);
}
.loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(0,0,0,.10);
    border-top-color: var(--c-accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: .85rem; opacity: .7; }

/* ── Floating-Pfeile (Desktop) ───── */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    opacity: 0;
    transition: opacity .2s, background .2s, transform .15s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .25);
}
.nav-arrow svg { pointer-events: none; }
.nav-arrow-left  { left: 18px; }
.nav-arrow-right { right: 18px; }
.reader:hover .nav-arrow,
.nav-arrow:focus-visible { opacity: 0.85; }
.nav-arrow:hover {
    opacity: 1;
    background: var(--c-accent);
    color: #1a4010;
    transform: translateY(-50%) scale(1.05);
}
.nav-arrow:active { transform: translateY(-50%) scale(.96); }
.nav-arrow:disabled {
    opacity: 0.25 !important;
    pointer-events: none;
}
.nav-arrow:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
}

/* Touch-Geräte: Pfeile ausblenden, Stage-Cursor neutral */
@media (hover: none) and (pointer: coarse) {
    .nav-arrow { display: none; }
    .stage { cursor: default; }
}

/* ── Toolbar ─────────────────────── */
.toolbar {
    flex: 0 0 var(--tb-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    background: var(--c-toolbar);
    border-top: 1px solid rgba(255,255,255,.06);
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.toolbar-right { gap: 8px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 0;
    background: transparent;
    color: var(--c-toolbar-fg);
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
    text-decoration: none;
}
.btn:hover { background: var(--c-btn-hover); }
.btn:active { background: rgba(255,255,255,.14); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 1px;
}

.page-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 6px;
    font-size: .9rem;
    color: var(--c-toolbar-fg-muted);
    font-variant-numeric: tabular-nums;
}
#page-input {
    width: 44px;
    text-align: right;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 4px;
    color: var(--c-toolbar-fg);
    padding: 4px 6px;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}
#page-input::-webkit-inner-spin-button,
#page-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#page-input:focus {
    outline: 0;
    border-color: var(--c-accent);
    background: rgba(255,255,255,.08);
}

/* ── Share-Popover ───────────────── */
.share-wrap { position: relative; display: inline-block; }
.share-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    right: -8px;
    min-width: 200px;
    background: #fff;
    color: #1a2318;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.30), 0 2px 6px rgba(0,0,0,.18);
    padding: 6px;
    z-index: 20;
    animation: share-pop .14s ease-out;
}
.share-popover::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 22px;
    width: 12px; height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0,0,0,.06);
}
@keyframes share-pop {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.share-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: #1a2318;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background .12s, color .12s;
    box-sizing: border-box;
}
.share-item:hover { background: #f3f1ec; }
.share-item:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: -2px;
}
.share-item svg { flex-shrink: 0; }
.share-whatsapp svg { color: #25D366; }
.share-facebook svg { color: #1877F2; }
.share-linkedin svg { color: #0A66C2; }
.share-mail svg     { color: #6b7280; }
.share-copy svg     { color: #6b7280; }
.share-native svg   { color: #6b7280; }
.share-copy.is-copied { background: #e7f5ec; color: #1c5a30; }
.share-copy.is-copied svg { color: #1c5a30; }

@media (max-width: 480px) {
    .share-popover { min-width: 180px; right: 0; }
    .share-popover::after { right: 14px; }
}

/* ── Powered-by ──────────────────── */
.powered-by {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--c-toolbar-fg-muted);
    text-decoration: none;
    opacity: 0.7;
    padding: 4px 8px;
    border-radius: 4px;
    transition: opacity .2s, background .12s;
    margin-left: 4px;
}
.powered-by:hover { opacity: 1; background: var(--c-btn-hover); }
.powered-by img {
    height: 16px;
    width: auto;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

/* ── Mobile-Optimierung ──────────── */
@media (max-width: 600px) {
    :root { --tb-h: 56px; }
    .powered-by span { display: none; }
    .toolbar { padding: 0 6px; }
    .btn { width: 40px; height: 40px; }
}

/* ── Vollbild ────────────────────── */
:fullscreen .reader,
:-webkit-full-screen .reader { background: #000; }
