/* ============================================
   LMCTFY - Let Me Claude That For You
   CSS Variables & Base Styles
   ============================================ */

:root {
  /* Claude Brand Colors */
  --claude-orange: #D97757;
  --claude-orange-hover: #C86847;
  --claude-orange-light: rgba(217, 119, 87, 0.1);

  /* Background Colors */
  --bg-cream: #FAF9F5;
  --bg-card: #E8E4DD;
  --bg-hover: #F5EDE6;
  --bg-input: #FFFFFF;

  /* Claude Interface Colors (Light mode) */
  --claude-bg: #FAF9F5;
  --claude-bg-light: #FFFFFF;
  --claude-input-bg: #F5F3EF;
  --claude-border: #E5E0D8;

  /* Text Colors */
  --text-primary: #1A1A1A;
  --text-secondary: #5C5C5C;
  --text-muted: #8C8C8C;
  --text-light: #5C5C5C;
  --text-claude: #1A1A1A;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Animation */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --typing-speed: 80ms;
}

/* ============================================
   Dark Mode (System Preference)
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    /* Background Colors - exact Claude palette */
    --bg-cream: #262624;
    --bg-card: #30302E;
    --bg-hover: #3D3B39;
    --bg-input: #30302E;

    /* Claude Interface Colors (Dark mode) */
    --claude-bg: #2D2A26;
    --claude-bg-light: #3D3833;
    --claude-input-bg: #454039;
    --claude-border: #5C564E;

    /* Text Colors */
    --text-primary: #F5F5F5;
    --text-secondary: #9C9A92;
    --text-muted: #6E6D68;
    --text-light: #E8E4DD;
    --text-claude: #F5F5F5;

    /* Shadows (darker for dark mode) */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  }

  /* Adjust specific elements for dark mode */
  .query-input {
    border-color: var(--bg-hover);
  }

  .modal-content {
    background: var(--bg-card);
  }

  .share-url {
    background: var(--bg-cream);
    border-color: var(--bg-hover);
  }

  .btn-cancel {
    border-color: var(--bg-hover);
  }

  .countdown-bar {
    background: var(--bg-hover);
  }

  .skip-btn {
    background: var(--bg-card);
    border-color: var(--bg-hover);
  }

  .skip-btn:hover {
    background: var(--bg-hover);
  }
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-cream);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
  border: none;
  outline: none;
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
}

.stage.active {
  opacity: 1;
}

/* ============================================
   Homepage Styles
   ============================================ */

#homepage {
  background: var(--bg-cream);
}

.header {
  padding: 2rem;
  text-align: center;
}

.logo-title {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  width: 2rem;
  height: 2rem;
  color: var(--claude-orange);
}

.logo-large {
  width: 4rem;
  height: 4rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  margin-top: -4rem;
}

.query-form {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.query-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--bg-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.query-input::placeholder {
  color: var(--text-muted);
}

.query-input:focus {
  border-color: var(--claude-orange);
  box-shadow: 0 0 0 3px var(--claude-orange-light);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: white;
  background: var(--claude-orange);
  border-radius: var(--radius-sm);
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--claude-orange-hover);
}

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

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  border-radius: var(--radius-md);
}

.footer {
  padding: 1.5rem 2rem;
  text-align: center;
}

.footer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer a {
  color: var(--claude-orange);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--claude-orange-hover);
}

/* ============================================
   Playback Styles
   ============================================ */

#playback {
  background: var(--bg-cream);
  position: relative;
}

.skip-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--claude-border);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.3s, background 0.2s, transform 0.1s;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.skip-btn:not(.hidden) {
  opacity: 1;
}

.skip-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.02);
}

.skip-btn:active {
  transform: scale(0.98);
}

/* Stage 1: Branding */
.stage-branding {
  background: var(--bg-cream);
}

.branding-content {
  text-align: center;
  animation: brandingPulse 2s var(--ease-in-out) infinite;
}

.branding-content h2 {
  margin-top: 1rem;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

@keyframes brandingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Stage 2: Claude Interface */
.stage-claude {
  background: var(--claude-bg);
}

.browser-mockup {
  width: 90%;
  max-width: 900px;
  height: 70vh;
  max-height: 600px;
  background: var(--claude-bg-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.browser-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--claude-bg);
  border-bottom: 1px solid var(--claude-border);
}

.browser-dots {
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background: #FF5F57; }
.dot-yellow { background: #FFBD2E; }
.dot-green { background: #28CA41; }

.browser-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--claude-input-bg);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-light);
}

.url-icon {
  display: flex;
  color: var(--text-muted);
}

.url-icon svg {
  width: 14px;
  height: 14px;
}

/* Claude Interface Inner */
.claude-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.claude-home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 1.5rem;
}

.claude-greeting {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  color: var(--text-claude);
}

.greeting-emoji {
  font-size: 1.25rem;
}

.claude-input-container {
  width: 100%;
  max-width: 600px;
  background: var(--claude-input-bg);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.claude-input {
  min-height: 24px;
  font-size: 1rem;
  color: var(--text-claude);
  display: flex;
  align-items: center;
}

.typing-text {
  white-space: pre-wrap;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--claude-orange);
  margin-left: 1px;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.claude-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-selector {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  background: var(--claude-bg);
  border-radius: var(--radius-sm);
}

.send-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--claude-orange);
  border-radius: 50%;
  color: white;
  transition: background 0.2s, transform 0.1s;
}

.send-btn svg {
  width: 16px;
  height: 16px;
}

.send-btn:hover {
  background: var(--claude-orange-hover);
}

.send-btn.clicked {
  transform: scale(0.9);
}

/* Chat View */
.claude-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  overflow-y: auto;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.message {
  display: flex;
  gap: 0.75rem;
}

.message-user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.message-user .message-bubble {
  background: var(--claude-input-bg);
  color: var(--text-claude);
  border-bottom-right-radius: 4px;
}

.message-claude {
  align-items: flex-start;
}

.claude-avatar {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--claude-orange);
  flex-shrink: 0;
}

.claude-avatar svg {
  width: 20px;
  height: 20px;
}

/* Thinking Indicator */
.thinking-indicator {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: var(--claude-input-bg);
  border-radius: var(--radius-md);
}

.thinking-dot {
  width: 8px;
  height: 8px;
  background: var(--claude-orange);
  border-radius: 50%;
  animation: thinkingBounce 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinkingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Animated Cursor */
.animated-cursor {
  position: fixed;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.animated-cursor.visible {
  opacity: 1;
}

/* Hide cursor on mobile */
@media (hover: none) and (pointer: coarse) {
  .animated-cursor {
    display: none;
  }
}

/* Stage 3: Ending */
.stage-ending {
  background: var(--bg-cream);
}

.ending-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.sarcastic-message {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  animation: fadeInUp 0.6s var(--ease-out);
}

.ending-footer {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.ending-footer a {
  color: var(--claude-orange);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ending-footer a:hover {
  color: var(--claude-orange-hover);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Share Modal
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-input);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 480px;
  animation: modalSlideIn 0.3s var(--ease-out);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.modal-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.share-url-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.share-url {
  flex: 1;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--bg-hover);
  border: 1px solid var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  background: var(--claude-orange);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.btn-copy svg {
  width: 16px;
  height: 16px;
}

.btn-copy:hover {
  background: var(--claude-orange-hover);
}

.btn-copy.copied {
  background: #28CA41;
}

.btn-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.btn-preview svg {
  width: 16px;
  height: 16px;
}

.btn-preview:hover {
  background: var(--bg-card);
}

.share-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.share-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.share-btn svg {
  width: 20px;
  height: 20px;
}

.share-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.share-btn:active {
  transform: scale(0.95);
}

/* Countdown */
.countdown-container {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--bg-card);
  text-align: center;
}

.countdown-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.subscription-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

#countdown-number {
  font-weight: 600;
  color: var(--claude-orange);
  font-variant-numeric: tabular-nums;
}

.countdown-bar {
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.countdown-progress {
  height: 100%;
  background: var(--claude-orange);
  width: 100%;
  transform-origin: left;
  transition: transform 1s linear;
}

.btn-cancel {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-cancel:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.countdown-container.cancelled .countdown-text {
  color: var(--text-muted);
}

.countdown-container.cancelled .countdown-progress {
  background: var(--text-muted);
}

/* ============================================
   Toast Notification
   ============================================ */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.875rem 1.5rem;
  background: var(--claude-orange);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s var(--ease-out);
  z-index: 1100;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 640px) {
  h1 {
    font-size: 1.25rem;
  }

  .logo {
    width: 1.5rem;
    height: 1.5rem;
  }

  .container {
    padding: 1.5rem;
  }

  .query-input {
    padding: 0.875rem 1rem;
  }

  .browser-mockup {
    width: 95%;
    height: 60vh;
    border-radius: var(--radius-md);
  }

  .browser-header {
    padding: 0.5rem 0.75rem;
  }

  .browser-dots {
    gap: 0.375rem;
  }

  .dot {
    width: 10px;
    height: 10px;
  }

  .claude-greeting {
    font-size: 1.25rem;
  }

  .sarcastic-message {
    font-size: 1.5rem;
  }

  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }

  .share-url-container {
    flex-wrap: wrap;
  }

  .share-url-container .share-url {
    flex: 1 1 100%;
    margin-bottom: 0.5rem;
  }

  .share-url-container .btn-copy,
  .share-url-container .btn-preview {
    flex: 1;
  }
}

/* ============================================
   Print Styles (hide everything)
   ============================================ */

@media print {
  body {
    display: none;
  }
}
