@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #fbfbfe;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow2: 0 6px 18px rgba(15, 23, 42, 0.06);
  --radius: 18px;
  --gap: 14px;

  --accent: #4f46e5;
  --accentSoft: rgba(79, 70, 229, 0.10);
  --danger: #dc2626;
  --dangerSoft: rgba(220, 38, 38, 0.10);
  --ok: #16a34a;
  --okSoft: rgba(22, 163, 74, 0.10);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% 10%, rgba(79,70,229,0.12), transparent 60%),
    radial-gradient(900px 650px at 90% 15%, rgba(34,197,94,0.10), transparent 60%),
    var(--bg);
}

.container{
  width: min(1250px, 94vw);
  margin: 18px auto 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
}

.brand{
  display:flex;
  gap: 12px;
  align-items:center;
}
.brand-dot{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accentSoft);
}
.brand-title{
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-subtitle{
  font-size: 12px;
  color: var(--muted);
}

.controls{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.controls label{
  font-size: 12px;
  color: var(--muted);
}

select{
  appearance: none;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
select:focus{
  border-color: rgba(79,70,229,0.45);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.10);
}

button, .logout-btn{
  cursor: pointer;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
  text-decoration: none;
  display:inline-flex;
  align-items:center;
  gap: 8px;
}
button:hover, .logout-btn:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow2);
  border-color: #cbd5e1;
}
.btn-ghost{
  background: transparent;
}

/* ✅ výraznější tlačítko pro odečet */
.btn-accent{
  border-color: rgba(79,70,229,0.45);
  background: var(--accentSoft);
}
.btn-accent:hover{
  background: rgba(79,70,229,0.14);
}

.spacer{
  flex: 1;
}

/* Panels */
.panel{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  padding: 14px 16px;
}

.panel-header{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-header h2{
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.panel-hint{
  color: var(--muted);
  font-size: 12px;
}
.panel-actions{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}

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

/* Alerts */
.alerts{
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.alert-item{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.alert-left{
  display:flex;
  flex-direction: column;
  gap: 2px;
}
.alert-title{
  font-weight: 700;
  font-size: 13px;
}
.alert-sub{
  font-size: 12px;
  color: var(--muted);
}
.badge{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}
.badge-danger{
  border-color: rgba(220,38,38,0.35);
  background: var(--dangerSoft);
  color: var(--danger);
}
.badge-ok{
  border-color: rgba(22,163,74,0.35);
  background: var(--okSoft);
  color: var(--ok);
}

/* Hive grid */
.hive-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}

.hive-card{
  grid-column: span 4;
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow2);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.hive-card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}

.hive-top{
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.hive-name{
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hive-last{
  color: var(--muted);
  font-size: 12px;
}

.hive-metrics{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.kpi{
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
}
.kpi-label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi-value{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.kpi-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.status-row{
  margin-top: 10px;
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Detail */
.detail-metrics{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  margin-bottom: 12px;
}
.metric-card{
  grid-column: span 3;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow2);
}
.metric-label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.metric-value{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.metric-sub{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.charts-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
.chart-box{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  padding: 12px 12px 6px 12px;
}
.chart-title{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.chart-box canvas{
  width: 100% !important;
  height: 320px !important;
}
.chart-placeholder{
  visibility: hidden;
  pointer-events: none;
}
.selection-status{
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 1050px){
  .hive-card{ grid-column: span 6; }
  .metric-card{ grid-column: span 6; }
}
@media (max-width: 700px){
  .hive-card{ grid-column: span 12; }
  .charts-grid{ grid-template-columns: 1fr; }
  .metric-card{ grid-column: span 12; }
}

/* --- Weather strip in hive cards (Meteoblue basic-day) --- */
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.wx-tile{
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.wx-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.wx-label{
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wx-updated{
  font-size: 11px;
  color: var(--muted);
}

.wx-rows{
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.wx-row{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
}

.wx-day{
  width: 54px;
  font-weight: 800;
  font-size: 12px;
  color: var(--text);
}

.wx-icon{
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.wx-metrics{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items:center;
}

.wx-metric{
  display:flex;
  align-items:center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

.wx-metric b{
  font-weight: 800;
}

.wx-mini{
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

@media (max-width: 680px){
  .wx-day{ width: 48px; }
  .wx-row{ padding: 9px 9px; }
  .wx-metrics{ gap: 8px; }
}

/* ===== App background (after login) ===== */
.app-body{
  position: relative;
}

/* blurred / lightened background image behind the whole app */
.app-body::before{
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.78), rgba(248, 250, 252, 0.70)),
    url("/static/img/app_bg.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(4px) saturate(1.05) brightness(1.02);
  transform: scale(1.06); /* avoids blurred edges */
  z-index: -2;
}

/* keep content above background */
.app-body .container{
  position: relative;
  z-index: 1;
}

/* ===== Settings (hives) ===== */
.settings-actions{
  display:flex;
  gap:10px;
  padding: 10px 0 14px;
}
.settings-actions .btn-secondary{
  opacity:.9;
}
.table-wrap{
  overflow:auto;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.75);
}
.settings-table{
  width:100%;
  border-collapse: collapse;
  min-width: 880px;
}
.settings-table thead th{
  text-align:left;
  font-size: 12px;
  letter-spacing: .02em;
  opacity:.8;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  white-space: nowrap;
}
.settings-table tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  vertical-align: middle;
}
.settings-table tbody tr:hover{
  background: rgba(255,255,255,.55);
}
.inp{
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.85);
  font: inherit;
}
.inp:focus{
  outline: none;
  border-color: rgba(0,0,0,.25);
}
.inp-id{ max-width: 120px; }
.inp-sort{ max-width: 90px; }
.td-center{ text-align:center; }
.td-actions{ white-space:nowrap; }
.td-actions button{
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.85);
  cursor:pointer;
}
.td-actions button:hover{
  filter: brightness(0.98);
}
.td-loading{
  padding: 22px 12px;
  opacity:.8;
}
.panel-footer-hint{
  padding-top: 10px;
  opacity: .75;
  font-size: 13px;
}


/* ===== Admin (Settings) toolbar ===== */
.admin-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin: 10px 0 14px 0;
  flex-wrap:wrap;
}
.admin-toolbar-left{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.admin-status{
  font-size: 0.95rem;
  opacity: .85;
}
.admin-status[data-kind="error"]{ opacity: 1; font-weight: 700; }
.admin-status[data-kind="ok"]{ opacity: 1; font-weight: 700; }
.admin-center{ text-align:center; }
.admin-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.admin-input{
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.85);
  outline: none;
}
.admin-input:focus{
  border-color: rgba(0,0,0,0.25);
}
