/* VsL CRM — Víno s láskou identita */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  --dark:       #1A1A1A;
  --gold:       #996515;
  --gold-hover: #B8803F;
  --gold-light: #F5E9D0;
  --cream:      #F8F7F5;
  --white:      #FFFFFF;
  --text:       #222222;
  --text-muted: #666666;
  --border:     #E2DDD6;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --radius:     8px;
  --nav-w:      220px;
}

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

html, body {
  height: 100%;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--cream);
}

/* ── Layout ── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar nav ── */
#sidebar {
  width: var(--nav-w);
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo img { height: 32px; object-fit: contain; }
.sidebar-logo .app-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: .35rem;
}

nav { padding: 1rem 0; flex: 1; }
nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
nav a.active {
  background: rgba(153,101,21,.15);
  color: var(--gold);
  border-left-color: var(--gold);
}
nav a .nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .75rem;
  color: rgba(255,255,255,.35);
}

/* ── Hlavní oblast ── */
#main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.page-header h1 { font-size: 1.2rem; font-weight: 700; color: var(--dark); }
.page-header .subtitle { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

#content { padding: 1.5rem 1.75rem; flex: 1; }

/* ── KPI karty ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--gold);
}
.kpi-card .kpi-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-card .kpi-value { font-size: 2rem; font-weight: 700; color: var(--dark); line-height: 1.1; margin-top: .4rem; }
.kpi-card .kpi-sub   { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Sekce s nadpisem ── */
.section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; overflow: hidden; }
.section-header { padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.section-header h2 { font-size: .9rem; font-weight: 700; color: var(--dark); }
.section-body { padding: 1.25rem; }

/* ── Pipeline badge lišta ── */
.pipeline-bar { display: flex; gap: .5rem; flex-wrap: wrap; }
.stage-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem 1rem;
  min-width: 120px;
  flex: 1;
}
.stage-badge .stage-name  { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-align: center; }
.stage-badge .stage-count { font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.stage-badge.has-deals { border-color: var(--gold); background: var(--gold-light); }
.stage-badge.has-deals .stage-count { color: var(--gold); }

/* ── Vyhledávání + filtry ── */
.toolbar {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: .55rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--gold); }

.filter-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.filter-btn {
  padding: .45rem .85rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--white);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  color: var(--text);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
}

/* ── Tabulka ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--cream); }
.data-table tr[data-href] { cursor: pointer; }

/* ── Tagy / segment badge ── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-b2b      { background: #E8F0FE; color: #1A56DB; }
.badge-b2c      { background: #DEF7EC; color: #057A55; }
.badge-loyalty  { background: var(--gold-light); color: var(--gold); }
.badge-stage    { background: var(--cream); color: var(--text-muted); border: 1px solid var(--border); }
.badge-won      { background: #DEF7EC; color: #057A55; }
.badge-lost     { background: #FDE8E8; color: #C81E1E; }

/* ── Tlačítka ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn-primary  { background: var(--gold); color: var(--white); }
.btn-primary:hover  { background: var(--gold-hover); }
.btn-outline  { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.btn-outline:hover  { background: var(--gold-light); }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-danger { background: #FDE8E8; color: #C81E1E; border: 1px solid #F5C6CB; }
.btn-danger:hover { background: #C81E1E; color: #fff; }

/* ── Kontaktní detail ── */
.detail-header {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.detail-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--white);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.detail-meta { flex: 1; }
.detail-meta h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: .3rem; }
.detail-meta .detail-info { font-size: .85rem; color: var(--text-muted); line-height: 1.7; }
.detail-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Timeline aktivit ── */
.timeline { list-style: none; }
.timeline-item {
  display: flex;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.timeline-body { flex: 1; }
.timeline-body .tl-note { font-size: .85rem; margin-bottom: .2rem; }
.timeline-body .tl-meta { font-size: .75rem; color: var(--text-muted); }

/* ── Firemní karty ── */
.company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.company-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color .15s, transform .1s;
}
.company-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.company-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; }
.company-card .cc-meta { font-size: .8rem; color: var(--text-muted); line-height: 1.6; }
.company-card .cc-footer { margin-top: .75rem; display: flex; align-items: center; justify-content: space-between; }

/* ── Pipeline ── */
.pipeline-cols { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.pipeline-col {
  min-width: 220px;
  flex-shrink: 0;
  background: var(--cream);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pipeline-col-header {
  padding: .75rem 1rem;
  background: var(--dark);
  color: var(--white);
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pipeline-col-header .col-count {
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  padding: .1rem .45rem;
  font-size: .75rem;
}
.pipeline-col-body { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; min-height: 80px; }
.deal-card {
  background: var(--white);
  border-radius: 6px;
  padding: .75rem;
  border: 1px solid var(--border);
  font-size: .82rem;
}
.deal-card .deal-title { font-weight: 600; margin-bottom: .3rem; }
.deal-card .deal-meta { color: var(--text-muted); font-size: .75rem; margin-bottom: .5rem; }
.deal-card .deal-value { font-weight: 700; color: var(--gold); font-size: .85rem; }
.deal-card .deal-actions { display: flex; gap: .3rem; margin-top: .5rem; flex-wrap: wrap; }

/* ── Formuláře ── */
.form-row { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .55rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }

/* ── Prázdné stavy ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }

/* ── Loader ── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: .75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobilní hamburger ── */
#menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: .5rem; }
#menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--dark);
  margin: 4px 0;
  transition: .2s;
}

/* ── Responzivita ── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s;
  }
  #sidebar.open { transform: translateX(0); }
  #menu-toggle { display: block; }

  .page-header { padding: .9rem 1rem; }
  .page-header h1 { font-size: 1rem; }
  #content { padding: 1rem; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .pipeline-cols { flex-direction: column; }
  .pipeline-col { min-width: auto; }
  .company-grid { grid-template-columns: 1fr; }
}

/* ── Overlay na mobilu při otevřeném menu ── */
#nav-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
#nav-overlay.visible { display: block; }
