/* ============================================================
   MSTV v2 — Admin CSS
   Paleta Mar de Sonhos: coral #E07870, branco, preto
   ============================================================ */

:root {
  --brand:       #E07870;
  --brand-dark:  #c9635a;
  --brand-light: #f5c4c0;
  --accent:      #6366f1;
  --bg:          #0f1117;
  --bg2:         #181b24;
  --bg3:         #1e2130;
  --card:        #1e2130;
  --border:      rgba(255,255,255,.08);
  --text:        #e8eaf0;
  --muted:       rgba(255,255,255,.4);
  --green:       #22c55e;
  --red:         #ef4444;
  --yellow:      #f59e0b;
  --blue:        #3b82f6;
  --purple:      #a855f7;
  --radius:      10px;
  --sidebar-w:   230px;
  --shadow:      0 4px 24px rgba(0,0,0,.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; min-height: 100vh; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-brand {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .7rem;
}
.brand-logo { height: 32px; object-fit: contain; max-width: 130px; }
.brand-tag  { font-size: .75rem; font-weight: 700; color: var(--brand); letter-spacing: .08em; }

.sidebar-nav { flex: 1; padding: .8rem 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.2rem;
  color: var(--muted); font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--brand); border-left-color: var(--brand); background: rgba(224,120,112,.08); }
.nav-item i { width: 18px; text-align: center; }

.sidebar-footer {
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.btn-logout { color: var(--muted); font-size: 1.1rem; transition: color .2s; }
.btn-logout:hover { color: var(--red); }

/* ---- Main ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}
.page-header {
  padding: 1.4rem 1.8rem .8rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 1.2rem; font-weight: 700; }
.content-wrap { padding: 1.6rem 1.8rem; flex: 1; }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.2rem; }
.card-header {
  padding: .9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  flex-wrap: wrap;
}
.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-body { padding: 1.2rem; }
.card-body.p0 { padding: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1.1rem; border-radius: 8px; font-size: .875rem;
  font-weight: 500; border: none; cursor: pointer;
  transition: background .2s, transform .1s;
  background: rgba(255,255,255,.08); color: var(--text);
}
.btn:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--brand);   color: #fff; }
.btn-primary:hover  { background: var(--brand-dark); }
.btn-green    { background: var(--green);   color: #fff; }
.btn-green:hover    { background: #16a34a; }
.btn-red      { background: var(--red);     color: #fff; }
.btn-red:hover      { background: #dc2626; }
.btn-blue     { background: var(--blue);    color: #fff; }
.btn-blue:hover     { background: #2563eb; }
.btn-sm { padding: .4rem .8rem; font-size: .8rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-brand  { background: rgba(224,120,112,.18); color: var(--brand); }
.badge-blue   { background: rgba(59,130,246,.18);  color: var(--blue);  }
.badge-green  { background: rgba(34,197,94,.18);   color: var(--green); }
.badge-red    { background: rgba(239,68,68,.18);   color: var(--red);   }
.badge-yellow { background: rgba(245,158,11,.18);  color: var(--yellow);}
.badge-purple { background: rgba(168,85,247,.18);  color: var(--purple);}

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%; padding: .6rem .9rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: .9rem;
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
}
input[type=checkbox] { width: auto; margin-right: .4rem; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .875rem; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.media-thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg3); }
td.actions { white-space: nowrap; }

/* ---- Alerts ---- */
.alert {
  padding: .8rem 1.1rem; border-radius: 8px; font-size: .9rem;
  margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem;
}
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: var(--green); }
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: var(--red);   }
.alert-info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: var(--blue);  }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: var(--yellow);}

/* ---- Upload area ---- */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2.5rem; text-align: center; transition: border-color .2s;
  cursor: pointer;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--brand); background: rgba(224,120,112,.04);
}
.upload-icon { font-size: 2.5rem; color: var(--brand); margin-bottom: .8rem; display: block; }
.upload-area p { color: var(--muted); margin-bottom: .5rem; }
.upload-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; margin-top: .6rem; }
.upload-item-info { display: flex; justify-content: space-between; margin-bottom: .5rem; font-size: .85rem; }
.upload-name { font-weight: 500; }
.upload-size { color: var(--muted); }
.progress-bar { height: 5px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: .4rem; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 999px; transition: width .2s; }
.upload-status { font-size: .8rem; color: var(--muted); }

/* ---- Search ---- */
.search-box { display: flex; align-items: center; gap: .5rem; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .8rem; }
.search-box i { color: var(--muted); }
.search-box input { background: transparent; border: none; color: var(--text); font-size: .875rem; width: 200px; }
.search-box input:focus { outline: none; }

/* ---- Timeline layout ---- */
.timeline-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
  padding: .8rem 1rem; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.store-selector-wrap { display: flex; align-items: center; gap: .6rem; }
.store-selector-wrap select { width: auto; min-width: 220px; }
.timeline-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.timeline-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; }
@media (max-width: 900px) { .timeline-layout { grid-template-columns: 1fr; } }

.media-panel { max-height: 78vh; display: flex; flex-direction: column; }
.media-search { padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.media-search input { font-size: .85rem; }
.media-lib { flex: 1; overflow-y: auto; }
.lib-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .8rem; cursor: grab;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.lib-item:hover { background: rgba(255,255,255,.04); }
.lib-item:last-child { border-bottom: none; }
.lib-thumb { width: 56px; height: 36px; flex-shrink: 0; position: relative; border-radius: 5px; overflow: hidden; background: var(--bg3); }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-icon { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); font-size: .9rem; }
.lib-badge { position: absolute; bottom: 2px; right: 2px; font-size: 9px; background: rgba(0,0,0,.7); border-radius: 3px; padding: 1px 3px; }
.lib-info { flex: 1; min-width: 0; }
.lib-name { display: block; font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-dur  { display: block; font-size: .72rem; color: var(--muted); }

.timeline-panel { max-height: 78vh; display: flex; flex-direction: column; }
.timeline-info { display: flex; align-items: center; gap: 1rem; padding: .5rem .8rem; border-bottom: 1px solid var(--border); font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.timeline-track { flex: 1; overflow-y: auto; padding: .5rem; min-height: 120px; }
.tl-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; height: 200px; color: var(--muted); }
.tl-empty i { font-size: 2rem; opacity: .3; }
.tl-item {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .7rem; margin-bottom: .4rem;
  cursor: default; transition: background .15s;
}
.tl-item:hover { background: rgba(255,255,255,.06); }
.tl-item.new { border-color: var(--brand); }
.tl-handle { color: var(--muted); cursor: grab; padding: 0 .2rem; }
.tl-thumb { width: 52px; height: 32px; flex-shrink: 0; border-radius: 4px; overflow: hidden; background: var(--bg2); }
.tl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tl-info { flex: 1; min-width: 0; }
.tl-name { display: block; font-size: .82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-duration { display: flex; flex-direction: column; gap: 2px; }
.tl-duration label { font-size: .7rem; }
.dur-input { width: 70px; padding: .25rem .4rem; font-size: .82rem; }
.tl-remove { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: .3rem; border-radius: 4px; }
.tl-remove:hover { color: var(--red); background: rgba(239,68,68,.1); }

/* ---- Dashboard stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.stat-icon { font-size: 1.6rem; margin-bottom: .5rem; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: .25rem; }
.stat-label { font-size: .8rem; color: var(--muted); }

/* ---- Store URL box ---- */
.url-box { display: flex; align-items: center; gap: .5rem; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .8rem; }
.url-box code { flex: 1; font-size: .78rem; color: var(--brand); word-break: break-all; }
.url-copy { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; }
.url-copy:hover { color: var(--text); }

/* ---- QR / Token ---- */
.token-display { font-family: monospace; font-size: .8rem; color: var(--muted); background: var(--bg3); padding: .3rem .6rem; border-radius: 4px; }

/* ---- Toast ---- */
.toast-container { position: fixed; top: 1.2rem; right: 1.4rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  padding: .7rem 1.2rem; border-radius: 10px; font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: .6rem;
  animation: slideIn .25s ease; min-width: 220px;
}
.toast-success { background: #064e3b; color: #6ee7b7; border: 1px solid rgba(34,197,94,.3); }
.toast-error   { background: #450a0a; color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.toast-info    { background: #1e3a5f; color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Login page ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 1rem; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-logo { display: block; height: 44px; margin: 0 auto 1.6rem; object-fit: contain; }
.login-title { text-align: center; font-size: 1.3rem; font-weight: 700; margin-bottom: 1.6rem; }
.login-title span { color: var(--brand); }

/* ---- Misc ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.empty-msg { text-align: center; padding: 2.5rem; color: var(--muted); }
.text-muted { color: var(--muted); }
.mono { font-family: monospace; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.page-actions { display: flex; gap: .6rem; align-items: center; }
