/* ==============================================================
 * admin-cms.css — Drama CMS, Playground, Analytics & Audit System
 * Theme: Obsidian Aurora (Kanit, Deep Navy, Glassmorphism, Micro-animations)
 * ============================================================== */

/* ─── 1. DRAMA & EPISODE CMS ──────────────────────────────────── */
.cms-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(14, 18, 32, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cms-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 260px;
  background: rgba(7, 9, 16, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  transition: border-color var(--ease);
}
.cms-search-box:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}
.cms-search-box input {
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  width: 100%;
  outline: none;
}

.cms-category-select {
  padding: 8px 14px;
  background: rgba(7, 9, 16, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.cms-category-select:focus {
  border-color: var(--cyan);
}

.drama-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.drama-card {
  background: rgba(14, 18, 32, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.drama-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.15);
}

.drama-poster-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #080a12;
}
.drama-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.drama-card:hover .drama-poster-img {
  transform: scale(1.05);
}

.drama-badge-category {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
}

.drama-badge-episodes {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #34d399;
}

.drama-content {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.drama-title {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drama-desc {
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.5;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 14px;
}
.drama-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #64748b;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.drama-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.btn-drama-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: all var(--ease);
}
.btn-drama-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--cyan);
  color: #38bdf8;
}
.btn-drama-action.danger:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: #f43f5e;
}

/* Episodes Table / List in Modal */
.episodes-table-wrap {
  max-height: 380px;
  overflow-y: auto;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.episodes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.episodes-table th {
  background: rgba(7, 9, 16, 0.85);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #94a3b8;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.episodes-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}
.episodes-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ─── 2. INTERACTIVE API PLAYGROUND ────────────────────────────── */
.playground-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) {
  .playground-layout {
    grid-template-columns: 1fr;
  }
}

.playground-card {
  background: rgba(14, 18, 32, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.playground-title {
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.playground-method-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.playground-method-badge.get {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.playground-method-badge.post {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.playground-field {
  margin-bottom: 14px;
}
.playground-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 6px;
}

.playground-url-preview {
  background: rgba(6, 7, 12, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #38bdf8;
  word-break: break-all;
  margin-bottom: 16px;
}

.btn-playground-run {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  transition: all 0.25s var(--ease);
}
.btn-playground-run:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}
.btn-playground-run:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Playground Response View */
.playground-res-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.playground-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-family: var(--mono);
  font-weight: 600;
}
.playground-stat-pill.success {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.playground-stat-pill.error {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.playground-stat-pill.latency {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.playground-json-wrap {
  background: #06070a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 520px;
  overflow: auto;
}
.playground-json-wrap pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: #e2e8f0;
}

/* ─── 3. ADVANCED ANALYTICS & SVG CHARTS ─────────────────────── */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-kpi-card {
  background: rgba(14, 18, 32, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.analytics-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--kpi-accent, #6366f1);
}
.analytics-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 6px;
}
.analytics-kpi-val {
  font-size: 26px;
  font-weight: 700;
  color: #f8fafc;
  font-family: var(--mono);
}
.analytics-kpi-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 4px;
}

.analytics-charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 980px) {
  .analytics-charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: rgba(14, 18, 32, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
}
.chart-legend {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
  color: #94a3b8;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.svg-chart-container {
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.svg-chart-container svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Quota Progress Meters */
.quota-meters-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.quota-meter-item {
  background: rgba(7, 9, 16, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.quota-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.quota-key-name {
  font-weight: 600;
  color: #f8fafc;
}
.quota-usage-num {
  font-family: var(--mono);
  font-size: 12px;
  color: #94a3b8;
}
.quota-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.quota-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s var(--ease);
}
.quota-bar-fill.normal {
  background: linear-gradient(90deg, #10b981, #34d399);
}
.quota-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.quota-bar-fill.danger {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

/* ─── 4. ADMIN AUDIT LOGS TIMELINE ───────────────────────────── */
.audit-timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 16px;
}
.audit-timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.audit-entry {
  position: relative;
  margin-bottom: 20px;
}
.audit-node-dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0b0f19;
  border: 2px solid var(--cyan);
  display: grid;
  place-items: center;
  z-index: 1;
}
.audit-node-dot::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
}

.audit-card {
  background: rgba(14, 18, 32, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--ease);
}
.audit-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

.audit-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.audit-action-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
}
.audit-action-tag.create {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.audit-action-tag.update {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.audit-action-tag.delete {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.audit-action-tag.system {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.audit-action-tag.auth {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.audit-action-tag.user {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.audit-time {
  font-size: 11.5px;
  color: #64748b;
}

.audit-body-row {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 6px;
}
.audit-user {
  font-weight: 600;
  color: #f8fafc;
}
.audit-ip {
  font-family: var(--mono);
  font-size: 11px;
  color: #64748b;
  margin-left: 6px;
}

.audit-details-code {
  background: rgba(5, 7, 12, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: #94a3b8;
  max-height: 80px;
  overflow: auto;
  margin-top: 6px;
}

/* ─── 5. PLATFORM SCOPES SELECTOR ────────────────────────────── */
.platform-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: rgba(6, 7, 14, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 170px;
  overflow-y: auto;
}

.platform-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all var(--ease);
  user-select: none;
}
.platform-chip-label:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
}
.platform-chip-label input[type="checkbox"] {
  accent-color: #6366f1;
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.platform-chip-label.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: #6366f1;
  color: #f8fafc;
}
