/* =====================================================
   DEVICEDETAIL.CSS — deviceDetail.html component
   Back button, detail card, preview box, action buttons
   ===================================================== */

/* ===================== BACK BUTTON ===================== */
.adv-back-btn {
  background: transparent;
  border: 1px solid var(--adv-border);
  color: var(--adv-text-muted);
  border-radius: var(--adv-radius-sm);
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  margin-bottom: 1.25rem;
  transition: all 0.2s;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.adv-back-btn:hover {
  background: var(--adv-surface2);
  color: var(--adv-text);
}

/* ===================== DETAIL CARD ===================== */
.adv-detail-card {
  background: var(--adv-surface);
  border: 1px solid var(--adv-border);
  border-radius: var(--adv-radius);
  padding: 1.5rem;
  animation: fadeInUp 0.3s ease;
}

/* Top info row */
.adv-detail-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--adv-border);
}

.adv-device-icon-lg {
  width: 60px;
  height: 60px;
  background: linear-gradient(
    135deg,
    rgba(30, 64, 175, 0.13),
    rgba(59, 130, 246, 0.13)
  );
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--adv-primary-light);
  flex-shrink: 0;
}

.adv-detail-name {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
}

.adv-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.adv-meta-chip {
  background: var(--adv-surface2);
  border: 1px solid var(--adv-border);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  color: var(--adv-text-muted);
  display: inline-flex;
  align-items: center;
}

/* ===================== PREVIEW ===================== */
.adv-preview-wrap {
  margin-bottom: 1.5rem;
}

.adv-preview-label {
  font-size: 0.8rem;
  color: var(--adv-text-muted);
  font-weight: 600;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.adv-preview-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--adv-surface2);
  border: 1px solid var(--adv-border);
  border-radius: var(--adv-radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adv-preview-box img,
.adv-preview-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.adv-preview-empty {
  text-align: center;
  color: var(--adv-text-muted);
  font-size: 0.85rem;
}

/* ===================== ACTION BUTTONS ===================== */
.adv-detail-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.adv-detail-actions .adv-btn {
  flex: 1;
  min-width: 140px;
}

/* ===================== DEFAULT AD BLOCK (khi is_time_slot bật) ===================== */
.adv-default-ad-wrap {
  margin-bottom: 1.5rem;
}

.adv-default-ad-label {
  font-size: 0.8rem;
  color: var(--adv-text-muted);
  font-weight: 600;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.adv-default-ad-hint {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--adv-text-muted);
  background: var(--adv-surface2);
  border: 1px solid var(--adv-border);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.25rem;
  text-transform: none;
  letter-spacing: 0;
}

.adv-default-ad-inner {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  border-radius: var(--adv-radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--adv-border);
  transition: border-color 0.2s;
}

.adv-default-ad-inner:hover {
  border-color: var(--adv-primary-light);
}

.adv-default-ad-thumb {
  width: 100%;
  height: 100%;
  background: var(--adv-surface2);
}

.adv-default-ad-thumb img,
.adv-default-ad-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.adv-default-ad-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 0.82rem;
  font-weight: 600;
}

.adv-default-ad-overlay i {
  font-size: 1.4rem;
}

.adv-default-ad-inner:hover .adv-default-ad-overlay {
  opacity: 1;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 576px) {
  .adv-detail-top {
    flex-direction: column;
    text-align: center;
  }

  .adv-detail-meta {
    justify-content: center;
  }

  .adv-detail-actions {
    flex-direction: column;
  }

  .adv-detail-actions .adv-btn {
    flex: unset;
  }
}

/* ===================== TIME SLOT SECTION ===================== */
.adv-timeslot-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--adv-border);
}

.adv-timeslot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.adv-timeslot-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--adv-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Toggle switch */
.adv-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.adv-toggle-label {
  font-size: 0.82rem;
  color: var(--adv-text-muted);
}

.adv-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.adv-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.adv-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--adv-surface2);
  border: 1px solid var(--adv-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s;
}

.adv-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--adv-text-muted);
  border-radius: 50%;
  transition: all 0.25s;
  pointer-events: none;
}

.adv-toggle input:checked ~ .adv-toggle-track {
  background: var(--adv-primary);
  border-color: var(--adv-primary-light);
}

.adv-toggle input:checked ~ .adv-toggle-thumb {
  transform: translateX(18px);
  background: #fff;
}

/* Slot grid */
.adv-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.adv-slot-card {
  background: var(--adv-surface2);
  border: 1.5px solid var(--adv-border);
  border-radius: var(--adv-radius-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.adv-slot-card.is-active {
  border-color: var(--adv-primary-light);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.adv-slot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
}

.adv-slot-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.adv-slot-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.adv-slot-name {
  font-weight: 700;
  font-size: 0.82rem;
}

.adv-slot-time {
  font-size: 0.68rem;
  color: var(--adv-text-muted);
  font-family: "Space Mono", monospace;
}

.adv-slot-active-badge {
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--adv-primary-light);
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  letter-spacing: 0.3px;
}

/* Slot thumbnail */
.adv-slot-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--adv-surface);
  overflow: hidden;
  position: relative;
}

.adv-slot-thumb img,
.adv-slot-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.adv-slot-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: var(--adv-text-muted);
  font-size: 1.1rem;
}

.adv-slot-thumb-empty span {
  font-size: 0.65rem;
  color: var(--adv-text-muted);
}

.adv-slot-fallback-badge {
  position: absolute;
  bottom: 0.3rem;
  left: 0.3rem;
  font-size: 0.6rem;
  background: rgba(0, 0, 0, 0.65);
  color: var(--adv-text-muted);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  backdrop-filter: blur(4px);
}

/* Slot actions */
.adv-slot-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
}

.adv-slot-btn {
  flex: 1;
  background: var(--adv-surface);
  border: 1px solid var(--adv-border);
  color: var(--adv-text-muted);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: all 0.15s;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 600;
}

.adv-slot-btn:hover {
  background: var(--adv-surface2);
  color: var(--adv-text);
  border-color: var(--adv-primary-light);
}

.adv-slot-btn.danger:hover {
  color: var(--adv-danger);
  border-color: var(--adv-danger);
  background: rgba(239, 68, 68, 0.08);
}

/* Disabled state khi is_time_slot = 0 */
.adv-slot-grid.disabled {
  opacity: 0.6; /* giảm opacity để biết là đang tắt, nhưng vẫn thao tác được */
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 576px) {
  .adv-slot-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .adv-timeslot-header {
    flex-direction: column;
    align-items: flex-start;
  }
}


