/* public/styles.css */

/* ===== ZÁKLADNÍ PROMĚNNÉ – DARK ===== */
:root{
  --bg: #0b1220;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.12);
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #22d3ee;   /* cyan */
  --accent-2: #a78bfa; /* violet */
}

/* ===== LIGHT THEME OVERRIDES ===== */
html[data-theme="light"]{
  --bg: #f6f7fb;
  --card: rgba(0,0,0,0.04);
  --border: rgba(0,0,0,0.12);
  --text: #0f172a;
  --muted: #475569;
  --accent: #0ea5e9;
  --accent-2: #7c3aed;
}

* { box-sizing: border-box; }
html, body { 
  height: 100vh; 
  background-color: var(--bg);
  background: var(--bg);
  margin: 0;
  padding: 0;
  overflow: hidden; 
  touch-action: none;
}

/* body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);

  background:
    radial-gradient(1200px 1200px at 20% -10%, #111827 0%, transparent 70%),
    radial-gradient(1400px 1200px at 110% 30%, #0ea5e9 0%, transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg));
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 1000px;

  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
} */

body{
  margin: 0;
  padding-top: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);               /* základní barva pod gradientem */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;                  /* kvůli stacking contextu pro ::before */
}

/* Fixní gradientové pozadí přes celou obrazovku – neovlivňuje layout */
body::before{
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;

  /* pokryje viditelnou výšku + spodní safe-area (iOS home-indicator) */
  height: calc(100dvh + env(safe-area-inset-bottom));

  /* gradient – zpět ten „hezký přechod“ */
  background:
    radial-gradient(1200px 1200px at 20% -10%, var(--bg) 0%, transparent 70%),
    radial-gradient(1400px 1200px at 110% 30%, #0ea5e9 0%, transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg));
  background-repeat: no-repeat;

  /* pod obsahem, ale nad základní barvou body */
  z-index: 0;
  pointer-events: none;
}

html[data-theme="light"] body{
  background: linear-gradient(160deg, var(--bg), var(--bg));
  height: 100%;
}

#app{
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 28px);
  display: grid;
  gap: 18px;
  align-content: center;
  min-height: 100dvh;
  position: relative; 
  z-index: 1;
}

/* ===== TOP BAR ===== */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand .logo{
  width: 48px; height: 48px;
  border-radius: 12px;
  background:
    radial-gradient(100px 80px at 20% 10%, rgba(255,255,255,.2), transparent 60%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.15),
    0 10px 30px rgba(0,0,0,.25);
}
.brand-text h1{
  margin: 0 0 4px 0;
  font-size: clamp(20px, 4vw, 24px);
  letter-spacing: .3px;
}
.subtitle{ margin:0; color:var(--muted); font-size:13px; }

.theme-toggle{
  appearance:none;
  border:1px solid var(--border);
  background: var(--card);
  color: var(--text);
  width:44px; height:44px; border-radius:12px;
  display:grid; place-items:center; cursor:pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.06);
  transition: transform .06s ease, background .2s ease;
}
.theme-toggle:active{ transform: translateY(1px); }
.theme-toggle .icon{ position:absolute; opacity:0; transition:opacity .15s ease; }
html[data-theme="light"] .theme-toggle .sun{ opacity:1; position:static; }
html[data-theme="dark"]  .theme-toggle .moon{ opacity:1; position:static; }

/* ===== STATS ===== */
.stats{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.stat-card{
  backdrop-filter: blur(12px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 16px 40px rgba(0,0,0,.25);
}
.stat-label{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-value{
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 800;
  line-height: 1.2;
}

/* ===== CARD & FORM ===== */
.card{
  backdrop-filter: blur(12px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 20px 60px rgba(0,0,0,.35);
}

.input-wrap{
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow:
    inset 0 25px 50px -20px rgba(50,50,93,.25),
    inset 0 -2px 6px 0 rgba(10,37,64,.35);
}
html[data-theme="light"] .input-wrap{ background: rgba(0,0,0,.03); }

.currency{
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .5px;
}

input#amount{
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: clamp(22px, 5vw, 28px);
  font-variant-numeric: tabular-nums;
}

.primary{
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 16px;
  color: #071219;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    0 10px 20px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.25);
  cursor: pointer;
  transition: transform .06s ease, filter .2s;
}
.primary:active{ transform: translateY(1px); filter: brightness(.98); }

.status{ min-height: 20px; margin: 10px 2px 0 2px; color: var(--muted); font-size: 14px; }
.hint{ margin-top: 14px; font-size: 14px; color: var(--muted); text-align: center; }
footer{ text-align: center; color: var(--muted); font-size: 12px; opacity: .9; }

.visually-hidden{
  position: absolute !important;
  width: 1px; height: 1px; padding:0; margin:-1px; overflow:hidden; clip: rect(0,0,0,0); white-space:nowrap; border:0;
}

/* Zmírnění double-tap zoomu */
button, input { touch-action: manipulation; }

@media (max-width: 460px){
  .stats{ grid-template-columns: 1fr; }
}

/* Kategorie – chipy */
.categories{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px 0;
}
.cat-btn{
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .06s ease, background .2s ease, border-color .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
html[data-theme="light"] .cat-btn{ background: rgba(0,0,0,.04); }
.cat-btn:active{ transform: translateY(1px); }
.cat-btn.selected{
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071219;
  font-weight: 700;
}

.theme-toggle { position: relative; }
.user-badge{
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}
