:root {
  --nutech-red: #FF4B00;
  --nutech-amber: #FE9900;
  --nutech-gradient: linear-gradient(135deg, #FF4B00 0%, #FE9900 100%);
  --nutech-gradient-hover: linear-gradient(135deg, #E04200 0%, #E88B00 100%);
  --nutech-glow: rgba(255, 75, 0, 0.35);
  --bg-dark: #0B0E14;
  --bg-surface: rgba(18, 22, 32, 0.82);
  --bg-card: rgba(26, 32, 46, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 75, 0, 0.5);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --success: #10B981;
  --danger: #EF4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Ambient glow background */
.ambient-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 75, 0, 0.14) 0%, rgba(254, 153, 0, 0.06) 45%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  transition: all 0.8s ease;
}

body.in-call .ambient-glow {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(255, 75, 0, 0.22) 0%, rgba(254, 153, 0, 0.12) 50%, transparent 75%);
}

/* App container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 1;
}

/* Top Navigation Bar */
header.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-glass);
}

.brand-section {
  display: flex;
  align-items: center;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--nutech-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.status-badge-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.badge.pulse-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.badge.online.pulse-dot::before {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(0.95); opacity: 1; }
}

/* Main Interactive Stage */
main.call-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 20px 110px; /* Generous bottom padding for floating dock */
  overflow-y: auto;
}

/* Canvas container */
.orb-container {
  position: relative;
  width: 320px;
  height: 320px;
  max-width: 80vw;
  max-height: 80vw;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

#orbCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}

.orb-center-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(11, 14, 20, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: all 0.4s ease;
}

.orb-center-icon svg {
  width: 28px;
  height: 28px;
  fill: var(--nutech-amber);
  transition: all 0.3s ease;
}

body.in-call .orb-center-icon {
  border-color: rgba(255, 75, 0, 0.4);
  box-shadow: 0 0 30px rgba(255, 75, 0, 0.3);
}

/* State Status Banner */
.state-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 500px;
  margin-bottom: 16px;
}

.state-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--nutech-amber);
  margin-bottom: 6px;
  transition: color 0.3s ease;
}

.state-subtext {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  min-height: 24px;
}

/* Realtime Captions Ticker */
.captions-box {
  width: 100%;
  max-width: 580px;
  min-height: 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

.captions-box.has-text {
  border-color: rgba(255, 75, 0, 0.3);
  box-shadow: 0 8px 24px rgba(255, 75, 0, 0.15);
}

/* Call Duration HUD */
.duration-hud {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
  display: none;
}

body.in-call .duration-hud {
  display: block;
}

/* Floating Bottom Control Dock (100% Mobile Optimized) */
footer.control-dock {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  padding: 0;
  margin: 0;
  z-index: 99;
  pointer-events: none;
}

.dock-pill {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(18, 22, 32, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  padding: 10px 14px;
  border-radius: 44px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(255, 75, 0, 0.12);
  pointer-events: auto;
}

.btn-circle {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-circle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-circle:active {
  transform: scale(0.94);
}

.btn-circle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.btn-circle.active {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-circle.active svg {
  fill: var(--danger);
}

.btn-circle svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Primary Call Button */
.btn-call-primary {
  height: 50px;
  flex: 1;
  min-width: 140px;
  padding: 0 16px;
  border-radius: 30px;
  border: none;
  background: var(--nutech-gradient);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow: 0 8px 24px var(--nutech-glow);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  white-space: nowrap;
}

.btn-call-primary:hover {
  background: var(--nutech-gradient-hover);
  box-shadow: 0 10px 28px rgba(255, 75, 0, 0.5);
}

.btn-call-primary:active {
  transform: scale(0.97);
}

.btn-call-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-call-primary svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

body.in-call .btn-call-primary {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.4);
}

body.in-call .btn-call-primary:hover {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.5);
}

/* Slide-over Transcripts Panel */
.drawer-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-glass);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.drawer-panel.open {
  right: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-glass);
}

.drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--nutech-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.hermes {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble .sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
  text-transform: uppercase;
}

/* Settings Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--nutech-red);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  header.top-bar {
    padding: 12px 16px;
  }
  .brand-title {
    font-size: 16px;
  }
  .orb-container {
    width: 250px;
    height: 250px;
    margin-bottom: 16px;
  }
  .orb-center-icon {
    width: 56px;
    height: 56px;
  }
  .orb-center-icon svg {
    width: 24px;
    height: 24px;
  }
  .state-subtext {
    font-size: 14px;
  }
  .captions-box {
    font-size: 13px;
    padding: 10px 14px;
  }
  footer.control-dock {
    width: calc(100% - 24px);
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
  .dock-pill {
    padding: 8px 12px;
    gap: 8px;
  }
  .btn-circle {
    width: 46px;
    height: 46px;
    min-width: 46px;
  }
  .btn-circle svg {
    width: 20px;
    height: 20px;
  }
  .btn-call-primary {
    height: 46px;
    font-size: 14px;
    padding: 0 14px;
  }
  .drawer-panel {
    width: 100%;
    right: -100%;
  }
}
