/* ============================================
   Úklidovka Plzeň Admin — style.css v2
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --primary:       #2563eb;
  --primary-light: #eff6ff;
  --primary-dark:  #1d4ed8;
  --sidebar-bg:    #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text:  #94a3b8;
  --bg:            #f4f6fb;
  --surface:       #ffffff;
  --border:        #e4e8f0;
  --text:          #1a2236;
  --text-muted:    #64748b;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --accent-blue:   #2563eb;
  --accent-orange: #ea580c;
  --accent-green:  #16a34a;
  --accent-purple: #7c3aed;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 2px 8px rgba(15,23,42,.08), 0 0 0 1px rgba(15,23,42,.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,.12), 0 0 0 1px rgba(15,23,42,.04);
}

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

body {
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px; background: var(--bg); color: var(--text);
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; overflow-x: hidden;
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header { padding: 20px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-icon { font-size: 22px; }
.brand-name { font-size: 14px; font-weight: 700; color: #fff; display: block; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); display: block; margin-top: 1px; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.user-role { font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav { list-style: none; padding: 8px 10px; flex: 1; }
.nav-section { padding: 14px 8px 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #3f566e; }
.nav-item a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--radius-sm); color: var(--sidebar-text);
  text-decoration: none; transition: background .15s, color .15s;
  font-size: 13.5px; font-weight: 500; position: relative;
}
.nav-item a:hover { background: var(--sidebar-hover); color: #cbd5e1; }
.nav-item.active a { background: rgba(37,99,235,.18); color: #93c5fd; }
.nav-item a .bi { font-size: 15px; width: 17px; text-align: center; }

.badge-count {
  margin-left: auto; background: var(--primary); color: #fff;
  border-radius: 20px; padding: 1px 7px; font-size: 10px; font-weight: 700;
}
.badge-count.badge-new { background: var(--danger); }

.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.btn-logout {
  display: flex; align-items: center; gap: 8px; color: var(--sidebar-text);
  text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm);
  transition: background .15s, color .15s; font-size: 13px;
}
.btn-logout:hover { background: var(--sidebar-hover); color: #e2e8f0; }

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

.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.sidebar-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 5px 7px; border-radius: var(--radius-sm); display: none; line-height: 1; }
.sidebar-toggle:hover { background: var(--bg); }
.topbar-title { font-size: 13px; font-weight: 500; flex: 1; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-badge { position: relative; padding: 7px 9px; color: var(--text-muted); text-decoration: none; border-radius: var(--radius-sm); font-size: 16px; transition: background .15s; }
.topbar-badge:hover { background: var(--bg); }
.topbar-badge .badge { position: absolute; top: 3px; right: 3px; font-size: 9px; padding: 1px 4px; min-width: 15px; line-height: 1.4; }

.page-content { padding: 24px 28px; flex: 1; }

/* ---- Page header ---- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.page-header h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }

.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  text-decoration: none; color: inherit; display: block;
  border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; text-decoration: none; }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.stat-blue::before   { background: var(--accent-blue); }
.stat-card.stat-orange::before { background: var(--accent-orange); }
.stat-card.stat-green::before  { background: var(--accent-green); }
.stat-card.stat-purple::before { background: var(--accent-purple); }

.stat-card-inner { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-number { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.03em; margin-bottom: 5px; }
.stat-label  { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; flex-shrink: 0;
}
.stat-blue   .stat-icon { background: #eff6ff; color: var(--accent-blue); }
.stat-orange .stat-icon { background: #fff7ed; color: var(--accent-orange); }
.stat-green  .stat-icon { background: #f0fdf4; color: var(--accent-green); }
.stat-purple .stat-icon { background: #f5f3ff; color: var(--accent-purple); }

/* ---- Dashboard grid ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---- Card section ---- */
.card-section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.card-section-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-section-header h3 { font-size: 13.5px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 7px; }
.card-section-header h3 .bi { color: var(--primary); }
.card-section-body { padding: 16px 18px; }

/* ---- Vzkazník ---- */
.vzkaz-form textarea { resize: vertical; font-family: inherit; font-size: 13.5px; }
.vzkaz-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; transition: box-shadow .15s; }
.vzkaz-item:hover { box-shadow: var(--shadow); }
.vzkaz-header { display: flex; align-items: center; gap: 9px; padding: 10px 13px; background: #fafbfd; }
.vzkaz-author-badge { width: 30px; height: 30px; background: linear-gradient(135deg, var(--primary), #6366f1); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.vzkaz-meta { flex: 1; }
.vzkaz-meta strong { display: block; font-size: 12.5px; font-weight: 600; }
.vzkaz-time { font-size: 11px; color: var(--text-muted); }
.vzkaz-delete { color: var(--text-muted); text-decoration: none; padding: 3px 6px; border-radius: 5px; font-size: 15px; line-height: 1; transition: color .15s, background .15s; }
.vzkaz-delete:hover { color: var(--danger); background: #fee2e2; }
.vzkaz-text { padding: 10px 13px; font-size: 13.5px; line-height: 1.6; }
.vzkaz-footer { display: flex; align-items: center; gap: 6px; padding: 7px 13px; border-top: 1px solid var(--border); background: #fafbfd; }
.btn-like, .btn-komentar-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 5px; font-size: 12.5px; font-weight: 500; transition: color .15s, background .15s; font-family: inherit; }
.btn-like:hover, .btn-komentar-toggle:hover { background: var(--bg); color: var(--primary); }
.btn-like.liked { color: var(--danger); }
.komentare-panel { padding: 10px 13px; background: #fafbfd; border-top: 1px solid var(--border); }
.komentar-item { padding: 5px 0; border-bottom: 1px solid var(--border); }
.komentar-item:last-of-type { border-bottom: none; }
.komentar-item p { font-size: 13px; margin: 2px 0 0; }
.komentar-form { margin-top: 8px; }

/* ---- Úkoly mini ---- */
.ukol-mini-item { display: flex; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--border); gap: 10px; transition: background .12s; }
.ukol-mini-item:last-child { border-bottom: none; }
.ukol-mini-item:hover { background: var(--bg); }
.ukol-mini-item.overdue { background: #fef2f2; }
.ukol-mini-body { flex: 1; }
.ukol-mini-nazev { font-size: 13px; font-weight: 500; }
.btn-splnit-mini { background: none; border: none; color: var(--success); cursor: pointer; font-size: 18px; padding: 3px 6px; border-radius: 5px; text-decoration: none; line-height: 1; display: inline-flex; align-items: center; transition: background .15s; }
.btn-splnit-mini:hover { background: #dcfce7; }

.calendar-embed iframe { width: 100%; border: 0; display: block; min-height: 380px; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--sidebar-bg); position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.14) 0%, transparent 70%);
  top: -250px; right: -200px; pointer-events: none;
}
.login-page::after {
  content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.09) 0%, transparent 70%);
  bottom: -150px; left: -150px; pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,.05); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1); border-radius: 20px;
  padding: 44px 40px 40px; width: 100%; max-width: 400px;
  position: relative; z-index: 1;
}
.login-logo { font-size: 44px; margin-bottom: 6px; display: block; text-align: center; }
.login-title { font-size: 22px; font-weight: 700; color: #fff; text-align: center; margin-bottom: 4px; letter-spacing: -.02em; }
.login-subtitle { color: rgba(255,255,255,.4); text-align: center; margin-bottom: 32px; font-size: 13px; }

.login-card label,
.login-card .form-label {
  display: block; font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,.5); text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 6px;
}
.login-card .mb-3 { margin-bottom: 14px !important; }

.login-card input[type="text"],
.login-card input[type="password"],
.login-card .form-control {
  width: 100%; display: block;
  background: rgba(255,255,255,.07) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: var(--radius-sm) !important;
  color: #fff !important; padding: 11px 14px !important;
  font-size: 14px !important; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  background: rgba(255,255,255,.1) !important;
  border-color: rgba(37,99,235,.8) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.2) !important;
  outline: none !important;
}
.login-card input::placeholder { color: rgba(255,255,255,.2) !important; }

.login-card input[type="submit"],
.login-card button[type="submit"],
.login-card .btn-primary {
  width: 100%; margin-top: 10px;
  background: var(--primary) !important; border: none !important;
  border-radius: var(--radius-sm) !important; color: #fff !important;
  padding: 12px 20px !important; font-size: 14px !important;
  font-weight: 600 !important; font-family: inherit; cursor: pointer;
  transition: background .15s, transform .1s; letter-spacing: .01em;
}
.login-card input[type="submit"]:hover,
.login-card button[type="submit"]:hover,
.login-card .btn-primary:hover { background: var(--primary-dark) !important; transform: translateY(-1px); }

.login-card .invalid-feedback,
.login-card .form-error { color: #fca5a5; font-size: 12px; margin-top: 5px; }

/* ---- Sub-navigation ---- */
.subnav { display: flex; gap: 2px; border-bottom: 2px solid var(--border); }
.subnav-item { padding: 8px 14px; text-decoration: none; color: var(--text-muted); border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.subnav-item:hover { color: var(--text); }
.subnav-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Filter bar ---- */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 160px; }

/* ---- List cards ---- */
.zakaznici-list { display: flex; flex-direction: column; gap: 6px; }
.zakaznik-card { background: var(--surface); border-radius: var(--radius); padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-left: 3px solid transparent; transition: box-shadow .15s, transform .1s; }
.zakaznik-card:hover { box-shadow: var(--shadow-md); transform: translateX(2px); }
.zakaznik-card.card-vypoved { border-left-color: var(--warning); background: #fffbeb; }
.zakaznik-card.card-ukonceny { border-left-color: #cbd5e1; background: #f8fafc; opacity: .85; }
.zakaznik-card-left { flex: 1; min-width: 0; }
.zakaznik-card-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.zakaznik-cislo { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; font-family: 'DM Mono', monospace; }
.zakaznik-nazev a { font-size: 14.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.zakaznik-nazev a:hover { color: var(--primary); }
.zakaznik-meta { display: flex; gap: 14px; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.zakaznik-meta span { display: flex; align-items: center; gap: 4px; }

/* ---- Info cards ---- */
.info-card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.info-card h5 { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table th { width: 36%; font-weight: 600; color: var(--text-muted); padding: 5px 10px 5px 0; vertical-align: top; }
.info-table td { padding: 5px 0; vertical-align: top; }

/* ---- Dokumenty ---- */
.dokumenty-grid { display: flex; flex-direction: column; gap: 6px; }
.dokument-item { display: flex; align-items: center; gap: 10px; padding: 10px 13px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); transition: background .12s; }
.dokument-item:hover { background: #eef2ff; }
.dokument-icon { font-size: 20px; color: var(--primary); flex-shrink: 0; }
.dokument-info { flex: 1; min-width: 0; }
.dokument-nazev { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dokument-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---- Fotky ---- */
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.foto-item img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-sm); display: block; border: 1px solid var(--border); transition: opacity .15s; }
.foto-item img:hover { opacity: .88; }
.foto-popis { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 4px; }

/* ---- Poptávky ---- */
.poptavky-list { display: flex; flex-direction: column; gap: 8px; }
.poptavka-item { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-left: 3px solid var(--border); transition: box-shadow .15s; }
.poptavka-item:hover { box-shadow: var(--shadow); }
.poptavka-item.unread { border-left-color: var(--primary); }
.poptavka-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.poptavka-jmeno a { font-size: 14.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.poptavka-kontakt { font-size: 12.5px; margin-bottom: 5px; }
.poptavka-kontakt a { color: var(--text-muted); text-decoration: none; }
.poptavka-kontakt a:hover { color: var(--primary); }
.poptavka-text { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.poptavka-actions { display: flex; gap: 6px; }

/* ---- Reklamace ---- */
.reklamace-item { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 8px; }

/* ---- Poznámky ---- */
.poznamky-form { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.poznamka-item { background: var(--surface); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 8px; border-left: 3px solid var(--border); }
.poznamka-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.poznamka-header strong { font-size: 12.5px; font-weight: 600; }
.poznamka-item p { font-size: 13.5px; line-height: 1.55; }

/* ---- Úkoly ---- */
.ukoly-list { display: flex; flex-direction: column; gap: 6px; }
.ukol-item { background: var(--surface); border-radius: var(--radius); padding: 11px 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; border-left: 3px solid var(--border); transition: box-shadow .15s; }
.ukol-item:hover { box-shadow: var(--shadow); }
.ukol-item.overdue { border-left-color: var(--danger); background: #fef2f2; }
.ukol-item.splneno  { border-left-color: var(--success); background: #f0fdf4; }
.ukol-main { flex: 1; min-width: 0; }
.ukol-nazev { font-size: 13.5px; font-weight: 600; }
.ukol-popis { margin-top: 2px; font-size: 12px; }
.ukol-meta { margin-top: 4px; font-size: 12px; }
.ukol-actions { flex-shrink: 0; }

/* ---- Log ---- */
.log-list { display: flex; flex-direction: column; gap: 4px; }
.log-item { display: flex; gap: 12px; padding: 8px 12px; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; align-items: baseline; }

/* ---- Form card ---- */
.form-card { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border); max-width: 820px; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 42px; margin-bottom: 12px; display: block; opacity: .3; }
.empty-state p { font-size: 14px; }

/* ---- Responsive ---- */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.3); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }
  .sidebar-overlay.active { display: block; }
}
@media (max-width: 576px) {
  .page-content { padding: 14px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .subnav { overflow-x: auto; flex-wrap: nowrap; }
}

/* ===================== SORTABLE WIDGETS ===================== */

.widget-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: .35;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: opacity .15s;
  flex-shrink: 0;
}
.widget-drag-handle:hover { opacity: .8; background: var(--bg); }
.widget-drag-handle:active { cursor: grabbing; }

/* Stat cards — handle overlaid top-right */
.stat-card .widget-drag-handle {
  position: absolute;
  top: 8px; right: 8px;
  opacity: 0;
  font-size: 14px;
  z-index: 2;
}
.stat-card:hover .widget-drag-handle { opacity: .5; }

/* Sortable ghost — placeholder while dragging */
.widget-ghost {
  opacity: .35;
  border: 2px dashed var(--primary) !important;
  background: var(--primary-light) !important;
  border-radius: var(--radius) !important;
}
.widget-ghost * { visibility: hidden; }

/* Chosen (element being dragged) */
.widget-chosen {
  box-shadow: 0 8px 30px rgba(37,99,235,.18), 0 2px 8px rgba(0,0,0,.1) !important;
}

/* Dragging state */
.widget-dragging {
  opacity: .95 !important;
  transform: rotate(1.5deg) scale(1.02) !important;
  z-index: 9999;
}

/* Wrapper for main grid items */
.widget-wrapper { display: flex; flex-direction: column; }

/* Sortable stats grid — keep grid display during drag */
.sortable-stats { cursor: default; }
.sortable-stats .stat-card { position: relative; }

/* Sortable main widgets */
.sortable-widgets { align-items: stretch; }
.sortable-widgets .widget-wrapper { min-height: 80px; }

/* Hint text in page header */
.page-header .text-muted.small {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: .6;
  align-self: center;
}

/* ===================== EMOJI PICKER ===================== */

.vzkaz-input-wrap {
  position: relative;
}

.btn-emoji-toggle {
  position: absolute;
  bottom: 7px; right: 8px;
  background: none; border: none;
  font-size: 18px; line-height: 1;
  cursor: pointer; padding: 2px 4px;
  border-radius: 5px;
  opacity: .6;
  transition: opacity .15s, background .15s;
  z-index: 2;
}
.btn-emoji-toggle:hover { opacity: 1; background: var(--bg); }

.vzkaz-input-wrap textarea {
  padding-right: 36px;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-top: 4px;
  max-width: 320px;
}

.emoji-btn {
  background: none; border: none;
  font-size: 20px; line-height: 1;
  padding: 4px 5px; border-radius: 5px;
  cursor: pointer;
  transition: background .12s, transform .1s;
}
.emoji-btn:hover {
  background: var(--bg);
  transform: scale(1.2);
}

/* ===================== NASTAVENÍ ===================== */

.nastaveni-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}

.nastaveni-grid .card-section { height: fit-content; }

/* Formuláře v nastavení — Bootstrap styly, jen drobné úpravy */
.card-section-body .form-label { font-weight: 600; font-size: 13px; }
.card-section-body .form-control,
.card-section-body .form-select {
  font-size: 13.5px;
  border-color: var(--border);
  border-radius: var(--radius-sm);
}
.card-section-body .form-control:focus,
.card-section-body .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.card-section-body .btn[type="submit"] { margin-top: 4px; }

/* Tabulka uživatelů */
.card-section .table { font-size: 13px; margin-bottom: 0; }
.card-section .table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom-width: 1px; }
.card-section .table td { vertical-align: middle; }

@media (max-width: 900px) {
  .nastaveni-grid { grid-template-columns: 1fr; }
}

/* ===================== TABULKA PŘÍSTUPŮ ===================== */

.card-section .table th,
.card-section .table td { padding: 10px 12px; }
.card-section .table .form-check-input { width: 18px; height: 18px; cursor: pointer; }
.card-section .table .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Emoji picker pro komentáře — menší varianta */
.btn-emoji-toggle-sm {
  font-size: 14px;
  bottom: 5px; right: 5px;
}
.emoji-picker-sm {
  max-width: 280px;
}
.emoji-picker-sm .emoji-btn {
  font-size: 17px;
  padding: 3px 4px;
}

/* ===================== VZKAZNÍK — EDITACE A PLATNOST ===================== */

.vzkaz-expired {
  opacity: .55;
}
.vzkaz-item:has(.vzkaz-expired) {
  background: #f8f9fa;
}
.vzkaz-platnost {
  font-size: 11px;
  display: block;
  margin-top: 1px;
}

.btn-vzkaz-action {
  background: none; border: none;
  color: var(--text-muted);
  padding: 3px 5px; border-radius: 4px;
  font-size: 13px; line-height: 1; cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none; display: inline-flex; align-items: center;
  flex-shrink: 0;
}
.btn-vzkaz-action:hover { color: var(--primary); background: var(--bg); }
.btn-vzkaz-delete:hover { color: var(--danger) !important; background: #fee2e2 !important; }

.komentar-item .d-flex { flex-wrap: wrap; }
.komentar-edit-form textarea { font-size: 13px; }

/* ===================== WIDGET ŠÍŘKA ===================== */

/* Grid widgetů - přepínání mezi 2 sloupci a celou šířkou */
.sortable-widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.sortable-widgets .widget-wrapper {
  /* výchozí: půl šířky */
  grid-column: span 1;
}

.sortable-widgets .widget-wrapper.widget-full {
  /* celá šířka */
  grid-column: 1 / -1;
}

/* Tlačítko přepnutí šířky */
.btn-widget-width {
  background: none; border: none;
  color: var(--text-muted); opacity: .4;
  padding: 3px 5px; border-radius: 4px;
  font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: opacity .15s, background .15s, color .15s;
}
.btn-widget-width:hover {
  opacity: 1;
  color: var(--primary);
  background: var(--bg);
}
.widget-full .btn-widget-width {
  opacity: .6;
  color: var(--primary);
}

@media (max-width: 992px) {
  .sortable-widgets {
    grid-template-columns: 1fr;
  }
  .sortable-widgets .widget-wrapper,
  .sortable-widgets .widget-wrapper.widget-full {
    grid-column: span 1;
  }
}

/* Malá tlačítka v hlavičce widgetu */
.btn-xs {
  padding: 2px 10px;
  font-size: 12px;
  border-radius: 20px;
  font-weight: 500;
  line-height: 1.6;
}

/* ===================== VÝBĚR DNÍ ÚKLIDU ===================== */
.dny-picker {
  position: absolute;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px;
  margin-top: 4px;
  min-width: 260px;
}
.dny-grid {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}
.btn-den {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 2px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  font-family: inherit;
}
.btn-den:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-den.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dny-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* Wrapper pro picker musí mít position relative */
.col-md-4:has(#dnyPicker) { position: relative; }

/* ===================== ÚKOLY — MOBILNÍ LAYOUT ===================== */

@media (max-width: 576px) {
  .ukol-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ukol-main { width: 100%; }

  .ukol-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .ukol-meta span,
  .ukol-meta a {
    display: block;
    margin-right: 0 !important;
  }

  .ukol-actions {
    width: 100%;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .ukol-actions .btn,
  .ukol-actions a {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  /* Dashboard mini úkoly */
  .ukol-mini-item {
    flex-wrap: wrap;
  }

  .ukol-mini-body {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .ukol-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ukol-main { width: 100%; }

  .ukol-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .ukol-meta span,
  .ukol-meta a {
    display: block;
    margin-right: 0 !important;
  }

  .ukol-actions {
    width: 100%;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .ukol-actions .btn,
  .ukol-actions a {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .ukol-mini-item { flex-wrap: wrap; }
  .ukol-mini-body { width: 100%; }
}

/* Tlačítko smazat fotku */
.foto-item { position: relative; }
.foto-delete {
  position: absolute; top: 5px; right: 5px;
  background: rgba(0,0,0,.55); color: #fff;
  border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; text-decoration: none;
  opacity: 0; transition: opacity .15s;
}
.foto-item:hover .foto-delete { opacity: 1; }
.foto-delete:hover { background: var(--danger); color: #fff; }

.foto-autor { font-size: 11px; padding: 2px 6px; }

/* ===================== ZAMĚSTNANEC AVATAR ===================== */
.zam-avatar-mini {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.zam-avatar-large {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  display: block;
}
.zam-avatar-placeholder {
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text-muted);
}
.zam-avatar-mini.zam-avatar-placeholder { font-size: 16px; }
.zakaznik-card-left { display: flex; align-items: center; gap: 10px; }

/* Reklamace řešení */
.reklamace-reseni {
  border-left: 3px solid var(--success);
  padding: 6px 10px;
  background: #f0fdf4;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
}
.reklamace-reseni-text { color: #166534; }

/* Push notifikace — bell button */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
#btnPushToggle { font-size: 16px; padding: 4px 8px; }
#btnPushToggle.active,
#btnPushToggle.active:focus,
#btnPushToggle.active:hover,
#btnPushToggle:focus.active {
  color: #f59e0b !important;
  border-color: #f59e0b !important;
  background: rgba(245,158,11,.1) !important;
  box-shadow: none !important;
}
