/* =====================================================================
   Docházka security — vlastní design nad Bootstrapem 5
   ===================================================================== */

:root {
  --color-bg: #f3f5fa;
  --color-surface: #ffffff;
  --color-border: #e3e6ee;
  --color-text: #1f2430;
  --color-text-muted: #6b7280;
  --color-primary: #2f5fdc;
  --color-primary-dark: #2347ad;
  --color-success: #17a672;
  --color-danger: #e0453c;
  --color-warning: #d9891f;

  --sidebar-bg: #161b2e;
  --sidebar-bg-active: #232a45;
  --sidebar-text: #a7aec6;
  --sidebar-text-active: #ffffff;

  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  margin: 0;
}

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

h1, h2, h3, h4, h5 { color: #111528; font-weight: 600; }

.h3 {
  font-size: 1.35rem;
  margin-bottom: 1.4rem !important;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--color-border);
}
.h5 { font-size: 1.02rem; margin-bottom: 1rem; }
.h4 { font-size: 1.15rem; }

/* ---------------------------------------------------------------------
   Layout shell — postranní menu + obsah
   --------------------------------------------------------------------- */

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 246px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.35rem 1.1rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand small {
  font-weight: 400;
  font-size: .72rem;
  color: var(--sidebar-text);
  letter-spacing: .03em;
}

.sidebar-nav { flex: 1 1 auto; padding: .85rem .65rem; overflow-y: auto; }

.sidebar-section {
  margin: 1rem .6rem .35rem;
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #565f7d;
  font-weight: 600;
}
.sidebar-section:first-child { margin-top: 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .7rem;
  margin-bottom: .15rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: .885rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar-nav a.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--color-primary);
}

.sidebar-footer {
  padding: 1rem 1.2rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-user-name { color: #fff; font-size: .87rem; font-weight: 600; }
.sidebar-user-role { font-size: .75rem; color: var(--sidebar-text); text-transform: capitalize; margin-bottom: .65rem; }
.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--sidebar-text);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  padding: .35rem .7rem;
}
.sidebar-logout:hover { color: #fff; border-color: rgba(255, 255, 255, .32); text-decoration: none; }
.sidebar-logout svg { width: 14px; height: 14px; }

.app-main { flex: 1 1 auto; min-width: 0; }
.app-content { padding: 1.85rem 2.1rem 3.5rem; max-width: 1360px; }

.app-main--full {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
}

/* ---------------------------------------------------------------------
   Karty
   --------------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.3rem 1.45rem; }

.display-6 { color: var(--color-primary); font-weight: 700; }

/* ---------------------------------------------------------------------
   Tabulky
   --------------------------------------------------------------------- */

.app-content table.table,
.app-content > table {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.app-content table thead th {
  background: #f8f9fc;
  color: #4b5468;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid var(--color-border);
  padding: .75rem .9rem;
  text-align: left;
  white-space: nowrap;
}
.app-content table td {
  padding: .65rem .9rem;
  border-top: 1px solid var(--color-border);
  vertical-align: middle;
}
.app-content table tbody tr:first-child td { border-top: none; }
.app-content table tbody tr:hover { background: #fafbff; }

/* ---------------------------------------------------------------------
   Badges, tlačítka
   --------------------------------------------------------------------- */

.badge { font-weight: 600; padding: .34em .62em; border-radius: 6px; font-size: .72rem; letter-spacing: .02em; }

.btn {
  border-radius: 7px;
  font-weight: 500;
  font-size: .875rem;
  padding: .48rem 1.05rem;
}
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-outline-primary { color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline-primary:hover { background: var(--color-primary); border-color: var(--color-primary); }
.btn-outline-secondary { color: var(--color-text-muted); border-color: var(--color-border); }
.btn-outline-secondary:hover { background: #f1f3f8; color: var(--color-text); border-color: var(--color-border); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ---------------------------------------------------------------------
   Formuláře (Nette výchozí renderer vykresluje <table> bez Bootstrap tříd)
   --------------------------------------------------------------------- */

form table {
  width: 100%;
  border: none;
  box-shadow: none;
  background: transparent;
  border-collapse: collapse;
  border-radius: 0;
}
form table tr td, form table tr th {
  border: none;
  padding: .55rem 0;
  vertical-align: middle;
  background: transparent;
}
form table tr th {
  width: 38%;
  text-align: left;
  font-weight: 500;
  color: #3a4257;
  font-size: .87rem;
  padding-right: .9rem;
}

form input[type=text],
form input[type=password],
form input[type=email],
form input[type=date],
form input[type=month],
form input[type=number],
form textarea,
form select {
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  font-size: .9rem;
  color: var(--color-text);
  background: #fff;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
form input[type=text]:focus,
form input[type=password]:focus,
form input[type=email]:focus,
form input[type=date]:focus,
form input[type=month]:focus,
form input[type=number]:focus,
form textarea:focus,
form select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 95, 220, .15);
}
form textarea { min-height: 5.5rem; resize: vertical; }
form input[type=checkbox] { width: auto; accent-color: var(--color-primary); }

form input[type=submit] {
  appearance: none;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: .55rem 1.35rem;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
}
form input[type=submit]:hover { background: var(--color-primary-dark); }

form ul.error, form .error {
  color: var(--color-danger);
  list-style: none;
  padding: 0;
  margin: 0 0 .85rem;
  font-size: .85rem;
}

/* Formuláře s explicitní bootstrap třídou (select/input v latte šablonách) */
.form-select, .form-control {
  border-radius: 7px;
  border-color: var(--color-border);
}
.form-select:focus, .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 95, 220, .15);
}

/* ---------------------------------------------------------------------
   Alerty
   --------------------------------------------------------------------- */

.alert { border-radius: var(--radius); border: 1px solid transparent; padding: .8rem 1.1rem; font-size: .9rem; }

/* ---------------------------------------------------------------------
   Přihlašovací stránka
   --------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #1b2242, #0d1122 65%);
  padding: 1.5rem;
}
.auth-card {
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2.25rem 2.1rem;
  width: 100%;
  max-width: 380px;
}
.auth-brand { text-align: center; margin-bottom: 1.6rem; }
.auth-brand-title { font-weight: 700; font-size: 1.2rem; color: #111528; margin-bottom: .2rem; }
.auth-brand-subtitle { font-size: .8rem; color: var(--color-text-muted); }

/* ---------------------------------------------------------------------
   Mapa trasy (stránka Trasy)
   --------------------------------------------------------------------- */

#route-map {
  height: 560px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
#route-map .leaflet-popup-content { font-size: .85rem; }

/* ---------------------------------------------------------------------
   Responzivita
   --------------------------------------------------------------------- */

@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    padding: .4rem .6rem;
  }
  .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-nav { display: flex; flex: 1; overflow-x: auto; padding: .35rem; }
  .sidebar-nav a { white-space: nowrap; margin-bottom: 0; margin-right: .2rem; }
  .sidebar-section { display: none; }
  .app-content { padding: 1.25rem 1rem 2.5rem; }
}
