/* ============================================================
   Račun Savetnik – Style
   Aesthetic: Dark editorial / refined utility
   Font pairing: Sora (display) + DM Sans (body)
   ============================================================ */

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

:root {
  --bg:         #0d0f14;
  --bg-card:    #14171f;
  --bg-elevated:#1c2030;
  --border:     #252a38;
  --border-lit: #333c55;

  --text:       #e8eaf2;
  --text-muted: #7a8099;
  --text-faint: #3d4460;

  --accent:     #f0c040;        /* amber gold */
  --accent-dim: #a07c10;
  --green:      #2ecc71;
  --red:        #e74c3c;
  --orange:     #e67e22;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;

  --shadow:     0 4px 24px rgba(0,0,0,.45);
  --shadow-sm:  0 2px 8px  rgba(0,0,0,.3);

  --font-display: 'Sora', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --max-w: 1080px;
  --nav-h: 64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Nav -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(13,15,20,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: -.01em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: .9rem;
}

.nav-links a { color: var(--text-muted); transition: color .15s; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-user { color: var(--text-muted); font-size: .85rem; }

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0d0f14;
  font-weight: 700;
}
.btn-primary:hover { background: #f5d060; text-decoration: none; color: #0d0f14; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-lit);
}
.btn-ghost:hover { border-color: var(--text-muted); text-decoration: none; }

.btn-full { width: 100%; justify-content: center; padding: 14px; font-size: 1rem; }

.btn-nav-logout {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  transition: all .15s;
}
.btn-nav-logout:hover { color: var(--red); border-color: var(--red); }

.btn-nav-register {
  background: var(--accent);
  color: #0d0f14 !important;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.btn-nav-register:hover { text-decoration: none; background: #f5d060; }

/* ---- Alerts ----------------------------------------------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: .9rem;
  border-left: 3px solid;
}
.alert-success { background: rgba(46,204,113,.1); border-color: var(--green); color: #a8ffc9; }
.alert-error   { background: rgba(231,76,60,.1);  border-color: var(--red);   color: #ffb3ae; }

/* ---- Forms ------------------------------------------------ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.label-hint { font-weight: 400; font-style: italic; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: .95rem;
  transition: border-color .15s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group select { cursor: pointer; }
.form-group textarea { resize: vertical; min-height: 100px; }

/* ---- Footer ----------------------------------------------- */
.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 28px;
  font-size: .8rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing { max-width: var(--max-w); margin: 0 auto; padding: 60px 24px 80px; }

.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero-badge {
  display: inline-block;
  background: rgba(240,192,64,.12);
  color: var(--accent);
  border: 1px solid rgba(240,192,64,.3);
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin-bottom: 22px;
}

.accent { color: var(--accent); }

.hero-sub {
  max-width: 560px;
  margin: 0 auto 36px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 60px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color .2s, transform .2s;
}
.feature-card:hover { border-color: var(--border-lit); transform: translateY(-2px); }

.feature-icon { font-size: 2rem; margin-bottom: 14px; }
.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.feature-card p { color: var(--text-muted); font-size: .9rem; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-size: 2.4rem;
  text-align: center;
  margin-bottom: 8px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}

.auth-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 28px;
}

.auth-form { margin-top: 8px; }

.auth-switch {
  text-align: center;
  margin-top: 22px;
  font-size: .875rem;
  color: var(--text-muted);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard { max-width: var(--max-w); margin: 0 auto; padding: 40px 24px 80px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
}

.stat-total {
  border-color: var(--accent-dim);
  background: rgba(240,192,64,.05);
}

.stat-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
}
.stat-total .stat-value { color: var(--accent); }

/* Bar chart */
.chart-section { margin-bottom: 40px; }

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 0;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: .85;
  transition: opacity .15s;
  min-height: 4px;
}
.bar-fill:hover { opacity: 1; }

.bar-label {
  font-size: .72rem;
  color: var(--text-muted);
  padding-bottom: 8px;
  white-space: nowrap;
}

/* Bills list */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bills-list { display: flex; flex-direction: column; gap: 10px; }

.bill-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .1s;
}
.bill-card:hover { border-color: var(--border-lit); transform: translateX(2px); text-decoration: none; }

.bill-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.bill-electricity { background: rgba(240,192,64,.12); border-color: rgba(240,192,64,.3); color: var(--accent); }
.bill-mobile      { background: rgba(52,152,219,.12); border-color: rgba(52,152,219,.3); color: #74bef5; }
.bill-internet    { background: rgba(46,204,113,.12); border-color: rgba(46,204,113,.3); color: #7ef5ac; }
.bill-water       { background: rgba(52,152,219,.12); border-color: rgba(52,152,219,.3); color: #74c4f5; }
.bill-gas         { background: rgba(231,76,60,.12);  border-color: rgba(231,76,60,.3);  color: #f5a09a; }
.bill-other       { background: var(--bg-elevated); }

.bill-meta { flex: 1; min-width: 0; }
.bill-name { font-weight: 500; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-date { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

.bill-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bill-amount { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.bill-warning { font-size: .78rem; color: var(--orange); font-weight: 600; }
.bill-ok      { font-size: .78rem; color: var(--green); font-weight: 600; }
.bill-pending { font-size: .78rem; color: var(--text-muted); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-lit);
  border-radius: var(--radius);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); margin-bottom: 24px; }

/* ============================================================
   UPLOAD PAGE
   ============================================================ */
.upload-wrap {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px 80px;
}

.upload-card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: var(--shadow);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.page-sub { color: var(--text-muted); font-size: .875rem; margin-bottom: 28px; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border-lit);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  margin-bottom: 22px;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.drop-zone.drag-over { border-color: var(--accent); background: rgba(240,192,64,.05); }

.drop-icon { font-size: 2.5rem; margin-bottom: 10px; }
.drop-text { color: var(--text-muted); margin-bottom: 14px; font-size: .9rem; }
.drop-input { display: none; }
.drop-filename { margin-top: 10px; color: var(--accent); font-size: .85rem; font-weight: 500; }

/* ============================================================
   BILL DETAIL PAGE
   ============================================================ */
.bill-detail { max-width: 820px; margin: 0 auto; padding: 40px 24px 80px; }

.breadcrumb {
  margin-bottom: 24px;
  font-size: .875rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }

.bill-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.bill-total-badge {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

/* AI Section */
.ai-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
}

.ai-result { }

.ai-header { margin-bottom: 20px; }
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(240,192,64,.1);
  border: 1px solid rgba(240,192,64,.25);
  color: var(--accent);
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.ai-summary {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text);
  border-left: 3px solid var(--accent);
}

.ai-overpayment {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(231,76,60,.08);
  border: 1px solid rgba(231,76,60,.2);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
}
.overpayment-label { font-size: .85rem; color: var(--text-muted); }
.overpayment-value { font-weight: 700; color: #ffb3ae; }

.ai-items h3 {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.items-grid { display: grid; gap: 10px; }

.item-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.item-suspicious {
  border-color: rgba(231,76,60,.4);
  background: rgba(231,76,60,.05);
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.item-name   { font-weight: 600; font-size: .95rem; }
.item-amount { font-family: var(--font-display); font-weight: 700; white-space: nowrap; color: var(--accent); }
.item-explanation { font-size: .875rem; color: var(--text-muted); }
.item-flag {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--red);
  font-weight: 600;
}

/* Loading spinner */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ai-placeholder { text-align: center; padding: 24px 0; }
.ai-placeholder p { color: var(--text-muted); margin-bottom: 18px; }

/* Raw text */
.raw-text-details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-top: 16px;
  overflow: hidden;
}
.raw-text-details summary {
  padding: 14px 20px;
  cursor: pointer;
  font-size: .875rem;
  color: var(--text-muted);
  user-select: none;
}
.raw-text-details summary:hover { color: var(--text); }
.raw-text {
  padding: 16px 20px 20px;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid var(--border);
  max-height: 300px;
  overflow-y: auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .site-header { padding: 0 16px; }
  .nav-links { gap: 14px; }
  .nav-user { display: none; }
  .auth-card, .upload-card { padding: 32px 22px; }
  .bill-header { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   METER PAGE - Ocitavanje brojila
   ============================================================ */
.meter-wrap { max-width: 820px; margin: 0 auto; padding: 40px 24px 80px; }

.meter-header { margin-bottom: 32px; }

.meter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
}

/* Meter type selector */
.meter-type-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.meter-type-option { cursor: pointer; }
.meter-type-option input[type="radio"] { display: none; }

.meter-type-btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--border-lit);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
  background: var(--bg-elevated);
  color: var(--text-muted);
  user-select: none;
}

.meter-type-option input:checked + .meter-type-btn {
  border-color: var(--accent);
  background: rgba(240,192,64,.1);
  color: var(--accent);
  font-weight: 600;
}

/* Upload zones */
.meter-uploads {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin: 24px 0;
}

.meter-upload-arrow {
  font-size: 1.8rem;
  color: var(--accent);
  text-align: center;
  font-weight: 700;
}

.meter-upload-zone {
  background: var(--bg-elevated);
  border: 2px dashed var(--border-lit);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  transition: border-color .15s;
}

.meter-upload-zone:hover { border-color: var(--accent); }

.meter-upload-zone .drop-icon { font-size: 2rem; margin-bottom: 8px; }
.meter-upload-zone .drop-text { font-size: .9rem; font-weight: 500; margin-bottom: 4px; }
.meter-upload-zone .drop-text-sub { font-size: .78rem; color: var(--text-muted); margin-bottom: 12px; }
.meter-upload-zone .drop-btn { font-size: .8rem; padding: 7px 14px; }
.meter-upload-zone .drop-input { display: none; }
.meter-upload-zone .drop-filename { font-size: .78rem; color: var(--accent); margin-top: 8px; }

.meter-preview-wrap { margin-top: 10px; }
.meter-preview {
  display: none;
  max-width: 100%;
  max-height: 140px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  border: 1px solid var(--border);
}

.meter-tip {
  background: rgba(240,192,64,.06);
  border: 1px solid rgba(240,192,64,.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Result */
.meter-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.meter-result-header { margin-bottom: 28px; }

.meter-readings-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.reading-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.reading-box-curr {
  border-color: var(--accent-dim);
  background: rgba(240,192,64,.05);
}

.reading-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 10px; font-weight: 600; }
.reading-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.reading-unit  { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.reading-arrow { font-size: 1.8rem; color: var(--accent); text-align: center; font-weight: 700; }

.meter-consumption {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.consumption-label { font-size: .85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.consumption-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--text); }

.meter-estimate {
  background: rgba(240,192,64,.07);
  border: 1px solid rgba(240,192,64,.25);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.estimate-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; font-weight: 600; }
.estimate-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--accent); }
.estimate-note  { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

.meter-notes {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: .875rem;
  color: var(--text-muted);
  border-left: 3px solid var(--border-lit);
}

@media (max-width: 600px) {
  .meter-uploads { grid-template-columns: 1fr; }
  .meter-readings-row { grid-template-columns: 1fr; }
  .meter-upload-arrow, .reading-arrow { display: none; }
}
