/* ============================================================
   Praxe & Sběry — hlavní CSS
   ============================================================ */

:root {
  --sidebar-width: 256px;
  --sidebar-bg: #1a2332;
  --sidebar-hover: #243044;
  --sidebar-active-bg: #2563eb;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #fff;
  --sidebar-label: #475569;
  --topbar-height: 60px;
  --topbar-bg: #fff;
  --topbar-border: #e2e8f0;
  --body-bg: #f1f5f9;
  --content-padding: 1.5rem;
  --radius: 10px;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,.12);
  --transition: .18s ease;
}

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

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: #1e293b;
  font-size: .9375rem;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.app-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  overflow-y: auto;
  transition: transform var(--transition);
}

/* Mobilní: skrytý */
@media (max-width: 1199.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1039;
  }
  .sidebar-overlay.show {
    display: block;
  }
}

/* Brand */
.sidebar-brand {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: .625rem;
}
.sidebar-brand-short {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: var(--sidebar-active-bg);
  padding: .25rem .5rem;
  border-radius: 6px;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.sidebar-brand-module {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: .01em;
}
.sidebar-brand-name {
  font-size: .7rem;
  font-weight: 400;
  color: #64748b;
  line-height: 1.3;
  margin-top: 1px;
}

/* Navigace */
.sidebar-nav {
  flex: 1;
  padding: .75rem .75rem 0;
}
.sidebar-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-label);
  padding: .5rem .5rem .25rem;
  margin-top: .25rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: 7px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}
.sidebar-link i {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: .8;
}
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}
.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}
.sidebar-link.active i { opacity: 1; }

/* Přepínač modulů */
.sidebar-modules {
  padding: .5rem .75rem .25rem;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: .5rem;
}
.sidebar-module-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .75rem;
  border-radius: 7px;
  color: #64748b;
  text-decoration: none;
  font-size: .8rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}
.sidebar-module-btn:hover {
  background: var(--sidebar-hover);
  color: #94a3b8;
}

/* Uživatel dole */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .875rem .75rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--sidebar-active-bg);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name {
  font-size: .8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .7rem;
  color: #64748b;
  margin-top: 1px;
}
.sidebar-user-logout {
  color: #475569;
  text-decoration: none;
  font-size: 1.1rem;
  padding: .25rem;
  border-radius: 5px;
  transition: color var(--transition), background var(--transition);
}
.sidebar-user-logout:hover {
  color: #f87171;
  background: rgba(248,113,113,.1);
}

/* ============================================================
   HLAVNÍ OBLAST
   ============================================================ */

.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (max-width: 1199.98px) {
  .app-main { margin-left: 0; }
}

/* Topbar */
.app-topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-hamburger {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #64748b;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
  line-height: 1;
  transition: color var(--transition);
}
.topbar-hamburger:hover { color: #1e293b; }

.topbar-title { flex: 1; }
.topbar-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #1e293b;
}
.topbar-actions { display: flex; align-items: center; gap: .5rem; }

/* Breadcrumb v topbaru */
.app-topbar .breadcrumb {
  font-size: .85rem;
}
.app-topbar .breadcrumb-item.active { color: #1e293b; font-weight: 600; }
.app-topbar .breadcrumb-item a { color: #64748b; text-decoration: none; }
.app-topbar .breadcrumb-item a:hover { color: var(--sidebar-active-bg); }
.app-topbar .breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }

/* Obsah */
.app-content {
  flex: 1;
  padding: var(--content-padding);
}

/* ============================================================
   KARTY
   ============================================================ */

.app-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid #e2e8f0;
}
.app-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.app-card-header h2, .app-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #1e293b;
}
.app-card-body { padding: 1.25rem; }

/* ============================================================
   WORKPLACE STATUS KARTY (Sběry dashboard)
   ============================================================ */

.wp-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.wp-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.wp-card-header {
  height: 6px;
}
.wp-card-body {
  padding: 1.25rem;
}
.wp-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .25rem;
  color: #1e293b;
}
.wp-card-desc {
  font-size: .8rem;
  color: #64748b;
  margin-bottom: .875rem;
}
.wp-card-stats {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.wp-stat {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
}
.wp-stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wp-stat-dot.green  { background: #22c55e; }
.wp-stat-dot.orange { background: #f97316; }
.wp-stat-dot.red    { background: #ef4444; }

/* ============================================================
   PLÁNOVACÍ GRID (týdenní pohled)
   ============================================================ */

.plan-grid {
  display: grid;
  gap: 1px;
  background: #e2e8f0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.plan-grid-header {
  background: #f8fafc;
  padding: .75rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
}
.plan-cell {
  background: #fff;
  padding: .875rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
  min-height: 70px;
}
.plan-cell:hover { background: #f8fafc; }
.plan-cell.status-ok       { border-left: 3px solid #22c55e; }
.plan-cell.status-partial  { border-left: 3px solid #f97316; }
.plan-cell.status-empty    { border-left: 3px solid #ef4444; }
.plan-cell.status-closed   { background: #f8fafc; cursor: default; color: #94a3b8; }

.plan-cell-class {
  font-size: .75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: .25rem;
}
.plan-cell-count {
  font-size: .875rem;
  font-weight: 600;
}
.plan-cell-names {
  font-size: .75rem;
  color: #64748b;
  margin-top: .2rem;
}

/* ============================================================
   DOCHÁZKA GRID
   ============================================================ */

.att-table th { font-size: .78rem; font-weight: 700; text-transform: uppercase; color: #64748b; }
.att-table td { vertical-align: middle; }

.att-btn {
  width: 36px; height: 36px;
  border-radius: 7px;
  border: 2px solid transparent;
  font-size: .9rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.att-btn.present  { background: #dcfce7; border-color: #22c55e; color: #166534; }
.att-btn.absent   { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.att-btn.excused  { background: #fef9c3; border-color: #eab308; color: #854d0e; }
.att-btn.none     { background: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; }

/* ============================================================
   BADGE role
   ============================================================ */

.role-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-badge.student    { background: #dbeafe; color: #1d4ed8; }
.role-badge.substitute { background: #fef9c3; color: #854d0e; }
.role-badge.supervisor { background: #f3e8ff; color: #6b21a8; }

/* ============================================================
   OBECNÉ UTILITY
   ============================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
  color: #1e293b;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 700;
  padding: .25rem .625rem;
  border-radius: 20px;
}
.status-badge.open    { background: #dcfce7; color: #166534; }
.status-badge.closed  { background: #fee2e2; color: #991b1b; }
.status-badge.holiday { background: #fef9c3; color: #854d0e; }

/* Tlačítka */
.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
}
.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Tabulky */
.table-clean thead th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  padding: .625rem 1rem;
}
.table-clean td {
  padding: .75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.table-clean tbody tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover td { background: #f8fafc; }

/* Autocomplete */
.autocomplete-list {
  position: absolute;
  z-index: 1050;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  max-height: 240px;
  overflow-y: auto;
  width: 100%;
  left: 0;
  top: calc(100% + 4px);
}
.autocomplete-item {
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .875rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--transition);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f1f5f9; }
.autocomplete-item .class-tag {
  font-size: .7rem;
  background: #e0e7ff;
  color: #3730a3;
  padding: .1rem .4rem;
  border-radius: 10px;
  font-weight: 600;
  margin-left: .5rem;
}

/* Milník quick-toggle */
.ms-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ms-toggle-btn:hover i { opacity: .7; transform: scale(1.1); }

/* Přepínače dnů v hlavičce pracoviště */
.day-toggle-btn {
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .4rem;
  border-radius: 5px;
  border: 1.5px solid;
  cursor: pointer;
  line-height: 1.4;
  transition: all .15s;
}
.day-toggle-btn.day-open {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}
.day-toggle-btn.day-open:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}
.day-toggle-btn.day-closed {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
  text-decoration: line-through;
  opacity: .8;
}
.day-toggle-btn.day-closed:hover {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
  text-decoration: none;
  opacity: 1;
}

/* Purple badge/button pro impersonaci */
.bg-purple { background-color: #6f42c1 !important; }
.btn-outline-purple {
  color: #6f42c1; border-color: #6f42c1;
}
.btn-outline-purple:hover {
  background: #6f42c1; color: #fff;
}

/* Impersonační banner */
.imp-banner {
  background: #7c3aed;
  color: #fff;
  padding: .6rem 1.5rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.imp-banner .btn-light {
  font-size: .78rem;
  padding: .2rem .6rem;
  color: #7c3aed;
  font-weight: 600;
}

/* Moje pracoviště — zvýraznění */
.wp-card-mine {
  box-shadow: 0 0 0 2px currentColor, var(--card-shadow);
  outline: 2px solid;
  outline-offset: -2px;
  outline-color: var(--mine-color, #2563eb);
  position: relative;
}
.wp-card-mine::after {
  content: '★ moje';
  position: absolute;
  top: 14px;
  right: 12px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #2563eb;
  background: #eff6ff;
  padding: .1rem .4rem;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
}

/* Prázdný stav */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}
.empty-state i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: .75rem;
  opacity: .4;
}
.empty-state p { margin: 0; font-size: .95rem; }

/* Offcanvas panel pro přiřazení studentů */
.offcanvas-title { font-weight: 700; }
.student-assign-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .875rem;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: .375rem;
}
.student-assign-item .student-name { font-size: .875rem; font-weight: 500; }

/* Formuláře */
.form-section {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.form-section-title {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  margin-bottom: 1rem;
  padding-bottom: .625rem;
  border-bottom: 1px solid #f1f5f9;
}
.form-label { font-weight: 600; font-size: .875rem; color: #374151; }
.form-control, .form-select {
  border-color: #d1d5db;
  border-radius: 7px;
  font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* Color picker */
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
}
