/* ═══════════════════════════════════════════════════════
   KreditBuddy — Modern Layer
   Ergänzt style.css: Buddy, Kontoauszug-Upload, RTL,
   feinere Oberflächen. Kein Reset, nichts überschrieben,
   was die bestehende Beratung braucht.
   ═══════════════════════════════════════════════════════ */

:root {
  --ink: #12203A;
  --ink-soft: #5A6B84;
  --line: #E4E8EF;
  --paper: #FFFFFF;
  --paper-2: #F8FAFC;
  --brand: #CC0000;
  --brand-soft: #FFF1F1;
  --ok: #16794C;
  --ok-soft: #E9F7F0;
  --warn: #B26A00;
  --warn-soft: #FFF6E6;
  --err: #C22B2B;
  --err-soft: #FDEDED;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-1: 0 1px 2px rgba(16,32,58,.05), 0 4px 16px rgba(16,32,58,.06);
  --shadow-2: 0 2px 6px rgba(16,32,58,.07), 0 12px 32px rgba(16,32,58,.10);
}

/* ══════════════════ CASHI (Maskottchen) ══════════════════ */

.buddy { display: flex; flex-direction: column; align-items: center; gap: 10px; user-select: none; }
.buddy-stage { position: relative; width: 124px; height: 124px; display: grid; place-items: center; }
.buddy.compact .buddy-stage { width: 56px; height: 56px; }
.buddy.compact .buddy-figure { width: 54px; height: 56px; }

.buddy-ring { position: absolute; inset: 0; width: 124px; height: 124px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 4.5; }
.ring-fill {
  fill: none; stroke: var(--brand); stroke-width: 4.5; stroke-linecap: round;
  transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1);
}
.buddy.complete .ring-fill { stroke: var(--ok); }

.buddy-figure { width: 96px; height: 100px; cursor: pointer; transition: transform .18s; }
.buddy-figure:active { transform: scale(.94); }
.buddy-svg { width: 100%; height: 100%; overflow: visible; }

.buddy-level {
  position: absolute; bottom: -4px;
  background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; letter-spacing: .3px;
}
.buddy.complete .buddy-level { background: var(--ok); }

/* ── Palette der Figur ── */
.c-skin       { fill: #F8C08E; }
.c-hair       { fill: #4A3126; }
.c-suit       { fill: #22354F; }
.c-lapel      { fill: #1A2A40; }
.c-shirt      { fill: #FFFFFF; }
.c-tie        { fill: #1F5BA8; }
.c-tie-knot   { fill: #17457F; }
.c-button     { fill: #16243A; }
.c-shoe       { fill: #3D2A1C; }
.c-shadow     { fill: #16243A; opacity: .09; }
.c-sleeve     { fill: none; stroke: #22354F; stroke-width: 12; stroke-linecap: round; }
.c-knuckle    { fill: none; stroke: #DFA070; stroke-width: 1.6; stroke-linecap: round; }

.c-eye-white  { fill: #FFFFFF; }
.c-pupil      { fill: #1B1410; }
.c-glint      { fill: #FFFFFF; }
.c-brow       { fill: #3A241A; }
.c-blush      { fill: #EF8A6A; opacity: .38; }
.c-lens       { fill: rgba(255,255,255,.14); stroke: #2E2119; stroke-width: 3.4; }
.c-bridge, .c-temple { fill: none; stroke: #2E2119; stroke-width: 3.2; stroke-linecap: round; }

.c-mouth-in   { fill: #8C2A2A; }
.c-tongue     { fill: #EE6B63; }
.m-smile, .m-flat, .m-worry { fill: none; stroke: #8C2A2A; stroke-width: 3.4; stroke-linecap: round; }

.c-board-bg    { fill: #4E5B6B; }
.c-board-paper { fill: #F4F7FA; }
.c-board-clip  { fill: #39434F; }
.c-bar         { fill: #17A184; }
.c-trend       { fill: none; stroke: #148A72; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.c-trend-head  { fill: #148A72; }

.c-pig-body  { fill: #F2A8B8; }
.c-pig-snout { fill: #E88EA2; }
.c-pig-hole  { fill: #C96C80; }
.c-pig-slot  { fill: #C96C80; }
.c-pig-eye   { fill: none; stroke: #A8556A; stroke-width: 1.8; stroke-linecap: round; }
.c-coin      { fill: #F2C230; }
.c-coin-in   { fill: #E0A81C; }
.c-coin-txt  { fill: #8A6300; font: 700 7px var(--font-ui, system-ui, sans-serif); text-anchor: middle; }

.c-dot { fill: #C3CDD9; }
.c-cf1, .c-cf5 { fill: #CC0000; }
.c-cf2, .c-cf6 { fill: #F2C230; }
.c-cf3 { fill: #17A184; }
.c-cf4, .c-cf7 { fill: #1F5BA8; }

/* ── Mund-Varianten: nur eine sichtbar ── */
.c-mouth { display: none; }
.buddy .m-smile { display: block; }
.buddy[data-state="happy"] .m-smile,
.buddy[data-state="point"] .m-smile { display: none; }
.buddy[data-state="happy"] .m-open,
.buddy[data-state="point"] .m-open { display: block; }
.buddy[data-state="cheer"] .m-smile { display: none; }
.buddy[data-state="cheer"] .m-wide { display: block; }
.buddy[data-state="thinking"] .m-smile { display: none; }
.buddy[data-state="thinking"] .m-flat { display: block; }
.buddy[data-state="worried"] .m-smile { display: none; }
.buddy[data-state="worried"] .m-worry { display: block; }

/* ── Grundzustand ── */
.c-figure { animation: bob 3.6s ease-in-out infinite; transform-origin: 60px 116px; }
.c-eye { animation: blink 5.4s infinite; transform-origin: center; transform-box: fill-box; }
.c-eye-r { animation-delay: .05s; }
.c-props { animation: propFloat 4.2s ease-in-out infinite; }
.c-coin-drop { animation: coinBounce 3.6s ease-in-out infinite; transform-origin: 18px 90px; }
.c-think, .c-party { opacity: 0; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(-1deg); }
}
@keyframes blink {
  0%, 93%, 100% { transform: scaleY(1); }
  96%           { transform: scaleY(.08); }
}
@keyframes propFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
@keyframes coinBounce {
  0%, 70%, 100% { transform: translateY(0) rotate(0deg); }
  80%           { transform: translateY(-5px) rotate(-12deg); }
}

/* ── denkt nach ── */
.buddy[data-state="thinking"] .c-think { opacity: 1; }
.buddy[data-state="thinking"] .c-dot { animation: thinkPop 1.2s infinite; }
.buddy[data-state="thinking"] .c-dot2 { animation-delay: .18s; }
.buddy[data-state="thinking"] .c-dot3 { animation-delay: .36s; }
.buddy[data-state="thinking"] .c-eyes { transform: translateY(-2.5px); }
.buddy[data-state="thinking"] .c-board { animation: boardTilt 1.6s ease-in-out infinite; transform-origin: 94px 84px; }
@keyframes thinkPop {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-3px); }
}
@keyframes boardTilt {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-5deg); }
}

/* ── freut sich: Daumen hoch wackelt ── */
.buddy[data-state="happy"] .c-figure { animation: hop .55s ease-out 2; }
.buddy[data-state="happy"] .c-arm-l { animation: thumbWiggle .5s ease-in-out 3; transform-origin: 41px 84px; }
.buddy[data-state="happy"] .c-blush { opacity: .55; }
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1,1); }
  30%      { transform: translateY(-9px) scale(.97,1.04); }
  60%      { transform: translateY(0) scale(1.03,.97); }
}
@keyframes thumbWiggle {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-10deg); }
}

/* ── feiert ── */
.buddy[data-state="cheer"] .c-figure { animation: hop .5s ease-out 3; }
.buddy[data-state="cheer"] .c-party { opacity: 1; }
.buddy[data-state="cheer"] .c-cf { animation: confetti 1.6s ease-out forwards; }
.buddy[data-state="cheer"] .c-cf2 { animation-delay: .10s; }
.buddy[data-state="cheer"] .c-cf3 { animation-delay: .20s; }
.buddy[data-state="cheer"] .c-cf4 { animation-delay: .30s; }
.buddy[data-state="cheer"] .c-cf5 { animation-delay: .15s; }
.buddy[data-state="cheer"] .c-cf6 { animation-delay: .25s; }
.buddy[data-state="cheer"] .c-cf7 { animation-delay: .35s; }
.buddy[data-state="cheer"] .c-arm-l { animation: cheerArm .6s ease-out 3; transform-origin: 41px 84px; }
.buddy[data-state="cheer"] .c-blush { opacity: .6; }
@keyframes confetti {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-30px) rotate(240deg); }
}
@keyframes cheerArm {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-20deg) translateY(-4px); }
}

/* ── besorgt ── */
.buddy[data-state="worried"] .c-brow-l { transform: rotate(16deg) translateY(1px); transform-origin: 46px 31px; }
.buddy[data-state="worried"] .c-brow-r { transform: rotate(-16deg) translateY(1px); transform-origin: 74px 31px; }
.buddy[data-state="worried"] .c-blush { opacity: .14; }
.buddy[data-state="worried"] .c-figure { animation: shake .42s ease-in-out 2; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* ── zeigt auf etwas ── */
.buddy[data-state="point"] .c-arm-l { transform: rotate(-16deg); transform-origin: 41px 84px; }

/* ── Sprechblase ── */
.buddy-bubble {
  position: relative;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 15px;
  font-size: 13px; line-height: 1.5; color: var(--ink);
  box-shadow: var(--shadow-1); max-width: 260px; text-align: center;
  opacity: 0; transform: translateY(-6px) scale(.96);
  pointer-events: none; transition: opacity .28s, transform .28s;
}
.buddy-bubble.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.buddy-bubble::before {
  content: ''; position: absolute; top: -7px; left: 50%; margin-left: -7px;
  width: 12px; height: 12px; background: var(--paper);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

/* ── Panel in der Sidebar ── */
.buddy-panel {
  background: linear-gradient(168deg, #FFFDF7 0%, #FFF4E2 100%);
  border: 1px solid #F1DFBE; border-radius: var(--r-lg);
  padding: 18px 16px 16px; margin-bottom: 16px;
}
.buddy-panel-title {
  font-size: 11px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: #A87B1C; text-align: center; margin-bottom: 8px;
}

/* ── Cashi im Hero ── */
.hero-cashi {
  width: 190px; height: 200px; margin: 0 auto 4px;
  filter: drop-shadow(0 12px 26px rgba(8,18,34,.28));
}
.hero-cashi .buddy-stage { width: 190px; height: 200px; }
.hero-cashi .buddy-figure { width: 180px; height: 190px; }
.hero-cashi .buddy-bubble {
  background: rgba(255,255,255,.96); border-color: rgba(255,255,255,.5); max-width: 300px;
}

/* ── Cashi als Chat-Avatar ── */
.chat-header .buddy-avatar { width: 52px; height: 54px; flex-shrink: 0; }
.chat-header .buddy-avatar .buddy-bubble { display: none; }
.chat-header .buddy-avatar .buddy-stage { width: 52px; height: 54px; }
.chat-header .buddy-avatar .buddy-figure { width: 52px; height: 54px; cursor: default; }

/* ── schwebend auf Unterseiten ── */
.buddy-float {
  position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 90;
  transform: scale(.86); transform-origin: bottom right;
}
.buddy-float .buddy-bubble { position: absolute; bottom: 106%; inset-inline-end: 0; }

/* ══════════════════ KONTOAUSZUG-UPLOAD ══════════════════ */

.doc-section { margin-top: 28px; }
.doc-section-head { margin-bottom: 16px; }
.doc-section-head h2 { font-size: 22px; font-weight: 800; color: var(--ink); }
.doc-section-head p { font-size: 14px; color: var(--ink-soft); margin-top: 4px; max-width: 640px; }

.doc-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-1);
}

.doc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.doc-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  border-radius: var(--r-sm);
  font-size: 20px;
  flex-shrink: 0;
}
.doc-head h3 { font-size: 17px; font-weight: 800; color: var(--ink); }
.doc-head p { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.doc-badge {
  margin-inline-start: auto;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.doc-badge.on { background: var(--ok-soft); color: var(--ok); border-color: #BFE5D3; }

.doc-drop {
  border: 2px dashed #CFD8E5;
  border-radius: var(--r-md);
  background: var(--paper-2);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .12s;
}
.doc-drop:hover, .doc-drop:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.doc-drop.over { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.01); }
.doc-drop-ico { font-size: 26px; margin-bottom: 6px; }
.doc-drop-text { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.doc-drop-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.doc-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.doc-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  animation: rowIn .25s ease-out;
}
.doc-row.stored { background: var(--ok-soft); border-color: #C9E8D9; }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.doc-row-ico { font-size: 16px; flex-shrink: 0; }
.doc-row-info { flex: 1; min-width: 0; }
.doc-row-name {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-row-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 1px; }
.doc-row-x {
  background: none; border: none; cursor: pointer;
  color: var(--ink-soft); font-size: 15px; line-height: 1;
  padding: 5px 7px; border-radius: 6px; transition: all .15s;
}
.doc-row-x:hover { background: var(--err-soft); color: var(--err); }

.doc-consent {
  margin-top: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.doc-check {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; line-height: 1.5; color: #3D4B60;
  cursor: pointer; margin-bottom: 11px;
}
.doc-check input { width: 17px; height: 17px; margin-top: 1px; flex-shrink: 0; accent-color: var(--brand); cursor: pointer; }
.doc-legal { font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 11px; }

.doc-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.doc-btn { flex: 1; min-width: 200px; }
.doc-btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }

.doc-result {
  margin-top: 14px; padding: 12px 15px;
  border-radius: var(--r-sm); font-size: 13px; line-height: 1.5;
  display: none;
}
.doc-result.show { display: block; animation: rowIn .25s ease-out; }
.doc-result.ok   { background: var(--ok-soft);   color: var(--ok);   border: 1px solid #C9E8D9; }
.doc-result.err  { background: var(--err-soft);  color: var(--err);  border: 1px solid #F3CFCF; }
.doc-result.info { background: var(--paper-2);   color: var(--ink-soft); border: 1px solid var(--line); }

/* ══════════════════ RTL (Arabisch) ══════════════════ */

html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] nav a { margin-left: 0; margin-right: 28px; }
html[dir="rtl"] .doc-check,
html[dir="rtl"] .doc-head,
html[dir="rtl"] .doc-row { flex-direction: row-reverse; }
html[dir="rtl"] .doc-row-name,
html[dir="rtl"] .doc-row-meta,
html[dir="rtl"] .doc-drop-text,
html[dir="rtl"] .doc-legal { text-align: right; }
html[dir="rtl"] .buddy-float { transform-origin: bottom left; }

/* ══════════════════ FEINSCHLIFF ══════════════════ */

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 15%, var(--line) 85%, transparent);
  margin: 34px 0;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.trust-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; gap: 11px; align-items: flex-start;
}
.trust-item .ti-ico { font-size: 17px; line-height: 1.2; }
.trust-item b { font-size: 13px; color: var(--ink); display: block; }
.trust-item span { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }

@media (max-width: 900px) {
  .buddy-float { transform: scale(.7); bottom: 12px; inset-inline-end: 10px; }
  .doc-card { padding: 18px; }
  .doc-btn { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .b-body, .b-eye, .b-dot, .b-cf { animation: none !important; }
  .buddy-bubble, .ring-fill, .doc-row, .doc-result { transition: none; animation: none; }
}
