/* =============================================================
   Gebührenerhebung · Bezirk Ried im Innkreis
   style.css – Modern, hell, große Schrift
   ============================================================= */

:root {
  --brand:       #2563eb;
  --brand-mid:   #3b82f6;
  --brand-light: #60a5fa;
  --brand-dark:  #1d4ed8;
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --surface2: #f4f7fb;
  --surface3: #e8f0fe;
  --border:   #d1dce8;
  --border2:  #b8cde0;
  --text1: #0f1f2e;
  --text2: #334e68;
  --text3: #6b8299;
  --violet:  #7c3aed;
  --teal:    #0891b2;
  --amber:   #d97706;
  --emerald: #059669;
  --rose:    #e11d48;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 2px 16px rgba(37,99,235,0.08);
  --shadow-lg: 0 8px 32px rgba(37,99,235,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text1);
  min-height: 100vh;
}

/* LOADING BAR */
.loading-bar { position: fixed; top: 0; left: 0; width: 0; height: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-light)); z-index: 10000; }
.loading-bar.active { animation: lb 1.2s ease infinite; }
@keyframes lb { 0%{width:10%} 50%{width:70%} 100%{width:90%} }

/* LOGIN */
#loginScreen {
  display: none;
  position: fixed;
  inset: 0;
  background: #111827;
  justify-content: center;
  align-items: center;
  z-index: 500;
}

#loginScreen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 10% 10%, rgba(30,64,175,0.25) 0%, transparent 60%),
    radial-gradient(ellipse 50% 70% at 90% 90%, rgba(29,78,216,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.login-glow { display: none; }

.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  margin: 0 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-top: 3px solid #3b82f6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.login-header-bar { display: none; }

.login-logo {
  padding: 36px 40px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.login-logo .logo-icon-img { display: none; }

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 5px;
  letter-spacing: -0.02em;
}

.login-logo p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.06em;
  font-weight: 500;
}

.login-form-area {
  padding: 28px 40px 36px;
}

.login-error {
  display: none;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  color: #fca5a5;
  padding: 11px 14px;
  font-size: 0.875rem;
  margin-bottom: 18px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #f0f6ff;
  padding: 13px 16px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, background .2s;
}

.form-group input::placeholder { color: rgba(255,255,255,0.18); }

.form-group input:focus {
  border-color: rgba(59,130,246,0.7);
  background: rgba(255,255,255,0.10);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* APP SHELL */
#app { display: none; flex-direction: row; min-height: 100vh; width: 100%; }

/* SIDEBAR */
.sidebar { width: 232px; min-height: 100vh; background: #1e3a5f; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100; box-shadow: 2px 0 20px rgba(0,0,0,0.14); }
.sidebar-logo { padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo-mark { display: flex; align-items: center; gap: 11px; }
.logo-icon-sm { font-size: 1.7rem; }
.logo-mark h2 { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.2; }
.logo-mark p  { font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,0.38); padding: 12px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; border-radius: var(--radius-sm); color: rgba(255,255,255,0.72); padding: 10px 13px; font-size: 0.925rem; font-weight: 500; font-family: inherit; cursor: pointer; text-align: left; transition: all .15s; margin-bottom: 2px; }
.nav-item:hover  { background: rgba(255,255,255,0.10); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #60a5fa; }
.nav-icon { font-size: 1.05rem; width: 22px; text-align: center; }
.sidebar-footer { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-light)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; color: #fff; flex-shrink: 0; }
.user-name  { font-size: 0.92rem; font-weight: 600; color: #fff; }
.user-rolle { font-size: 0.76rem; color: rgba(255,255,255,0.5); margin-top: 1px; }

/* CONTENT */
.content { margin-left: 232px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; width: calc(100% - 232px); background: var(--bg); }
.topbar { position: sticky; top: 0; background: rgba(255,255,255,0.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 15px 30px; display: flex; align-items: center; justify-content: space-between; z-index: 50; box-shadow: 0 1px 8px rgba(0,0,0,0.05); }
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--text1); }
.topbar-actions { display: flex; gap: 8px; }

/* PANELS & CARDS */
.panel { display: none; padding: 28px 30px; flex-direction: column; gap: 22px; }
.panel.active { display: flex; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow); }
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--text1); margin-bottom: 18px; display: flex; align-items: center; gap: 9px; }
.badge { background: var(--surface3); color: var(--brand); font-size: 0.76rem; padding: 3px 9px; border-radius: 99px; font-weight: 700; border: 1px solid rgba(37,99,235,0.2); }

/* SEARCH */
.search-input { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text1); padding: 10px 15px; font-size: 0.95rem; font-family: inherit; outline: none; margin-bottom: 16px; transition: border-color .2s, box-shadow .2s; }
.search-input::placeholder { color: var(--text3); }
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.10); background: #fff; }

/* SELECTS */
select { background: #fff !important; color: var(--text1) !important; }
select option { background: #fff; color: var(--text1); }

/* GEMEINDEN */
.gemeinden-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.gem-btn { display: flex; align-items: center; gap: 7px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text2); padding: 8px 14px; font-size: 0.875rem; font-family: inherit; font-weight: 500; cursor: pointer; transition: all .15s; }
.gem-btn:hover { background: var(--surface3); border-color: var(--brand-light); color: var(--brand); }
.gem-btn.active { background: var(--surface3); border-color: var(--brand); color: var(--brand); font-weight: 700; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.has { background: var(--emerald); }
.dot.no  { background: var(--border2); }

/* FORM SECTIONS – standardmäßig zugeklappt */
.form-section { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; }
.fs-header { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; background: var(--surface2); cursor: pointer; font-size: 0.95rem; font-weight: 600; color: var(--text1); user-select: none; transition: background .15s; }
.fs-header:hover { background: var(--surface3); color: var(--brand); }
.fs-header .chevron { transition: transform .2s; font-size: 1.1rem; color: var(--text3); }
.fs-header.open .chevron { transform: rotate(90deg); color: var(--brand); }
.fs-body { padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 14px; background: #fff; }
.fs-body.hidden { display: none; }
.fg { flex: 1 1 260px; min-width: 200px; }
.fg label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.fg input, .fg select, .fg textarea { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text1); padding: 9px 12px; font-size: 0.95rem; font-family: inherit; outline: none; resize: vertical; transition: border-color .2s, box-shadow .2s; }
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.10); background: #fff; }
.fg select option { background: #fff; color: var(--text1); }
.fg input::placeholder, .fg textarea::placeholder { color: var(--text3); }

/* TABLE */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { position: sticky; top: 0; z-index: 2; }
th { background: var(--surface2); padding: 11px 12px; text-align: left; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); white-space: nowrap; border-bottom: 2px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text2); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); color: var(--text1); }
.v-ja   { color: var(--emerald); font-weight: 700; }
.v-nein { color: var(--rose);    font-weight: 700; }
.v-empty{ color: var(--border2); }

/* VERGLEICH */
.vgl-controls { display: flex; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.vgl-controls > div { flex: 1; min-width: 220px; }
.ms-box { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ms-hdr { background: var(--surface2); padding: 9px 14px; font-size: 0.78rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.ms-body { max-height: 240px; overflow-y: auto; padding: 6px 0; }
.ms-item { display: flex; align-items: center; gap: 9px; padding: 7px 16px; font-size: 0.9rem; color: var(--text2); cursor: pointer; transition: background .1s; }
.ms-item:hover { background: var(--surface2); color: var(--text1); }
.ms-item input[type=checkbox] { accent-color: var(--brand); width: 15px; height: 15px; }

/* AUSWERTUNG */
.stats-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 150px; padding: 22px; border-radius: var(--radius); text-align: center; border: none; box-shadow: var(--shadow); }
.stat-card.violet  { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-card.teal    { background: linear-gradient(135deg, #0284c7, #0891b2); }
.stat-card.amber   { background: linear-gradient(135deg, #b45309, #d97706); }
.stat-card.emerald { background: linear-gradient(135deg, #047857, #059669); }
.stat-val   { font-size: 2.4rem; font-weight: 800; color: #fff; }
.stat-label { font-size: 0.875rem; color: rgba(255,255,255,.85); margin-top: 5px; font-weight: 500; }
.bar-chart { display: flex; flex-direction: column; gap: 9px; }
.bar-row   { display: flex; align-items: center; gap: 14px; }
.bar-label { width: 190px; font-size: 0.875rem; color: var(--text2); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: var(--surface2); border-radius: 5px; height: 26px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill  { height: 100%; border-radius: 5px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; min-width: 36px; transition: width .4s ease; }
.bar-val   { font-size: 0.78rem; font-weight: 700; color: rgba(255,255,255,.95); }
.donut-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.donut-card { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 18px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.donut-title { font-size: 0.9rem; font-weight: 600; color: var(--text1); margin-bottom: 7px; }
.donut-stat  { display: flex; flex-direction: column; gap: 5px; }
.donut-row   { display: flex; align-items: center; gap: 7px; font-size: 0.875rem; color: var(--text2); }
.donut-dot   { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-info  { flex: 1; }


/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: var(--radius-sm); font-family: inherit; font-weight: 600; cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; }
.btn-violet { background: linear-gradient(135deg,#1d4ed8,#2563eb); color: #fff; font-size: 1rem; padding: 13px 20px; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-violet:hover { background: linear-gradient(135deg,#1e40af,#1d4ed8); box-shadow: 0 6px 16px rgba(37,99,235,0.4); transform: translateY(-1px); }
.btn-violet:active { transform: translateY(0); }
.btn-violet:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-ghost { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75); border: 1px solid rgba(255,255,255,0.15); font-size: 0.875rem; padding: 9px 16px; }
.btn-ghost:hover { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.25); }
.btn-teal  { background: linear-gradient(135deg,var(--teal),#0891b2); color: #fff; font-size: 0.875rem; padding: 9px 16px; box-shadow: 0 2px 8px rgba(20,184,166,0.25); }
.btn-teal:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-rose  { background: linear-gradient(135deg,#f43f5e,#dc2626); color: #fff; font-size: 0.875rem; padding: 9px 16px; box-shadow: 0 2px 8px rgba(244,63,94,0.25); }
.btn-rose:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-sm  { font-size: 0.82rem !important; padding: 7px 13px !important; }
.btn-xs  { font-size: 0.75rem !important; padding: 4px 9px !important; }

/* In der Sidebar: ghost buttons heller */
.sidebar .btn-ghost { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.7); border: 1px solid rgba(255,255,255,0.12); font-size: 0.82rem; padding: 8px 12px; width: 100%; margin-bottom: 6px; }
.sidebar .btn-ghost:hover { background: rgba(255,255,255,0.13); color: #fff; }

/* BADGE */
.badge { display: inline-flex; align-items: center; background: var(--surface3); border: 1px solid var(--border2); color: var(--text2); font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; }


/* CHAT */
#chatMessages::-webkit-scrollbar { width: 5px; }
#chatMessages::-webkit-scrollbar-track { background: var(--surface2); }
#chatMessages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
#chatInput:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* TOAST */
.toast { position: fixed; bottom: 24px; right: 24px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--emerald); color: var(--text1); padding: 13px 20px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .25s, transform .25s; z-index: 9999; max-width: 340px; }
.toast.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.toast.err  { border-left-color: var(--rose); }

/* SPINNER */
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* PASSWORT MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,31,46,0.5); backdrop-filter: blur(4px); justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 30px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.modal-box h3 { font-size: 1.1rem; font-weight: 700; color: var(--text1); margin-bottom: 20px; }
.modal-input { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text1); padding: 10px 13px; font-size: 0.95rem; font-family: inherit; outline: none; margin-bottom: 12px; transition: border-color .2s; }
.modal-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,0.10); }
.modal-err { display: none; color: var(--rose); font-size: 0.875rem; margin-bottom: 12px; padding: 8px 12px; background: #fef2f2; border-radius: var(--radius-sm); }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }

/* GEMNET PANEL */
.json-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.json-item { display: flex; align-items: center; justify-content: space-between; background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 13px 16px; cursor: pointer; transition: all .15s; }
.json-item:hover { background: var(--surface3); border-color: var(--brand-light); }
.json-item.active { background: var(--surface3); border-color: var(--brand); }
.json-item-name { font-size: 0.95rem; font-weight: 600; color: var(--text1); }
.json-item-meta { font-size: 0.8rem; color: var(--text3); margin-top: 2px; }
.gemnet-links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.gemnet-link-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: background .15s; }
.gemnet-link-item:hover { background: var(--surface3); }
.gemnet-link-item a { color: var(--brand); font-size: 0.9rem; font-weight: 500; text-decoration: none; flex: 1; }
.gemnet-link-item a:hover { text-decoration: underline; }
.gemnet-tag { font-size: 0.75rem; color: var(--text3); background: var(--surface3); border: 1px solid var(--border); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.upload-area { border: 2px dashed var(--border2); border-radius: var(--radius-sm); padding: 28px; text-align: center; transition: border-color .2s, background .2s; }
.upload-area:hover { border-color: var(--brand-light); background: var(--surface3); }
.upload-area .upload-icon { font-size: 2.5rem; margin-bottom: 10px; }
.upload-area p { color: var(--text2); font-size: 0.95rem; margin-bottom: 14px; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-height: auto; position: relative; }
  .content { margin-left: 0; width: 100%; }
  .bar-label { width: 110px; }
  .panel { padding: 18px 16px; }
}