* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0c0c0f;
  color: #e4e4e7;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.terminal {
  width: 100%;
  max-width: 950px;
  border: 1px solid #1e1e2a;
  border-radius: 12px;
  overflow: hidden;
  background: #111116;
  box-shadow: 0 2px 32px rgba(0, 0, 0, 0.6);
}

.terminal-header {
  background: #16161d;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 14px;
  color: #fafafa;
  border-bottom: 1px solid #1e1e2a;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.terminal-header .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d39955;
  animation: pulse 2s ease-in-out infinite;
  margin-right: 6px;
  flex-shrink: 0;
}

/* ── Tabs ────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
}

.tab {
  background: transparent;
  color: #52525b;
  border: 1px solid #27272a;
  padding: 5px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.8px;
  transition: all 0.15s;
}

.tab.active {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

.tab:hover:not(.active) {
  color: #a1a1aa;
  border-color: #3f3f46;
}

#header-title {
  margin-left: auto;
  margin-right: 12px;
}

.lang-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.lang-btn {
  background: transparent;
  color: #52525b;
  border: 1px solid #27272a;
  padding: 4px 10px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}

.lang-btn.active {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;
}

.lang-btn:hover:not(.active) {
  color: #a1a1aa;
  border-color: #3f3f46;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.4);
  }
}

.terminal-body {
  padding: 20px;
  height: 420px;
  min-height: 420px;
  max-height: 62vh;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 12.5px;
  line-height: 1.75;
}

.terminal-body::-webkit-scrollbar {
  width: 5px;
}
.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}
.terminal-body::-webkit-scrollbar-thumb {
  background: #1e1e2a;
  border-radius: 3px;
}

.progress-wrap {
  padding: 0 20px 16px;
}

.progress-bar {
  height: 3px;
  background: #1e1e2a;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #818cf8, #a78bfa);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-label {
  font-size: 11px;
  color: #52525b;
  margin-top: 6px;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
}

.terminal-footer {
  padding: 14px 20px;
  border-top: 1px solid #1e1e2a;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #16161d;
}

.profile-select {
  appearance: none;
  background: #1d1d28;
  color: #e4e4e7;
  border: 1px solid #27272a;
  padding: 8px 28px 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1aa' d='M3 5l3 3 3-3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.profile-select:hover {
  border-color: #3f3f46;
}
.profile-select:focus {
  outline: none;
  border-color: #818cf8;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.2px;
}

.btn-refresh {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.btn-refresh:hover {
  background: #22c55e;
  border-color: #22c55e;
}
.btn-refresh:disabled {
  background: #1a1a22;
  color: #3f3f46;
  border-color: #27272a;
  cursor: not-allowed;
}

.btn-download {
  background: #27272a;
  color: #d4d4d8;
  border-color: #3f3f46;
}
.btn-download:hover {
  background: #3f3f46;
  color: #fafafa;
  border-color: #52525b;
}

.btn-copy {
  background: #27272a;
  color: #d4d4d8;
  border-color: #3f3f46;
}
.btn-copy:hover {
  background: #3f3f46;
  color: #fafafa;
  border-color: #52525b;
}

.btn-epg-refresh {
  background: #27272a;
  color: #d4d4d8;
  border-color: #3f3f46;
}
.btn-epg-refresh:hover {
  background: #3f3f46;
  color: #fafafa;
  border-color: #52525b;
}

.hint {
  color: #52525b;
  font-size: 11.5px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-toggle {
  background: transparent;
  color: #52525b;
  border: 1px solid #27272a;
  padding: 3px 8px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.summary-toggle:hover {
  color: #a1a1aa;
  border-color: #3f3f46;
}

#last-updated {
  color: #a1a1aa;
  font-weight: 500;
}

.log {
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.log.success {
  color: #34d399;
}
.log.info {
  color: #818cf8;
}
.log.warn {
  color: #fbbf24;
}
.log.action {
  color: #c084fc;
}
.log.dim {
  color: #52525b;
  font-size: 12px;
}
.log.error {
  color: #f87171;
}
.log.white {
  color: #e4e4e7;
}

/* ── EPG View ────────────────────────────── */
.epg-view {
  padding: 0px;
  height: 420px;
  min-height: 420px;
  max-height: 62vh;
  overflow-y: auto;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.epg-view::-webkit-scrollbar {
  width: 5px;
}
.epg-view::-webkit-scrollbar-track {
  background: transparent;
}
.epg-view::-webkit-scrollbar-thumb {
  background: #1e1e2a;
  border-radius: 3px;
}

.epg-loading {
  padding: 20px;
}

.epg-grid {
  padding: 0;
}

.epg-channel {
  border-bottom: 1px solid #1a1a22;
}

.epg-channel-header {
  background: #16161d;
  padding: 9px 16px;
  color: #fafafa;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
  position: sticky;
  top: 0;
  z-index: 2;
}

.epg-channel-header:hover {
  background: #1e1e2a;
}

.epg-arrow {
  font-size: 10px;
  color: #52525b;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.epg-channel.open .epg-arrow {
  transform: rotate(90deg);
}

.epg-ch-name {
  flex-shrink: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-now {
  color: #34d399;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: right;
}

.epg-now-time {
  color: #818cf8;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
}

.epg-programs {
  display: none;
}

.epg-channel.open .epg-programs {
  display: block;
}

.epg-program {
  padding: 6px 16px 6px 28px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid #111116;
  transition: background 0.1s;
}

.epg-program:hover {
  background: #1a1a28;
}

.epg-program.current {
  background: #1a2a1a;
  border-left: 3px solid #34d399;
  padding-left: 25px;
}

.epg-time {
  color: #818cf8;
  font-size: 11px;
  white-space: nowrap;
  min-width: 85px;
  font-weight: 500;
}

.epg-title {
  color: #e4e4e7;
  font-size: 12px;
  flex: 1;
}

.epg-desc {
  color: #52525b;
  font-size: 11px;
  margin-top: 1px;
}

.epg-empty {
  padding: 20px;
  color: #52525b;
  text-align: center;
}

.epg-footer {
  padding: 12px 16px;
  color: #3f3f46;
  font-size: 11px;
  text-align: center;
  border-top: 1px solid #1a1a22;
}
