/* =====================================================
   SONIQ - CSS (OPRAVENÝ LAYOUT)
   ===================================================== */

:root {
  --bg:         #F8F9FB;
  --surface:    #FFFFFF;
  --surface2:   #F1F3F7;
  --border:     #E4E8EF;
  --text:       #111827;
  --text-sub:   #6B7280;
  --accent:     #00C97B;
  --accent-dk:  #00A864;
  --danger:     #EF4444;
  --warn:       #F59E0B;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --sidebar-w:  230px;
  --topbar-h:   60px;
  --font-body:  'Space Grotesk', sans-serif;
  --font-head:  'Syne', sans-serif;
}

/* ==================== DARK MODE ==================== */
[data-theme="dark"] {
  --bg:         #0F1117;
  --surface:    #1A1D27;
  --surface2:   #22273A;
  --border:     #2E3347;
  --text:       #F0F2F8;
  --text-sub:   #8B92A9;
  --shadow:     0 1px 3px rgba(0,0,0,.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,.45);
}

[data-theme="dark"] .topbar {
  background: rgba(15,17,23,.95);
}

[data-theme="dark"] .sidebar {
  background: var(--surface);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0,0,0,.55);
}

/* Dark mode toggle button */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.dark-toggle:hover { background: var(--surface2); color: var(--text); }


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  position:   fixed;
  top: 0; left: 0;
  width:      var(--sidebar-w);
  height:     100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display:    flex;
  flex-direction: column;
  z-index:    100;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar-inner {
  display:        flex;
  flex-direction: column;
  min-height:     100%;
  padding:        24px 0 16px;
}

.logo {
  display:     flex;
  align-items: center;
  gap:         10px;
  padding:     0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-head);
  font-size:   20px;
  font-weight: 800;
  letter-spacing: -.5px;
  white-space: nowrap;
}

.nav { flex: 1; padding: 0 12px; }
.nav-group { margin-bottom: 24px; }

.nav-label {
  display:        block;
  font-size:      11px;
  font-weight:    600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--text-sub);
  padding:        0 8px 8px;
  white-space:    nowrap;
}

.nav-item {
  display:     flex;
  align-items: center;
  gap:         10px;
  padding:     9px 10px;
  border-radius: var(--radius);
  color:       var(--text-sub);
  text-decoration: none;
  font-size:   14px;
  font-weight: 500;
  cursor:      pointer;
  transition:  background .15s, color .15s;
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active .ni { stroke: #fff; }

.ni { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; }

.sidebar-logos {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display:    flex;
  align-items: center;
  gap:        12px;
  flex-shrink: 0;
}

.inst-logo { height: 32px; object-fit: contain; opacity: .8; }

/* ==================== MAIN ==================== */
.main-content {
  margin-left:    var(--sidebar-w);
  width:          calc(100% - var(--sidebar-w));
  display:        flex;
  flex-direction: column;
  min-height:     100vh;
}

.topbar {
  position:    sticky;
  top:         0;
  background:  rgba(248,249,251,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height:      var(--topbar-h);
  display:     flex;
  align-items: center;
  gap:         12px;
  padding:     0 28px;
  z-index:     50;
}

.burger {
  display:    none;
  background: none;
  border:     none;
  cursor:     pointer;
  color:      var(--text);
  padding:    4px;
  flex-shrink: 0;
}

.topbar-search {
  flex:        1;
  max-width:   400px;
  display:     flex;
  align-items: center;
  gap:         8px;
  background:  var(--surface);
  border:      1px solid var(--border);
  border-radius: 24px;
  padding:     8px 16px;
  transition:  border-color .15s, box-shadow .15s;
}

.topbar-search:focus-within {
  border-color: var(--accent);
  box-shadow:   0 0 0 3px rgba(0,201,123,.12);
}

.topbar-search input {
  flex:       1;
  border:     none;
  outline:    none;
  background: transparent;
  font-family: var(--font-body);
  font-size:  14px;
  color:      var(--text);
  min-width:  0;
}

.topbar-search input::placeholder { color: var(--text-sub); }
.topbar-user { margin-left: auto; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background:  var(--accent);
  color:       #fff;
  font-weight: 700;
  font-size:   14px;
  display:     flex;
  align-items: center;
  justify-content: center;
  cursor:      pointer;
}

.page-wrap {
  padding: 32px 36px;
  flex:    1;
  width:   100%;
}

/* ==================== COMPONENTS ==================== */

.card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:    var(--shadow);
  padding:       20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       18px 20px;
  box-shadow:    var(--shadow);
}

.stat-label {
  font-size:   11px;
  font-weight: 600;
  color:       var(--text-sub);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-value {
  font-family: var(--font-head);
  font-size:   24px;
  font-weight: 700;
  color:       var(--text);
  line-height: 1;
}

.stat-accent { color: var(--accent); }

.section-hd {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-hd h2 { font-family: var(--font-head); font-size: 18px; font-weight: 700; }

/* Buttons */
.btn {
  display:     inline-flex;
  align-items: center;
  gap:         6px;
  padding:     9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size:   14px;
  font-weight: 600;
  cursor:      pointer;
  border:      none;
  transition:  all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* Table */
.table-wrap { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover { color: var(--text); }
tbody tr { transition: background .12s; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child { border-bottom: none; }
td { padding: 11px 12px; vertical-align: middle; }

/* Badge */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-genre    { color: #fff; }
.badge-explicit { background: #FEE2E2; color: var(--danger); }

.stars { color: var(--warn); font-size: 13px; }
.dur   { color: var(--text-sub); font-size: 13px; font-variant-numeric: tabular-nums; }

.play-bar-wrap { display: flex; align-items: center; gap: 8px; }
.play-bar { flex: 1; height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; min-width: 40px; }
.play-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s ease; }

/* Filters */
.filters-bar {
  display:   flex;
  flex-wrap: wrap;
  gap:       10px;
  margin-bottom: 20px;
  align-items: center;
}

.filter-input {
  padding:   8px 14px;
  border:    1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-body);
  font-size:  14px;
  color:      var(--text);
  outline:    none;
  transition: border-color .15s, box-shadow .15s;
}

.filter-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,201,123,.12); }
select.filter-input { cursor: pointer; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.page-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all .15s;
}
.page-btn:hover  { background: var(--surface2); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-info { font-size: 13px; color: var(--text-sub); }

/* Artists grid */
.artists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.artist-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s; cursor: pointer;
}
.artist-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.artist-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #00a8d0);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 22px; font-weight: 700;
  color: #fff; margin-bottom: 14px;
}

.artist-name { font-family: var(--font-head); font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.artist-meta { font-size: 12px; color: var(--text-sub); line-height: 1.6; }
.verified    { color: var(--accent); font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 18px; }

label.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-family: var(--font-body);
  font-size: 14px; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,201,123,.12); }

/* Auth - OPRAVENÉ */
.auth-wrap {
  width:     100%;
  max-width: 460px;
  margin:    40px auto 40px;
}

.auth-title {
  font-family: var(--font-head);
  font-size:   30px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.15;
}

.auth-sub { color: var(--text-sub); margin-bottom: 24px; font-size: 14px; }

/* Playlists */
.playlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

.playlist-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.playlist-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.pl-icon { width: 52px; height: 52px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.pl-name { font-family: var(--font-head); font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.pl-meta { font-size: 12px; color: var(--text-sub); line-height: 1.6; }

/* Range */
input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: var(--surface2); border-radius: 2px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--text); color: #fff; padding: 12px 20px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-md); opacity: 0; transform: translateY(12px);
  transition: opacity .25s, transform .25s; pointer-events: none; z-index: 999; max-width: 360px;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--accent); }
.toast.error   { background: var(--danger); }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-sub); font-size: 15px; gap: 10px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .3s ease both; }

.empty-state { text-align: center; padding: 60px; color: var(--text-sub); font-size: 15px; }

.heart-btn { background: none; border: none; cursor: pointer; color: var(--text-sub); font-size: 16px; padding: 4px; transition: color .15s, transform .15s; }
.heart-btn:hover, .heart-btn.liked { color: var(--danger); }
.heart-btn.liked { transform: scale(1.2); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; padding: 32px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; margin-bottom: 20px; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .main-content { margin-left: 0; width: 100%; }
  .burger { display: flex; }
  .page-wrap { padding: 20px 18px; }
}

@media (max-width: 600px) {
  .stats-grid    { grid-template-columns: repeat(2, 1fr); }
  .artists-grid  { grid-template-columns: repeat(2, 1fr); }
  .playlist-grid { grid-template-columns: repeat(2, 1fr); }
  .page-wrap     { padding: 16px 12px; }
  .auth-wrap     { margin-top: 16px; }
  .topbar        { padding: 0 16px; }
}

@media (max-width: 380px) {
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .playlist-grid { grid-template-columns: 1fr; }
}
