/* Sheepdog - Main CSS Foundation - Only styles used by index.html */

/* Import canonical orb styles */
@import url('orb.css');

/* CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

/* Root Variables */
:root {
  /* Primary Colors */
  --primary-green: #16a34a;
  --primary-green-light: #22c55e;
  --primary-green-dark: #15803d;
  --primary-green-bg: #F6FFED;

  /* Text Colors */
  --text-primary: #343A40;
  --text-secondary: #6C757D;

  /* Border Colors */
  --border-color: #DEE2E6;

  /* Background Colors */
  --bg-secondary: #F8F9FA;

  /* Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Base Styles */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: #FAFAFA;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Typography */
h1, h2, h3 {
  margin-bottom: 0.5em;
  font-weight: 600;
}

h1 { font-size: 2rem; }

/* Haptic Feedback */
@keyframes haptic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.97); }
}

.haptic-touch:active {
  animation: haptic 0.1s ease;
}

/* CTA Text Input Component */
.cta-text-input {
  background: #F5F5F5;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px;
  font-size: 18px;
  text-align: center;
  font-weight: 600;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  width: 100%;
}

.cta-text-input:focus {
  outline: none;
  background: white;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(82, 196, 26, 0.1);
}

.cta-text-input::placeholder {
  color: #BFBFBF;
  font-weight: 400;
}

/* CTA Code Input Variant */
.cta-code-input {
  letter-spacing: 2px;
  text-transform: uppercase;
}

.cta-code-input::placeholder {
  letter-spacing: 1px;
}

/* CTA Dropdown - Matches CTA input style but with dropdown arrow */
.cta-dropdown {
  background: #F5F5F5;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px 48px 16px 16px;
  font-size: 18px;
  text-align: center;
  font-weight: 600;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  cursor: pointer;
  position: relative;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 24px;
}

.cta-dropdown:focus {
  outline: none;
  background-color: white;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(82, 196, 26, 0.1);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352C41A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.cta-dropdown:hover {
  background-color: #FAFAFA;
}

/* Regular Dropdown - Lighter weight for inline forms */
.dropdown {
  background: white;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  padding: 12px 36px 12px 12px;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23BFBFBF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
}

.dropdown:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 2px rgba(82, 196, 26, 0.1);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352C41A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.dropdown:hover {
  border-color: var(--primary-green-light);
  background-color: #FAFAFA;
}

.dropdown option {
  font-weight: 500;
}

/* Animation Utilities */
.animate-in {
  animation: slideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.delay-1 { animation-delay: 0.1s; animation-fill-mode: both; }
.delay-2 { animation-delay: 0.2s; animation-fill-mode: both; }
.delay-3 { animation-delay: 0.3s; animation-fill-mode: both; }
.delay-4 { animation-delay: 0.4s; animation-fill-mode: both; }

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Transition animations used by JavaScript */
.fade-away {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.zoom-out {
  animation: zoomOut 0.5s ease-out forwards;
}

@keyframes zoomOut {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 0 rgba(68, 166, 88, 0.4);
    border-color: var(--primary-green);
  }
  50% {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 10px rgba(68, 166, 88, 0);
    border-color: var(--primary-green);
  }
  100% {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 0 rgba(68, 166, 88, 0.4);
    border-color: var(--primary-green);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.transitioning-out {
  overflow: hidden;
}

.transitioning-out::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(68, 166, 88, 0.02) 50%,
    rgba(68, 166, 88, 0.05) 100%);
  pointer-events: none;
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

/* Regular text input (non-CTA) */
.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: white;
  transition: all var(--transition-fast);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(68, 166, 88, 0.1);
}

/* Textarea */
.textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.textarea:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

/* Regular dropdown (non-CTA) */
.dropdown {
  width: 100%;
  padding: 12px 16px;
  padding-right: 40px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: white;
  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='%234a5568' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(68, 166, 88, 0.1);
}

/* Range/Slider input */
.range-input {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  appearance: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-green);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(68, 166, 88, 0.1);
}

.range-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-green);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.range-input::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(68, 166, 88, 0.1);
}

/* Range label wrapper */
.range-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================
   UTILITY COMPONENTS
   ============================================ */

/* Code/Log display */
.code-display {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: #1a202c;
  color: #68d391;
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  line-height: 1.5;
}

.code-display.light {
  background: #f7fafc;
  color: #2d3748;
}

/* Status Display Component */
.status-display {
  padding: 15px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-disconnected {
  background: #fed7d7;
  color: #742a2a;
}

.status-connecting {
  background: #bee3f8;
  color: #2c5282;
  animation: pulse 1.5s infinite;
}

.status-connected {
  background: #c6f6d5;
  color: #22543d;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Status Indicator */
.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.connected {
  background: #48bb78;
  animation: blink 2s infinite;
}

.status-indicator.disconnected {
  background: #e53e3e;
}

.status-indicator.connecting {
  background: #4299e1;
  animation: blink 0.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Grid utilities */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Shared Widget Styles
   Orb styles imported from orb.css via @import above
   ============================================ */

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-green);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* Toggle Switch — lesson-interactive variant */
.toggle-switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-switch__slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-switch__slider {
  background-color: var(--primary-green);
}

.toggle-switch input:checked + .toggle-switch__slider:before {
  transform: translateX(24px);
}

/* Form Group */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-group .description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-green);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Character Count */
.character-count {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1e293b;
}

.empty-state-desc {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

/* Error & Success Messages */
.error-message {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  text-align: center;
}

.success-message {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  text-align: center;
}

/* Save/Cancel Buttons */
.btn-save {
  padding: 12px 32px;
  background: var(--primary-green);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-save:hover {
  background: var(--primary-green-dark);
}

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-cancel {
  padding: 12px 32px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: var(--bg-secondary);
}

/* Skip Button */
.btn-skip {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  padding: 10px 20px;
  transition: color 0.2s;
}

.btn-skip:hover {
  color: var(--text-primary);
}

/* Section Header (collapsible) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

