/* MyMusic Studio — backoffice styles. Same palette and typeface as the Android app. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/PlusJakartaSans.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --night: #09090d;
  --ink: #111117;
  --graphite: #1a1a22;
  --slate: #24242e;
  --steel: #30303c;
  --violet: #8b6cff;
  --rose: #ff4f93;
  --text: #f5f5f7;
  --text-2: #a9a9b8;
  --muted: #6f6f7e;
  --success: #3ddc97;
  --danger: #ff6b6b;
  --brand: linear-gradient(135deg, #6d4aff, #ff4f93);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  color: var(--text);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }

/* Layout */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 28px 18px;
  background: var(--ink);
  border-right: 1px solid var(--slate);
  display: flex; flex-direction: column; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; font-weight: 800; font-size: 18px; }
.brand small { display: block; font-weight: 600; font-size: 12px; color: var(--text-2); letter-spacing: .08em; text-transform: uppercase; }
.logo { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; flex: none; }
.logo svg { width: 22px; height: 22px; fill: #fff; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600;
}
.nav a svg { width: 20px; height: 20px; fill: currentColor; }
.nav a:hover { background: var(--graphite); color: var(--text); }
.nav a.active { background: var(--slate); color: var(--text); }

.sidebar-footer { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 12px; }
.who { font-size: 13px; color: var(--text-2); }
.who strong { display: block; color: var(--text); font-size: 14px; }

.main { padding: 36px 40px 64px; max-width: 1240px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.back-link svg { width: 18px; height: 18px; fill: currentColor; }

/* Building blocks */

.card { background: var(--ink); border: 1px solid var(--slate); border-radius: var(--radius); padding: 22px; }
.card h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }

.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 18px; }
.two-col { grid-template-columns: 1fr 1fr; }

.stat { position: relative; overflow: hidden; }
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: var(--brand); opacity: .12;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
  color: var(--text); background: var(--slate);
  transition: filter .15s, transform .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--steel); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 107, 107, .45); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; display: inline-grid; place-items: center;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--slate); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn.danger:hover { color: var(--danger); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--success); background: rgba(61, 220, 151, .12); }
.pill.off { color: var(--text-2); background: var(--slate); }

.flash { padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; border: 1px solid; }
.flash.success { background: rgba(61, 220, 151, .08); border-color: rgba(61, 220, 151, .35); color: #9cf0c9; }
.flash.error { background: rgba(255, 107, 107, .08); border-color: rgba(255, 107, 107, .4); color: #ffb3b3; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--graphite); color: var(--text-2); font-size: 14px; }
.notice strong { color: var(--text); }
.notice code { color: var(--violet); }

/* Tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 0 12px 12px; }
td { padding: 10px 12px; border-top: 1px solid var(--graphite); vertical-align: middle; }
tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }

.track-cell { display: flex; align-items: center; gap: 14px; min-width: 240px; }
.track-cell .title { font-weight: 700; }
.track-cell .artist { color: var(--text-2); font-size: 13px; }
.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--slate); flex: none; display: grid; place-items: center; color: var(--muted); }
.thumb svg { width: 22px; height: 22px; fill: currentColor; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions form { margin: 0; }

.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty svg { width: 46px; height: 46px; fill: var(--steel); margin-bottom: 12px; }
.empty h3 { color: var(--text); margin: 0 0 6px; }

/* Toolbar */

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; background: var(--ink); border: 1px solid var(--slate); padding: 4px; border-radius: 999px; }
.tabs a { padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.tabs a.active { background: var(--slate); color: var(--text); }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: var(--muted); }
.search input { padding-left: 42px; width: 300px; border-radius: 999px; }

/* Forms */

label.field { display: flex; flex-direction: column; gap: 7px; font-weight: 600; font-size: 14px; }
label.field span.hint { color: var(--muted); font-weight: 500; font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  height: 46px; padding: 0 14px; border-radius: 10px;
  background: var(--graphite); border: 1px solid var(--slate); color: var(--text);
  font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 108, 255, .2); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.fields .wide { grid-column: 1 / -1; }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 26px; border: 1.5px dashed var(--steel); border-radius: var(--radius);
  background: var(--graphite); color: var(--text-2); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--violet); background: rgba(139, 108, 255, .06); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone svg { width: 34px; height: 34px; fill: var(--violet); }
.dropzone strong { color: var(--text); }
.dropzone .file-name { color: var(--violet); font-weight: 700; word-break: break-all; }

.cover-preview { aspect-ratio: 1; width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--graphite); display: grid; place-items: center; position: relative; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview svg { width: 64px; height: 64px; fill: var(--steel); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--steel); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--violet); }
.switch input:checked::after { transform: translateX(18px); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }

.form-actions { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-top: 24px; flex-wrap: wrap; }
audio { width: 100%; margin-top: 12px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; color: var(--text-2); margin-top: 16px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; color: var(--text); }

/* Login */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(circle at 15% 15%, rgba(109, 74, 255, .35), transparent 45%),
  radial-gradient(circle at 90% 70%, rgba(255, 79, 147, .22), transparent 45%), var(--night); }
.auth .card { width: 100%; max-width: 420px; padding: 36px; display: flex; flex-direction: column; gap: 18px; background: rgba(17, 17, 23, .85); backdrop-filter: blur(10px); }
.auth h1 { margin: 6px 0 0; font-size: 26px; font-weight: 800; }
.auth p { margin: 0; color: var(--text-2); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 14px 16px; gap: 14px; }
  .nav { flex-direction: row; }
  .nav a span { display: none; }
  .sidebar-footer { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .who { display: none; }
  .main { padding: 24px 16px 48px; }
  .form-grid, .two-col, .fields { grid-template-columns: 1fr; }
  .search input { width: 100%; }
}

/* Monitoring & administration (v1.3) */

.nav-label { padding: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.flash.notice { background: rgba(139, 108, 255, .1); border-color: rgba(139, 108, 255, .45); color: #d4c8ff; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }
.stat .hint { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 2px; }
.stat .hint.up { color: var(--success); }
.stat.live .value::after { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--success); margin-left: 10px; vertical-align: middle; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.chart { width: 100%; height: 160px; display: block; }
.chart rect { fill: url(#brand); }
.chart rect:hover { opacity: .75; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.chart-total { font-size: 13px; color: var(--text-2); font-weight: 600; }

.bar-row { display: grid; grid-template-columns: 110px 1fr 56px; gap: 12px; align-items: center; margin: 10px 0; font-size: 14px; }
.bar-track { height: 10px; border-radius: 999px; background: var(--graphite); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }

.rank { color: var(--muted); font-weight: 800; width: 26px; display: inline-block; }
.pill.src-mymusic { color: #d4c8ff; background: rgba(139, 108, 255, .16); }
.pill.src-jamendo { color: #ffd58a; background: rgba(255, 186, 73, .14); }
.pill.src-audius { color: #ff9ec4; background: rgba(255, 79, 147, .14); }
.pill.src-local { color: var(--text-2); background: var(--slate); }
.pill.warn { color: var(--danger); background: rgba(255, 107, 107, .12); }
.pill.admin { color: #d4c8ff; background: rgba(139, 108, 255, .16); }
.pill.src-mymusic::before, .pill.src-jamendo::before, .pill.src-audius::before, .pill.src-local::before, .pill.admin::before { display: none; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-left: 6px; }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; color: var(--text-2); font-size: 14px; }
.pagination a, .pagination span.current { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--graphite); font-weight: 600; }
.pagination span.current { background: var(--violet); color: #fff; }
.pagination a:hover { background: var(--slate); }

.detail-head { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.avatar-xl { width: 84px; height: 84px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; font-size: 34px; font-weight: 800; color: #fff; flex: none; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); display: inline-grid; place-items: center; font-size: 14px; font-weight: 800; color: #fff; flex: none; }
.person { display: flex; align-items: center; gap: 12px; }
.person .name { font-weight: 700; }
.person .sub { color: var(--text-2); font-size: 13px; }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.kv div { background: var(--graphite); border-radius: 12px; padding: 14px; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kv dd { margin: 6px 0 0; font-size: 22px; font-weight: 800; }

.actions-list { display: flex; flex-direction: column; gap: 10px; }
.actions-list form { margin: 0; }
.action-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px; border-radius: 12px; background: var(--graphite); }
.action-row p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.danger-zone { border: 1px solid rgba(255, 107, 107, .35); }

textarea {
  width: 100%; min-height: 110px; padding: 12px 14px; border-radius: 10px; resize: vertical;
  background: var(--graphite); border: 1px solid var(--slate); color: var(--text); font: inherit; outline: none;
}
textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 108, 255, .2); }

.banner-preview { border-radius: 14px; padding: 16px 18px; background: linear-gradient(135deg, rgba(109, 74, 255, .35), rgba(255, 79, 147, .25)); border: 1px solid rgba(255, 255, 255, .08); }
.banner-preview strong { display: block; margin-bottom: 4px; }

.health { display: flex; gap: 14px; align-items: flex-start; }
.health .state { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.health .state svg { width: 22px; height: 22px; fill: currentColor; }
.health .state.ok { background: rgba(61, 220, 151, .12); color: var(--success); }
.health .state.bad { background: rgba(255, 107, 107, .12); color: var(--danger); }
.health .state.off { background: var(--slate); color: var(--muted); }
.health h3 { margin: 0; font-size: 15px; }
.health p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; word-break: break-word; }
.meter { height: 8px; border-radius: 999px; background: var(--graphite); overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; background: var(--brand); }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--graphite); }
.setting:first-of-type { border-top: 0; }
.setting p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }

.progress { height: 10px; border-radius: 999px; background: var(--graphite); overflow: hidden; margin-top: 14px; display: none; }
.progress > div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.file-list { margin: 14px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: 13px; max-height: 180px; overflow: auto; }
.file-list li { padding: 4px 0; border-top: 1px solid var(--graphite); }
.result-ok { color: var(--success); font-weight: 700; }
.result-bad { color: var(--danger); font-weight: 700; }
.updated { color: var(--muted); font-size: 12px; }

@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .nav-label { display: none; }
}
