/* Hydroponie 2026 — PHP web styly */

:root {
  --green: #27ae60;
  --green-dark: #16a085;
  --orange: #e67e22;
  --purple: #8e44ad;
  --red: #e74c3c;
  --yellow: #f39c12;
  --blue: #3498db;
  --gray: #7f8c8d;
  --gray-light: #ecf0f1;
  --bg: #fbfcfc;
  --text: #2c3e50;
  --border: #bdc3c7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === HEADER === */
.site-header {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  padding: 14px 0;
  border-bottom: 4px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  color: white;
  text-decoration: none;
  font-size: 20px;
  font-weight: bold;
  white-space: nowrap;
}
.logo .year {
  opacity: 0.7;
  font-size: 14px;
  font-weight: normal;
}
.nav-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.main-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.nav-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.65;
  padding: 4px 10px 4px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  margin-right: 6px;
  white-space: nowrap;
}
.nav-bylinky .nav-label { color: #ffd9a8; opacity: 0.9; }
.main-nav a {
  color: white;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 18px;
  transition: background 0.15s;
  font-size: 13px;
  white-space: nowrap;
}
.main-nav a:hover { background: rgba(255, 255, 255, 0.15); }
.main-nav a.active { background: rgba(255, 255, 255, 0.25); font-weight: bold; }
.nav-bylinky a:hover { background: rgba(255, 255, 255, 0.25); }
.nav-bylinky a.active { background: rgba(255, 255, 255, 0.4); }
.logout {
  color: white;
  text-decoration: none;
  padding: 6px 10px;
  opacity: 0.7;
}
.logout:hover { opacity: 1; }
.user-info {
  color: white;
  font-size: 13px;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.12s;
}
.user-info:hover {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
  color: white;
  text-decoration: none;
}

/* === Knihovna === */
.lib-header { margin-bottom: 16px; }
.lib-header h1 { margin-bottom: 4px; }

.lib-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 247, 250, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin: 0 -20px 24px -20px;
  padding: 12px 20px;
  border-bottom: 1px solid #e0e6ed;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.lib-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 280px;
}
.lib-tab {
  --tab-color: #7f8c8d;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #e0e6ed;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  color: #2c3e50;
  transition: all 0.12s ease;
  cursor: pointer;
}
.lib-tab:hover {
  border-color: var(--tab-color);
  color: var(--tab-color);
  text-decoration: none;
  transform: translateY(-1px);
}
.lib-tab.active {
  background: var(--tab-color);
  border-color: var(--tab-color);
  color: white;
}
.lib-tab.lib-tab-all { --tab-color: #27ae60; }
.lib-tab-icon { font-size: 14px; }
.lib-tab-count {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.lib-tab.active .lib-tab-count {
  background: rgba(255, 255, 255, 0.25);
}

.lib-search-wrap {
  position: relative;
  min-width: 200px;
  flex-shrink: 0;
}
.lib-search {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid #e0e6ed;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  font-family: inherit;
}
.lib-search:focus {
  outline: none;
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.15);
}
.lib-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 18px;
  color: #95a5a6;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
}
.lib-search-clear:hover { background: #f4f6f8; color: #2c3e50; }
.lib-search:placeholder-shown ~ .lib-search-clear { display: none; }

.lib-section { margin-bottom: 32px; scroll-margin-top: 80px; }
.lib-section-head {
  --section-color: #27ae60;
  border-left: 4px solid var(--section-color);
  padding-left: 12px;
  margin-bottom: 14px;
}
.lib-section-head h2 {
  font-size: 18px;
  margin: 0 0 4px 0;
  color: var(--section-color);
}
.lib-section-count {
  font-size: 13px;
  color: #95a5a6;
  font-weight: normal;
}
.lib-section-desc {
  font-size: 13px;
  color: #7f8c8d;
  margin: 0;
}

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.lib-card {
  --section-color: #27ae60;
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid #e0e6ed;
  border-left: 3px solid var(--section-color);
  border-radius: 6px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.lib-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--section-color);
  color: inherit;
  text-decoration: none;
}
.lib-card-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.lib-card-body {
  flex: 1;
  min-width: 0;
}
.lib-card-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  color: #2c3e50;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: #95a5a6;
}
.lib-card-path {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}
.lib-card-size {
  flex-shrink: 0;
  background: #f4f6f8;
  padding: 1px 6px;
  border-radius: 3px;
}

.lib-no-results {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border: 1px dashed #e0e6ed;
  border-radius: 8px;
}

.lib-back-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #27ae60;
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
  z-index: 100;
  transition: transform 0.12s ease;
}
.lib-back-top:hover { transform: translateY(-2px); }

@media (max-width: 600px) {
  .lib-toolbar { flex-direction: column; align-items: stretch; }
  .lib-search-wrap { min-width: 100%; }
}

/* === Sunlight mode (high contrast pro práci venku na slunci) === */
.sun-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 8px;
}
.sun-btn:hover { background: rgba(255, 255, 255, 0.15); }

body.sunlight {
  background: #fff !important;
  color: #000 !important;
}
body.sunlight .site-header {
  background: #000 !important;
  border-bottom: 3px solid #000;
}
body.sunlight .card,
body.sunlight table,
body.sunlight .lib-card,
body.sunlight section,
body.sunlight form {
  background: #fff !important;
  border-color: #000 !important;
  color: #000 !important;
}
body.sunlight .muted,
body.sunlight .lib-card-meta,
body.sunlight .lib-card-path,
body.sunlight small {
  color: #000 !important;
  opacity: 0.85;
}
body.sunlight input,
body.sunlight select,
body.sunlight textarea {
  border: 2px solid #000 !important;
  font-size: 16px !important;
  color: #000 !important;
  background: #fff !important;
}
body.sunlight button,
body.sunlight .btn {
  border: 2px solid #000 !important;
  background: #fff !important;
  color: #000 !important;
  font-weight: bold;
}
body.sunlight .badge,
body.sunlight .alert {
  border: 1px solid #000 !important;
  font-weight: bold;
}
body.sunlight a { color: #0033cc !important; text-decoration: underline; }
/* Header v sunlight modu: bílý text na černém pozadí, ne modrý link */
body.sunlight .site-header a,
body.sunlight .site-header .logo,
body.sunlight .site-header .user-info,
body.sunlight .site-header .logout,
body.sunlight .main-nav a {
  color: #fff !important;
  text-decoration: none !important;
}
body.sunlight .main-nav a.active {
  background: #fff !important;
  color: #000 !important;
}
body.sunlight .nav-label { color: #fff !important; opacity: 1 !important; border-color: rgba(255,255,255,0.4) !important; }

/* === Počasí widget === */
.weather-widget {
  background: linear-gradient(135deg, #74b9ff, #a4cef9);
  color: #2c3e50;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(116, 185, 255, 0.25);
}
.weather-widget.weather-stub {
  background: #f4f6f8;
  color: inherit;
  box-shadow: none;
  border: 1px dashed #bdc3c7;
}
.weather-current {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.weather-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.weather-icon svg { display: block; }
.weather-main {
  flex: 1;
  min-width: 200px;
}
.weather-temp {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.weather-desc {
  font-size: 16px;
  text-transform: capitalize;
  margin: 4px 0;
}
.weather-meta {
  font-size: 13px;
  opacity: 0.9;
}
.weather-forecast {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.weather-hour {
  text-align: center;
  background: rgba(255, 255, 255, 0.45);
  padding: 6px 8px;
  border-radius: 6px;
  min-width: 56px;
}
.weather-hour small {
  display: block;
  font-size: 10px;
  margin-bottom: 2px;
}
.weather-alerts {
  margin-top: 10px;
}
@media (max-width: 600px) {
  .weather-current { gap: 10px; }
  .weather-icon { width: 60px; height: 60px; }
  .weather-temp { font-size: 28px; }
  .weather-forecast { width: 100%; justify-content: space-between; }
  .weather-hour { min-width: auto; flex: 1; }
}
body.sunlight .weather-widget {
  background: #fff !important;
  border: 2px solid #000;
  color: #000 !important;
}

/* === Měření thumbnail === */
.mereni-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #bdc3c7;
  display: block;
  transition: transform 0.12s;
}
.mereni-thumb:hover { transform: scale(1.5); }

/* === Mic button (Web Speech) === */
.input-with-mic {
  position: relative;
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.input-with-mic input {
  flex: 1;
  min-width: 0;
}
.mic-btn {
  flex-shrink: 0;
  width: 38px;
  background: #f4f6f8;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
}
.mic-btn:hover { background: #e0e6ed; }
.mic-btn.mic-active {
  background: #e74c3c;
  color: white;
  animation: mic-pulse 1s infinite;
}
@keyframes mic-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

main.container {
  padding-top: 24px;
  padding-bottom: 48px;
  min-height: calc(100vh - 180px);
}

/* === FOOTER === */
.site-footer {
  background: var(--text);
  color: var(--gray-light);
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
}
.site-footer a { color: var(--orange); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* === HEADINGS === */
h1 { color: var(--green); margin-top: 0; font-size: 28px; }
h2 { color: var(--green-dark); margin-top: 32px; border-top: 2px dashed var(--border); padding-top: 16px; }
h3 { color: var(--green); margin-top: 24px; }

/* === CARDS === */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
.card h3 { margin: 0 0 8px 0; font-size: 17px; }
.card .meta { font-size: 13px; color: var(--gray); margin-bottom: 10px; }
.card .big { font-size: 24px; font-weight: bold; color: var(--orange); }

/* Card stavy */
.card.ok { border-left: 4px solid var(--green); }
.card.warning { border-left: 4px solid var(--yellow); background: #fef9e7; }
.card.error { border-left: 4px solid var(--red); background: #fdedec; }

/* === TABLES === */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
th, td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}
th {
  background: var(--gray-light);
  font-weight: bold;
  color: var(--text);
}
tr:nth-child(even) td { background: var(--bg); }
tr:hover td { background: #f0f8f4; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: white;
  background: var(--gray);
  white-space: nowrap;
}
.badge.green { background: var(--green); }
.badge.orange { background: var(--orange); }
.badge.red { background: var(--red); }
.badge.yellow { background: var(--yellow); color: var(--text); }
.badge.blue { background: var(--blue); }
.badge.purple { background: var(--purple); }

/* === FORMS === */
form { margin: 16px 0; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  margin-bottom: 14px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
label {
  font-weight: bold;
  font-size: 13px;
  color: var(--text);
}
label small { color: var(--gray); font-weight: normal; }
input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
input[type="email"],
select,
textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--text);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}
textarea { min-height: 60px; resize: vertical; }

/* Submit buttons */
button, .btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--green-dark); }
.btn-secondary { background: var(--gray); }
.btn-secondary:hover { background: var(--text); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #c0392b; }
.btn-small { padding: 4px 10px; font-size: 12px; }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 12px 0;
  border-left: 4px solid;
}
.alert-success { background: #eafaf1; border-color: var(--green); color: var(--green-dark); }
.alert-error { background: #fdedec; border-color: var(--red); color: #c0392b; }
.alert-warning { background: #fef9e7; border-color: var(--yellow); color: #b9770e; }
.alert-info { background: #ebf5fb; border-color: var(--blue); color: #21618c; }

/* === UTILITY === */
.muted { color: var(--gray); }
.success { color: var(--green); }
.danger { color: var(--red); }
.warning { color: var(--yellow); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* === CHART === */
.chart-wrap {
  background: white;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid var(--border);
}

/* === KALENDAR === */
.cal-day {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 10px;
  border-left: 4px solid var(--gray);
  background: white;
  margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
}
.cal-day.today { border-color: var(--orange); background: #fef9e7; }
.cal-day.past { opacity: 0.6; }
.cal-day.upcoming { border-color: var(--green); }
.cal-date { font-weight: bold; color: var(--green-dark); }
.cal-date .wd { font-weight: normal; color: var(--gray); font-size: 13px; display: block; }
.cal-events { display: flex; flex-direction: column; gap: 4px; }
.cal-event {
  padding: 6px 10px;
  background: var(--gray-light);
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-event.done { opacity: 0.5; text-decoration: line-through; }
.cal-event .prio-1 { color: var(--red); }
.cal-event .prio-2 { color: var(--orange); }

/* === LOGIN FORM === */
.login-container {
  max-width: 400px;
  margin: 60px auto;
  padding: 30px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-top: 4px solid var(--green);
}

/* === FAB (Floating Action Button) === */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  background: #d35400;
}

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border: 2px dashed var(--border);
  border-radius: 12px;
  margin: 20px 0;
}
.empty-state h3 { color: var(--gray); margin-top: 0; }
.empty-state .icon { font-size: 48px; margin-bottom: 10px; }

/* Click targets — minimum 44px pro mobilní palce */
button, .btn, .main-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-small { min-height: 32px; padding: 6px 10px; }

/* === RESPONSIVE === */
@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; }
  .nav-stack { width: 100%; }
  .main-nav { width: 100%; justify-content: center; }
  .nav-label { width: 100%; text-align: center; padding: 0 0 4px 0; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.2); margin-right: 0; }
  h1 { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; }

  /* Tabulky → karty na mobilu (zabrání overflow) */
  table.responsive,
  .table-responsive table {
    border: 0;
    box-shadow: none;
  }
  table.responsive thead,
  .table-responsive table thead {
    display: none; /* skrýt hlavičky, budou v data-label */
  }
  table.responsive tr,
  .table-responsive table tr {
    display: block;
    margin-bottom: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
  }
  table.responsive td,
  .table-responsive table td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: 4px 0;
    text-align: right;
  }
  table.responsive td::before,
  .table-responsive table td::before {
    content: attr(data-label);
    font-weight: bold;
    color: var(--gray);
    text-align: left;
  }

  /* Standardní tabulky dostanou horizontální scroll */
  table:not(.responsive) {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 13px;
  }
  th, td { padding: 6px 8px; }

  /* FAB zvětšit pro prsty */
  .fab { width: 56px; height: 56px; font-size: 26px; }
}
