/* ================================================
   MedCRM – modrý firemní styl (světlý)
   ================================================ */

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

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

:root {
  --bg:        #f0f4fa;
  --surface:   #ffffff;
  --surface2:  #e8eef7;
  --border:    #d0daea;
  --border2:   #b8cce0;
  --text:      #1a2a3a;
  --text2:     #3a5068;
  --text3:     #7a90a8;
  --accent:    #1a56db;
  --accent2:   #6366f1;
  --green:     #0e9f6e;
  --amber:     #c27803;
  --red:       #e02424;
  --sidebar-w: 220px;
  --radius:    10px;
  --radius-sm: 7px;
}

html, body { height: 100%; font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ================================================
   LAYOUT
   ================================================ */
.layout { display: flex; min-height: 100vh; }
.main   { flex: 1; overflow-y: auto; }
.page   { padding: 28px; max-width: 1600px; }

/* ================================================
   SIDEBAR
   ================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #1a3a6b;
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 8px rgba(0,0,0,0.10);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #4f8ef9, #6366f1);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.sidebar-logo span { font-weight: 700; font-size: 16px; color: #ffffff; }

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: none;
  border-left: 2px solid transparent;
  background: none;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-family: inherit;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
  transition: color 0.12s, background 0.12s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
  border-left-color: #7eb3ff;
  font-weight: 600;
}
.nav-item .icon { font-size: 17px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user-name  { color: #fff; font-size: 13px; font-weight: 500; }
.sidebar-user-role  { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 2px; }
.btn-logout {
  margin-top: 10px;
  width: 100%;
  padding: 7px;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.btn-logout:hover { border-color: rgba(255,255,255,0.4); color: #fff; }

/* --- přepínač zemí --- */
.country-switch {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
}
.country-pill {
  flex: 1;
  text-align: center;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.15);
}
.country-pill:hover { color: #fff; background: rgba(255,255,255,0.08); }
.country-pill.active { color: #fff; background: rgba(255,255,255,0.18); border-color: #7eb3ff; font-weight: 600; }
.sidebar.collapsed .country-switch { display: none; }

/* --- drag & drop řazení --- */
[data-reorder-url] [data-id] { cursor: grab; }
[data-id].dragging { opacity: 0.45; }

/* --- sbalitelný sidebar --- */
.sidebar { transition: width .15s; }
.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.sidebar-toggle:hover { color: #fff; }
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-logo { flex-direction: column; gap: 8px; padding: 14px 8px; }
.sidebar.collapsed .sidebar-logo span { display: none; }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; transform: rotate(180deg); }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; font-size: 0; }
.sidebar.collapsed .nav-item .icon { font-size: 17px; }
.sidebar.collapsed .sidebar-footer { display: none; }

/* ================================================
   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: 22px; font-weight: 700; color: var(--text); }
.page-subtitle   { color: var(--text3); font-size: 13px; margin-top: 3px; }

/* ================================================
   CARDS / SURFACES
   ================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 4px rgba(26,58,107,0.06);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

/* ================================================
   STAT CARDS
   ================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(26,58,107,0.06);
}
.stat-label { color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; }
.stat-value { font-size: 26px; font-weight: 700; }

/* ================================================
   TABLE
   ================================================ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: 0 1px 4px rgba(26,58,107,0.06);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--surface2); }
thead th {
  padding: 11px 16px;
  text-align: left;
  color: var(--text3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
tbody tr { border-top: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: #f5f8ff; }
td { padding: 11px 16px; color: var(--text2); vertical-align: middle; }
td.td-main { color: var(--text); font-weight: 500; }
td.td-muted { color: var(--text3); font-size: 12px; }
.td-sub { color: var(--text3); font-size: 11px; margin-top: 2px; }
.table-empty { padding: 40px; text-align: center; color: var(--text3); }

/* ================================================
   BADGES
   ================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .12s, transform .08s, box-shadow .12s;
  border: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: linear-gradient(135deg, #1a56db, #6366f1);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26,86,219,0.3);
}
.btn-primary:hover { opacity: .92; box-shadow: 0 4px 12px rgba(26,86,219,0.4); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: #f0f4ff; }

.btn-sm { padding: 4px 10px; font-size: 11px; font-weight: 500; }
.btn-danger { background: none; border: 1px solid #fcd3d3; color: var(--red); }
.btn-danger:hover { background: #fff5f5; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; font-family: inherit; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* ================================================
   FORMS
   ================================================ */
.form-section { margin-bottom: 24px; }
.form-section-title {
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-group label {
  display: block;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
textarea.form-control { resize: vertical; min-height: 75px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ================================================
   FILTERS BAR
   ================================================ */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-search { flex: 1; min-width: 200px; max-width: 320px; }

/* ================================================
   TABS
   ================================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 22px; }
.tab {
  padding: 9px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text3);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  transition: color .12s;
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* ================================================
   DETAIL – info rows
   ================================================ */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text3); flex-shrink: 0; font-weight: 500; }
.info-value { color: var(--text); text-align: right; }

/* ================================================
   ACTIVITY / CONTACT ITEM
   ================================================ */
.activity-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin-bottom: 9px;
  box-shadow: 0 1px 3px rgba(26,58,107,0.05);
}
.activity-icon { font-size: 20px; flex-shrink: 0; }
.activity-subject { color: var(--text); font-weight: 600; }
.activity-meta { color: var(--text3); font-size: 12px; margin-top: 3px; }
.activity-desc { color: var(--text2); font-size: 13px; margin-top: 5px; }
.activity-type-bar { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; }

.contact-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin-bottom: 9px;
  box-shadow: 0 1px 3px rgba(26,58,107,0.05);
}
.contact-name { color: var(--text); font-weight: 600; }
.contact-meta { color: var(--text3); font-size: 12px; margin-top: 3px; }

/* ================================================
   FLASH MESSAGE
   ================================================ */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 500;
}
.flash-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.flash-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.flash-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }

/* ================================================
   BACK LINK
   ================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text3);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 16px;
  transition: color .12s;
}
.back-link:hover { color: var(--accent); }

/* ================================================
   AVATAR
   ================================================ */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ================================================
   PAGINATION
   ================================================ */
.pagination { display: flex; gap: 6px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .1s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { border-color: var(--accent); color: var(--accent); background: #eff6ff; font-weight: 700; }
.page-info { color: var(--text3); font-size: 12px; margin-left: 4px; }

/* ================================================
   CHARTS
   ================================================ */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-wrap { position: relative; height: 220px; }

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a3a6b 0%, #1e56a0 50%, #2563eb 100%);
}
.login-box {
  width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 54px; height: 54px;
  background: linear-gradient(135deg, #1a56db, #6366f1);
  border-radius: 14px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 12px rgba(26,86,219,0.4);
}
.login-logo h1 { font-size: 24px; font-weight: 700; color: #1a2a3a; }
.login-logo p  { color: #7a90a8; font-size: 13px; margin-top: 4px; }
.login-demo {
  margin-top: 22px;
  padding: 14px;
  background: #f0f4fa;
  border: 1px solid #d0daea;
  border-radius: var(--radius-sm);
}
.login-demo p   { color: #7a90a8; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px; font-weight: 600; }
.login-demo button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: #1a56db;
  font-size: 12px; cursor: pointer; padding: 3px 0;
}
.login-demo button:hover { text-decoration: underline; }

/* ================================================
   IMPORT/EXPORT
   ================================================ */
.ie-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.file-label:hover { background: #eff6ff; }
.file-label input { display: none; }
.col-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text3);
  font-size: 11px;
  font-family: monospace;
  margin: 3px;
}

/* ================================================
   MOBILNÍ MENU (burger)
   ================================================ */
.mobile-burger {
  display: none;
  position: fixed; top: 10px; left: 10px; z-index: 65;
  width: 42px; height: 42px; align-items: center; justify-content: center;
  background: #1a3a6b; color: #fff; border: none; border-radius: 9px;
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 55; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
  .form-grid, .form-grid-3, .info-grid, .chart-grid, .ie-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .mobile-burger { display: flex; }
  body.menu-open .mobile-burger { display: none; }
  body.menu-open .mobile-overlay { display: block; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,0.35);
  }
  body.menu-open .sidebar { transform: translateX(0); }

  /* na mobilu ignoruj desktopové sbalení menu */
  .sidebar.collapsed { width: var(--sidebar-w); }
  .sidebar.collapsed .sidebar-logo { flex-direction: row; gap: 10px; padding: 20px; }
  .sidebar.collapsed .sidebar-logo span { display: inline; }
  .sidebar.collapsed .country-switch { display: flex; }
  .sidebar.collapsed .sidebar-footer { display: block; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; font-size: 13px; }
  .sidebar-toggle { display: none; }

  .page { padding: 16px; padding-top: 60px; }
}
