/* ═══════════════════════════════════════════════════
   TeamWorkSync — Modern UI
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --sidebar-width: 256px;
  --topbar-height: 60px;

  --sidebar-bg:           #1a2b4a;
  --sidebar-text:         #8fa8c8;
  --sidebar-hover-bg:     rgba(255,255,255,0.08);
  --sidebar-active-bg:    rgba(255,255,255,0.12);
  --sidebar-active-line:  #3b82f6;

  --body-bg:      #f0f4f8;
  --card-bg:      #ffffff;
  --topbar-bg:    #ffffff;
  --border:       #e2e8f0;

  --text:         #1e293b;
  --text-sub:     #64748b;
  --text-muted:   #94a3b8;

  --primary:      #3b82f6;
  --primary-h:    #2563eb;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);

  --radius:    10px;
  --radius-sm: 6px;
  --tr: 0.18s ease;
}

[data-theme="dark"] {
  --sidebar-bg:    #0f172a;
  --body-bg:       #1e293b;
  --card-bg:       #273549;
  --topbar-bg:     #1e2d3d;
  --border:        #334155;
  --text:          #f1f5f9;
  --text-sub:      #94a3b8;
  --text-muted:    #64748b;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--body-bg);
  line-height: 1.6;
}

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

/* ── Sidebar ─────────────────────────────────────────── */

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 15px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-decoration: none;
}

.sidebar-brand img {
  width: 34px; height: 34px;
  object-fit: contain;
  border-radius: 8px;
}

.sidebar-brand-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-text);
  opacity: 0.45;
  padding: 14px 10px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--tr);
}

.nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: #fff;
  border-left-color: var(--sidebar-active-line);
}

.nav-link i { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user-name {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { color: var(--sidebar-text); font-size: 11px; }

.sidebar-logout {
  color: var(--sidebar-text);
  font-size: 17px;
  text-decoration: none;
  flex-shrink: 0;
  transition: color var(--tr);
}
.sidebar-logout:hover { color: var(--danger); }

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

@media (max-width: 767.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0 !important; }
}

/* ── Main wrapper ─────────────────────────────────────── */

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

/* ── Topbar ───────────────────────────────────────────── */

.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 18px;
}

@media (max-width: 767.98px) { .topbar-toggle { display: flex; align-items: center; } }

.topbar-spacer { flex: 1; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 15px;
  transition: all var(--tr);
  line-height: 1;
}
.btn-icon:hover { background: var(--body-bg); color: var(--text); }

/* ── Content ──────────────────────────────────────────── */

.content {
  flex: 1;
  padding: 24px;
}

@media (max-width: 767.98px) { .content { padding: 16px; } }

/* ── Page header ──────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* ── Stat cards ───────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 991.98px) { .stat-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 479.98px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--tr), transform var(--tr);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.total   { background: rgba(100,116,139,.12); color: #64748b; }
.stat-icon.novy    { background: rgba(245,158,11,.15);  color: #d97706; }
.stat-icon.probiha { background: rgba(59,130,246,.15);  color: #2563eb; }
.stat-icon.hotovo  { background: rgba(16,185,129,.15);  color: #059669; }

.stat-info {}
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-sub); margin-top: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }

/* ── Table wrapper ────────────────────────────────────── */

.table-wrapper {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.table-toolbar h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.tws-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.tws-table th {
  background: var(--body-bg);
  border-bottom: 2px solid var(--border);
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-sub);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.tws-table th a { color: var(--text-muted); margin-left: 3px; font-size: 13px; }
.tws-table th a:hover { color: var(--primary); }

.tws-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.tws-table tr:last-child td { border-bottom: none; }
.tws-table tr:hover td { background: rgba(59,130,246,.03); }

.tws-table .project-name { font-weight: 500; }
.tws-table .text-meta { font-size: 12px; color: var(--text-muted); }

/* Status badges */
.badge-stav {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}
.badge-novy    { background: rgba(245,158,11,.14);  color: #d97706; }
.badge-probiha { background: rgba(59,130,246,.14);  color: #2563eb; }
.badge-hotovo  { background: rgba(16,185,129,.14);  color: #059669; }

.stav-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.stav-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

.reactions-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── Projekt detail ───────────────────────────────────── */

.projekt-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.projekt-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}

.projekt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.meta-item .meta-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.meta-item .meta-value { font-size: 13.5px; font-weight: 500; color: var(--text); }

.zadani-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-section-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Comment thread */
.comment-thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

.comment-item { display: flex; gap: 12px; }

.comment-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.comment-bubble {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author { font-weight: 600; font-size: 13px; color: var(--text); }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-body { font-size: 13.5px; }
.comment-body p:last-child { margin-bottom: 0; }

.comment-form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

/* ── Forms ────────────────────────────────────────────── */

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

.form-label {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 5px;
  display: block;
}

.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background-color: var(--card-bg);
  color: var(--text);
  transition: border-color var(--tr), box-shadow var(--tr);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.14);
}

/* ── Buttons ──────────────────────────────────────────── */

.btn-tws {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--tr);
  border: 1px solid transparent;
  line-height: 1.4;
}

.btn-tws-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-tws-primary:hover { background: var(--primary-h); border-color: var(--primary-h); color: #fff; }

.btn-tws-outline { background: transparent; color: var(--text-sub); border-color: var(--border); }
.btn-tws-outline:hover { background: var(--body-bg); color: var(--text); }

.btn-tws-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-tws-danger { background: rgba(239,68,68,.1); color: var(--danger); border-color: rgba(239,68,68,.2); }
.btn-tws-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ── User table ───────────────────────────────────────── */

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

/* ── Login ────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2b4a 0%, #2d4a7a 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 60px; height: 60px; object-fit: contain; }
.login-app-name { font-size: 22px; font-weight: 700; color: #1e293b; margin: 10px 0 2px; }
.login-tagline { font-size: 13px; color: #64748b; }

.login-alert {
  background: rgba(239,68,68,.09);
  border: 1px solid rgba(239,68,68,.25);
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}

.login-label { font-weight: 500; font-size: 13px; color: #374151; margin-bottom: 5px; display: block; }
.login-input {
  width: 100%;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
  color: #1e293b;
}
.login-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.14); }

.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr);
  margin-top: 6px;
}
.login-btn:hover { background: var(--primary-h); }

/* ── Footer ───────────────────────────────────────────── */

.app-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  background: var(--topbar-bg);
}

/* ── Alert / Toast ────────────────────────────────────── */

.tws-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tws-alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); color: #059669; }
.tws-alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #dc2626; }

/* ── Misc ─────────────────────────────────────────────── */

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* CKEditor override */
.cke_chrome { border-color: var(--border) !important; border-radius: var(--radius-sm) !important; }

/* ── Priority badges ──────────────────────────────────── */

.badge-prio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}
.badge-prio-nizka    { background: rgba(16,185,129,.12);  color: #059669; }
.badge-prio-stredni  { background: rgba(59,130,246,.12);  color: #2563eb; }
.badge-prio-vysoka   { background: rgba(245,158,11,.15);  color: #d97706; }
.badge-prio-kriticka { background: rgba(239,68,68,.12);   color: #dc2626; }

/* ── Deadline ─────────────────────────────────────────── */

.deadline-ok      { font-size: 12px; color: var(--text-muted); }
.deadline-soon    { font-size: 12px; color: #d97706; font-weight: 600; }
.deadline-overdue { font-size: 12px; color: #dc2626; font-weight: 600; }

/* ── Search ───────────────────────────────────────────── */

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap i {
  position: absolute;
  left: 9px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.search-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px 6px 28px;
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  width: 210px;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  width: 260px;
}

/* ── History / Audit log ──────────────────────────────── */

.history-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.history-item:last-child { border-bottom: none; }

.history-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 4px;
}

.history-body { flex: 1; }
.history-who  { font-weight: 600; color: var(--text); }
.history-what { color: var(--text-sub); }
.history-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ── Profile page ─────────────────────────────────────── */

.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 520px;
  margin-bottom: 20px;
}
