* { box-sizing: border-box; }

:root {
  --bg: #eef4fb;
  --bg-accent: #dfeeff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-soft: #f5f9ff;
  --line: rgba(117, 139, 172, 0.2);
  --line-strong: rgba(86, 111, 151, 0.26);
  --text: #102033;
  --muted: #5e7087;
  --brand: #0b7fab;
  --brand-strong: #0f5f87;
  --brand-soft: #e0f3fb;
  --teal: #0d9488;
  --danger: #c02245;
  --shadow-lg: 0 24px 70px rgba(22, 48, 84, 0.16);
  --shadow-md: 0 16px 40px rgba(24, 58, 101, 0.12);
  --shadow-sm: 0 10px 22px rgba(34, 61, 100, 0.09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(145, 210, 255, 0.6), transparent 28%),
    radial-gradient(circle at top right, rgba(177, 236, 221, 0.4), transparent 24%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 52%, #e9f1fb 100%);
  color: var(--text);
}

body {
  position: relative;
  overflow-x: hidden;
}

.page-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(26px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

.page-glow-a {
  width: 300px;
  height: 300px;
  background: rgba(63, 161, 255, 0.22);
  top: -40px;
  left: -80px;
}

.page-glow-b {
  width: 260px;
  height: 260px;
  background: rgba(20, 184, 166, 0.18);
  right: -70px;
  top: 180px;
}

.container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 18px;
  padding: 34px 18px;
}

.hero-block {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.hero-block h1,
h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.hero-block p,
p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-block p {
  max-width: 560px;
  font-size: 15px;
}

.schedule-page-card {
  width: min(94vw, 560px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.92));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 18px;
}

.google-btn {
  margin: 18px auto 0;
  padding: 14px 22px;
  border: 1px solid rgba(120, 148, 189, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.google-btn:hover {
  box-shadow: 0 20px 36px rgba(24, 58, 101, 0.14);
  border-color: rgba(58, 135, 196, 0.36);
  transform: translateY(-2px);
}

.google-btn:active {
  transform: translateY(0);
}

.google-g {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: conic-gradient(from 220deg, #ea4335, #fbbc05, #34a853, #4285f4, #ea4335);
  color: #ffffff;
  font-weight: 700;
  font-family: Arial, sans-serif;
}

.hidden {
  display: none !important;
}

.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.success-toast {
  min-width: 280px;
  max-width: min(92vw, 360px);
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f9f52, #22c55e);
  color: #ffffff;
  box-shadow: 0 22px 48px rgba(20, 184, 90, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.24);
  transform: translateY(-8px);
  opacity: 0;
  animation: toastInOut 3.2s ease forwards;
}

.success-toast-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.success-toast-text {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
}

.channel-profile {
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 248, 255, 0.92));
  position: relative;
  overflow: hidden;
  width: min(94vw, 1080px);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.channel-profile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 140px;
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.18), transparent 44%),
    radial-gradient(circle at 88% 0%, rgba(20, 184, 166, 0.16), transparent 38%);
  pointer-events: none;
}

.channel-avatar {
  width: 132px;
  height: 132px;
  margin: 0 auto 14px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
  color: #ffffff;
  background: radial-gradient(circle at 30% 30%, #ff4f4f, #d30000 72%);
  background-repeat: no-repeat;
  border: 4px solid #ffffff;
  box-shadow: 0 14px 32px rgba(13, 44, 83, 0.18);
}

.channel-avatar.connected-live {
  isolation: isolate;
}

.channel-avatar.connected-live::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(24, 196, 94, 0) 0deg,
    rgba(24, 196, 94, 0) 110deg,
    rgba(24, 196, 94, 0.95) 160deg,
    rgba(24, 196, 94, 0.25) 215deg,
    rgba(24, 196, 94, 0) 265deg,
    rgba(24, 196, 94, 0) 360deg
  );
  z-index: -1;
  animation: avatarRingRun 1.5s linear infinite;
}

.channel-avatar.connected-live::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(24, 196, 94, 0.22);
  z-index: -1;
}

#channelTitle {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.03em;
}

#channelSub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.automation-panel {
  margin-top: 24px;
  padding: 20px;
  text-align: left;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 255, 0.92));
  border: 1px solid rgba(158, 188, 223, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), var(--shadow-sm);
  display: grid;
  gap: 12px;
}

.automation-panel h3 {
  margin: 0 0 2px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.panel-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
}

.saved-schedule-box {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(245, 250, 255, 0.98), rgba(236, 244, 255, 0.94));
  border: 1px solid rgba(125, 165, 212, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  display: grid;
  gap: 6px;
}

.saved-schedule-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #60748f;
}

.saved-schedule-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}

.saved-schedule-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.upload-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-strong);
  text-decoration: none;
}

.upload-link:hover {
  text-decoration: underline;
}

.run-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.run-info-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border: 1px solid rgba(130, 164, 206, 0.18);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 6px;
}

.run-info-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
}

.run-countdown {
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: #34506e;
}

.field-input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid rgba(127, 155, 193, 0.28);
  background: rgba(255, 255, 255, 0.98);
  font-size: 15px;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field-input:focus {
  outline: none;
  border-color: rgba(36, 130, 196, 0.48);
  box-shadow: 0 0 0 4px rgba(34, 197, 247, 0.14);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}

.field-select {
  appearance: none;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.single-action {
  grid-template-columns: 1fr;
}

.primary-btn,
.secondary-btn {
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-btn {
  border: 1px solid rgba(11, 127, 171, 0.2);
  background: linear-gradient(135deg, var(--brand), #0ea5c6);
  color: #ffffff;
  box-shadow: 0 18px 30px rgba(14, 125, 177, 0.24);
}

.secondary-btn {
  border: 1px solid rgba(127, 155, 193, 0.24);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:hover {
  box-shadow: 0 22px 36px rgba(14, 125, 177, 0.3);
}

.secondary-btn.is-running {
  border-color: rgba(13, 148, 136, 0.36);
  background: #ecfeff;
  color: var(--teal);
}

.secondary-btn.is-error {
  border-color: rgba(220, 38, 38, 0.3);
  background: #fef2f2;
  color: #b91c1c;
}

.automation-status {
  margin-top: 4px;
  font-size: 13px;
  color: var(--brand-strong);
  line-height: 1.5;
}

.logs-panel {
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, #10223b 0%, #0b1527 100%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 22px 44px rgba(9, 17, 33, 0.24);
  display: grid;
  gap: 10px;
}

.logs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logs-refresh-btn {
  padding: 9px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.terminal-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(71, 85, 105, 0.26);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #22c55e; }

.terminal-title {
  margin-left: 4px;
  font-size: 12px;
  color: #94a3b8;
  font-family: Consolas, "Courier New", monospace;
}

.logs-viewer {
  margin: 0;
  min-height: 190px;
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.94);
  color: #93f5b6;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(51, 65, 85, 0.54);
  font-family: Consolas, "Courier New", monospace;
  position: relative;
}

.logs-viewer::after {
  content: "_";
  color: #22c55e;
  animation: terminalBlink 1s steps(1) infinite;
}

.logout-btn {
  margin-top: 18px;
  padding: 12px 20px;
  border: 1px solid rgba(225, 29, 72, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, background 0.18s ease;
}

.logout-btn:hover {
  background: #fff1f2;
  transform: translateY(-1px);
}

@keyframes avatarRingRun {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastInOut {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  10%, 80% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

@keyframes terminalBlink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 18px 12px;
  }

  .channel-profile,
  .schedule-page-card {
    padding: 20px;
    width: min(96vw, 100%);
  }

  .time-row {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .run-cards-grid {
    grid-template-columns: 1fr;
  }

  .logs-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
