/* Fonts are loaded via <link> in base.html — not @import — to avoid FOUT */

:root {
  --bs-font-sans-serif: 'Inter', sans-serif;
  --bs-body-font-family: 'Inter', sans-serif;
  --color-primary:   #0065BD;
  --color-secondary: #6AADE4;
  --color-gray:      #9B9B9B;
  --sidebar-width:   240px;
  --navbar-height:   56px;
}

body {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
}

/* -------------------------------------------------------------------------
   Navbar
   ------------------------------------------------------------------------- */
.navbar { background-color: var(--color-primary) !important; height: var(--navbar-height); }
.navbar-logo { height: 32px; }

/* -------------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  z-index: 100;
  transition: width 0.2s;
}

.sidebar .nav-link { color: #444; padding: 0.5rem 1rem; }
.sidebar .nav-link:hover { background: #e9ecef; color: var(--color-primary); }
.sidebar .nav-link.active { background: var(--color-primary); color: #fff; }
.sidebar .nav-link .badge { font-family: inherit; }
.sidebar-backdrop { display: none; }

/* Collapsed sidebar (tablet) */
@media (max-width: 1279px) and (min-width: 768px) {
  .sidebar { width: 60px; overflow: hidden; }
  .sidebar .nav-label { display: none; }
  .main-content { margin-left: 60px !important; }
}

/* Manual sidebar collapse toggle — hidden by default (not via Bootstrap's
   .d-none, which is !important and would block the override below);
   shown only above the tablet auto-collapse range (1280px = the 1279px
   breakpoint above + 1px; no Bootstrap utility breakpoint lands there,
   so this is a custom media query). */
#sidebarCollapseToggle { display: none; }

@media (min-width: 1280px) {
  #sidebarCollapseToggle { display: flex; align-self: center; margin-top: auto; }
  html.sidebar-collapsed .sidebar { width: 60px; overflow: hidden; }
  html.sidebar-collapsed .sidebar .nav-label { display: none; }
  html.sidebar-collapsed .main-content { margin-left: 60px !important; }
  html.sidebar-collapsed #sidebarCollapseToggle i { transform: rotate(180deg); }
}

/* Hidden sidebar (mobile) */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .sidebar.show { display: flex; }
  .main-content { margin-left: 0 !important; }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    top: var(--navbar-height);
    left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }
}

/* -------------------------------------------------------------------------
   Main content
   ------------------------------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  overflow: hidden;
  padding: 1.5rem;
}

.main-content.scrollable {
  overflow-y: auto;
}

/* -------------------------------------------------------------------------
   Instrukce / Nastavení vyhodnocení — clickable row selection
   ------------------------------------------------------------------------- */
#lv-table-body tr { cursor: pointer; }
#lv-table-body tr input,
#lv-table-body tr select,
#lv-table-body tr button { cursor: auto; }

/* -------------------------------------------------------------------------
   Sortable tables / row-click-to-detail
   ------------------------------------------------------------------------- */
tr[data-href] { cursor: pointer; }
table[data-sortable] th[tabindex] { cursor: pointer; user-select: none; }

/* -------------------------------------------------------------------------
   Dashboard cards
   ------------------------------------------------------------------------- */
.dashboard-card .card-body { overflow-y: auto; }

/* -------------------------------------------------------------------------
   Status badges
   ------------------------------------------------------------------------- */
.status-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.status-k_natoceni  { background: #212529; color: #fff;}
.status-v_terenu    { background: #FFE599; color: #444; border: 1px solid #444; }
.status-pretocit    { background: #DC3545; color: #fff; }

.status-natoceno    { background: #6C757D; color: #fff; }
.status-pro_spojeni { background: #ACB5BD; color: #fff; }

.status-pripraveno  { background: #C29FFA; color: #fff; }
.status-spojeno     { background: #660FF1; color: #fff; }

.status-zadano      { background: #FD7E14; color: #fff; }
.status-resi_se     { background: #FECBA1; color: #444}
.status-predelat    { background: #DC3545; color: #fff; }

.status-vyreseno    { background: #9EEAF9; color: #444}
.status-nascitano   { background: #0dcaf0; color: #fff; }

.status-hotovo      { background: #198754; color: #fff; }

/* Corner-filling variant: bleeds to the card-header's own top/right edges
   and matches its corner radius, instead of sitting inset with padding. */
.status-badge-corner {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: 0 .85rem;
  margin: calc(-1 * var(--bs-card-cap-padding-y, .5rem))
          calc(-1 * var(--bs-card-cap-padding-x, 1rem))
          calc(-1 * var(--bs-card-cap-padding-y, .5rem)) 0;
  border: none;
  border-radius: 0 var(--bs-card-inner-border-radius, .375rem) 0 0;
  font-size: inherit;
  font-weight: inherit;
}
select.status-badge-corner {
  text-align: center;
  text-align-last: center;
}
button.status-badge-corner { cursor: pointer; }
button.status-badge-corner:disabled { cursor: not-allowed; opacity: .85; }


/* -------------------------------------------------------------------------
   Bootstrap overrides
   ------------------------------------------------------------------------- */
.btn-primary { background-color: var(--color-primary); border-color: var(--color-primary); }
.btn-primary:hover { background-color: #004f96; border-color: #004f96; }

thead th { font-weight: 500; }

a { color: var(--color-primary); }

/* -------------------------------------------------------------------------
   Tables inside cards — align first column with card-header text
   ------------------------------------------------------------------------- */
.card .table > thead > tr > th:first-child,
.card .table > tbody > tr > td:first-child { padding-left: 1rem; }
.card .table > thead > tr > th:last-child,
.card .table > tbody > tr > td:last-child { padding-right: 1rem; }

/* -------------------------------------------------------------------------
   Compact form controls inside cards
   ------------------------------------------------------------------------- */
.card-body .form-control,
.card-body .form-select { font-size: .875rem; padding: .25rem .5rem; }
.card-body .form-label { font-size: .8125rem; margin-bottom: .2rem; }

/* -------------------------------------------------------------------------
   Multi-field rows (crispy fields side by side) — row is display:flex,
   so each field's own mb-3 no longer collapses with siblings outside;
   move the spacing to the row and zero the trapped inner margins.
   ------------------------------------------------------------------------- */
.form-row { margin-bottom: 1rem; }
.form-row .mb-3 { margin-bottom: 0 !important; }
