/* =========================================
   ADS SIGNAGE — Dashboard Theme
   Dark UI, purple accent (#6C5CE7 family)
========================================= */

:root {
  --bg-base:      #0e1015;
  --bg-panel:     #14171f;
  --bg-panel-2:   #1a1e28;
  --bg-hover:     #20242f;
  --border-color: #262b38;
  --accent:       #6c5ce7;
  --accent-hover: #7d6ef0;
  --text-main:    #e8e9ee;
  --text-muted:   #8a8fa3;
  --text-dim:     #5c6178;
  --success:      #2ecc71;
  --danger:       #ff5c6c;
  --radius-lg:    14px;
  --radius-md:    10px;
  --radius-sm:    7px;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

a { text-decoration: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-text strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
}

.sidebar-brand .brand-text span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

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

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-nav .nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.sidebar-nav .nav-link.active {
  background: var(--accent);
  color: #fff;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-footer strong { display: block; font-size: 13px; }
.sidebar-footer span { display: block; font-size: 11px; color: var(--text-muted); }

/* ---------- Main layout ---------- */
.main-content {
  margin-left: 240px;
  margin-right: 320px;
  padding: 24px 28px;
  min-height: 100vh;
}

@media (max-width: 1400px) {
  .main-content { margin-right: 0; }
  .right-panel { display: none; }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h4 { font-weight: 600; margin-bottom: 2px; }
.page-header p { color: var(--text-muted); font-size: 13px; margin: 0; }

/* buttons */
.btn-outline-dark-custom {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline-dark-custom:hover {
  background: var(--bg-hover);
  color: #fff;
}
.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); color: #fff; }

/* filter bar */
.filter-bar {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-bar .form-control,
.filter-bar .form-select {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 13px;
}
.filter-bar .form-control::placeholder { color: var(--text-dim); }
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
  background: var(--bg-panel-2);
  color: var(--text-main);
  border-color: var(--accent);
  box-shadow: 0 0 0 .15rem rgba(108,92,231,.25);
}

.view-toggle .btn {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.view-toggle .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Media Cards ---------- */
.media-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
  height: 100%;
}
.media-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.media-thumb {
  position: relative;
  aspect-ratio: 16/10;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px;
}

.media-thumb .dropdown-menu {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-color);
  min-width: 140px;
}
.media-thumb .dropdown-item {
  color: var(--text-main);
  font-size: 12.5px;
}
.media-thumb .dropdown-item:hover {
  background: var(--bg-hover);
  color: #fff;
}

.media-type-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  color: #fff;
  text-transform: capitalize;
}
.media-type-badge.video { background: #8e5cf7; }
.media-type-badge.image { background: #7a7f96; }
.media-type-badge.html  { background: #2f7ffb; }

.media-info { padding: 10px 12px 12px; }
.media-info .media-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.media-meta .status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); display: inline-block; margin-right: 4px;
}
.media-meta .status-dot.offline { background: var(--danger); }

/* pagination */
.pagination-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-custom .page-btn {
  min-width: 32px; height: 32px;
  border: 1px solid var(--border-color);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 2px;
  font-size: 13px;
}
.pagination-custom .page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Right Panel ---------- */
.right-panel {
  width: 320px;
  min-height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  position: fixed;
  top: 0; right: 0;
  padding: 20px 18px;
  overflow-y: auto;
}

.panel-block {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.panel-block h6 { font-size: 13px; font-weight: 600; margin-bottom: 10px; }

.player-preview {
  aspect-ratio: 16/10;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  margin-bottom: 10px;
}

.player-controls { display: flex; align-items: center; justify-content: center; gap: 18px; }
.player-controls .play-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}

.info-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; }
.info-row span:first-child { color: var(--text-muted); }

.device-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; font-size: 12.5px;
}
.device-row .status { font-size: 11px; }
.device-row .status.online { color: var(--success); }
.device-row .status.offline { color: var(--danger); }

/* Feature list (bottom) */
.feature-item { display: flex; gap: 12px; margin-bottom: 16px; }
.feature-item .icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg-panel-2); border: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.feature-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.feature-item p { font-size: 12px; color: var(--text-muted); margin: 0; }

.sync-flow {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* Halaman tanpa panel kanan (Playlists, dll) */
.main-content.no-right-panel {
  margin-right: 0;
}

/* ================= Layout Builder ================= */

/* Preview mini di card list layout */
.layout-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-panel-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.layout-zone-box {
  position: absolute;
  border: 1px solid var(--accent);
  background: rgba(108, 92, 231, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}
.layout-zone-box span {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
}

/* Template picker di modal buat layout */
.template-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-panel-2);
}
.btn-check:checked + .template-option {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.12);
}
.template-option span { font-size: 10.5px; color: var(--text-muted); text-align: center; }

.template-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}
.tpl-zone {
  position: absolute;
  border: 1px solid var(--accent);
  background: rgba(108, 92, 231, 0.25);
}

/* Canvas editor besar di halaman Atur Zona */
.layout-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #05060a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.layout-zone-editable {
  position: absolute;
  border: 1.5px dashed var(--border-strong, #444);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  padding: 6px;
}
.layout-zone-editable:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}
.layout-zone-editable.has-playlist {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.15);
}
.layout-zone-editable.zone-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}
.layout-zone-editable .zone-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
}
.layout-zone-editable .zone-playlist-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.zone-config-card { transition: box-shadow .15s ease; }

/* Running text sebagai tipe media */
.media-type-badge.running_text { background: #c0392b; }

.running-text-thumb {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
}
.running-text-preview {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* ================= TV Mockup Lengkap (Header + Canvas + Ticker + Footer) ================= */
.tv-mockup {
  background: #05060a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0a0c12;
  border-bottom: 1px solid var(--border-color);
}
.tv-header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.tv-header-brand i { color: var(--accent); font-size: 16px; }
.tv-header-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 12px;
}
.tv-header-clock small { color: var(--text-muted); display: block; font-size: 9.5px; }

.tv-mockup .layout-canvas {
  border: none;
  border-radius: 0;
  aspect-ratio: 16/8;
}

.tv-running-text {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  border-top: 1px solid rgba(255,255,255,.15);
}
.tv-running-text .badge { font-size: 9.5px; padding: 3px 7px; }
.tv-running-text .ticker-text {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tv-running-text.zone-active { box-shadow: inset 0 0 0 2px var(--accent); }

.tv-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: #0a0c12;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  flex-wrap: wrap;
}

/* Override Bootstrap .text-muted -- background dashboard gelap, jadi teks
   perlu lebih terang supaya kebaca (Bootstrap default terlalu gelap) */
.text-muted {
  --bs-text-opacity: 1;
  color: rgb(255 255 255 / 75%) !important;
}