/* Paul Smith Design System - 95:5 Principle */

:root {
  /* Base colors (95% usage) - Warmer, more noticeable */
  --sand-50: #FAF6F0;
  --sand-100: #F5EFE6;
  --sand-200: #E8DFD0;
  --sand-300: #D4C4A8;
  --sand-400: #C4B8A4;
  --sand-600: #8B7E6A;
  --sand-700: #6B5D4F;
  --sand-900: #3D3328;
  
  /* Dark mode colors */
  --earth-950: #1C1917;
  --earth-900: #292524;
  --earth-800: #3F3F46;
  --earth-700: #52525B;
  
  /* Stripe colors (5% usage) */
  --stripe-pink: #E8577A;
  --stripe-orange: #E87838;
  --stripe-yellow: #E8B04B;
  --stripe-green: #52A68D;
  --stripe-cyan: #5BA4B8;
  --stripe-blue: #4F6FA8;
  --stripe-purple: #8B6BA8;
  --stripe-red: #C85450;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--sand-100);
  color: var(--sand-900);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.header {
  background: var(--sand-200);
  border-bottom: 4px solid transparent;
  padding: 1.5rem 0;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(107, 93, 79, 0.1);
  background-image: 
    linear-gradient(var(--sand-200), var(--sand-200)),
    linear-gradient(90deg,
      var(--stripe-pink) 0% 3%,
      var(--stripe-orange) 3% 7%,
      var(--stripe-yellow) 7% 10%,
      #F5EFE6 10% 11.5%,
      var(--stripe-green) 11.5% 16%,
      var(--stripe-cyan) 16% 19%,
      #D4C4A8 19% 21%,
      var(--stripe-blue) 21% 26%,
      var(--stripe-purple) 26% 29%,
      var(--stripe-pink) 29% 31%,
      #6B5744 31% 33%,
      var(--stripe-orange) 33% 38%,
      var(--stripe-yellow) 38% 42%,
      var(--stripe-green) 42% 44%,
      #F5EFE6 44% 45%,
      var(--stripe-cyan) 45% 49%,
      var(--stripe-blue) 49% 53%,
      #3D2F1F 53% 54.5%,
      var(--stripe-purple) 54.5% 58%,
      var(--stripe-red) 58% 62%,
      var(--stripe-pink) 62% 65%,
      #D4C4A8 65% 67%,
      var(--stripe-orange) 67% 72%,
      var(--stripe-yellow) 72% 74%,
      var(--stripe-green) 74% 78%,
      #F5EFE6 78% 79%,
      var(--stripe-cyan) 79% 83%,
      var(--stripe-blue) 83% 87%,
      var(--stripe-purple) 87% 90%,
      #6B5744 90% 92%,
      var(--stripe-pink) 92% 95%,
      var(--stripe-orange) 95% 98%,
      var(--stripe-red) 98% 100%
    );
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
}

.header h1 {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--sand-900);
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--sand-600);
  font-size: 0.875rem;
}

/* Alert (API key warning) */
.alert {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-left: 4px solid var(--stripe-red);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.alert-title {
  font-weight: 600;
  color: #991B1B;
  margin-bottom: 0.5rem;
}

.alert-message {
  color: #7F1D1D;
  font-size: 0.875rem;
}

/* Main layout */
.main-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Project selector sidebar */
.project-selector {
  background: var(--sand-200);
  border: 2px solid var(--sand-300);
  border-radius: 0.5rem;
  padding: 1.5rem;
  height: fit-content;
  box-shadow: 0 1px 3px rgba(107, 93, 79, 0.08);
}

.project-selector h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--sand-900);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card {
  background: #FFFFFF;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(107, 93, 79, 0.05);
}

.project-card:hover {
  border-color: var(--stripe-orange);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(232, 120, 56, 0.15);
}

/* Stripe pattern is now applied via the .border-stripe class above */

.project-name {
  font-weight: 500;
  color: var(--sand-900);
  margin-bottom: 0.25rem;
}

.project-meta {
  font-size: 0.75rem;
  color: var(--sand-600);
}

/* Main content area */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--sand-200);
  border: 2px solid var(--sand-300);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(107, 93, 79, 0.08);
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--sand-900);
}

/* Prompt version selector */
.version-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.version-btn {
  background: #FFFFFF;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--sand-900);
  font-size: 0.875rem;
  box-shadow: 0 1px 2px rgba(107, 93, 79, 0.05);
}

.version-btn:hover {
  border-color: var(--stripe-orange);
  box-shadow: 0 2px 4px rgba(232, 120, 56, 0.15);
  transform: translateY(-1px);
}

/* Stripe pattern is now applied via the .border-stripe class above */

/* Prompt preview */
.prompt-preview {
  background: #FFFFFF;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--sand-700);
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 1px 2px rgba(107, 93, 79, 0.05);
}

/* Input area */
.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--sand-900);
  font-size: 0.875rem;
}

.input-textarea {
  width: 100%;
  min-height: 150px;
  padding: 0.75rem;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  resize: vertical;
  transition: all 0.2s;
  background: #FFFFFF;
  color: var(--sand-900);
  box-shadow: inset 0 1px 2px rgba(107, 93, 79, 0.05);
}

.input-textarea:focus {
  outline: none;
  border-color: var(--stripe-orange);
  box-shadow: 0 0 0 3px rgba(232, 120, 56, 0.1), inset 0 1px 2px rgba(107, 93, 79, 0.05);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  font-size: 0.875rem;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid var(--sand-300);
  font-size: 0.75rem;
  background: #FFFFFF;
  color: var(--sand-700);
  box-shadow: 0 1px 2px rgba(107, 93, 79, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-small:hover {
  border-color: var(--stripe-orange);
  box-shadow: 0 2px 4px rgba(232, 120, 56, 0.15);
  transform: translateY(-1px);
  color: var(--sand-900);
}

.btn-primary {
  background: var(--sand-300);
  color: var(--sand-900);
  border-color: var(--sand-400);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(107, 93, 79, 0.15);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(232, 120, 56, 0.2);
  background: 
    linear-gradient(var(--sand-200), var(--sand-200)) padding-box,
    linear-gradient(90deg,
      var(--stripe-pink) 0% 3%,
      var(--stripe-orange) 3% 7%,
      var(--stripe-yellow) 7% 10%,
      #F5EFE6 10% 11.5%,
      var(--stripe-green) 11.5% 16%,
      var(--stripe-cyan) 16% 19%,
      #D4C4A8 19% 21%,
      var(--stripe-blue) 21% 26%,
      var(--stripe-purple) 26% 29%,
      var(--stripe-pink) 29% 31%,
      #6B5744 31% 33%,
      var(--stripe-orange) 33% 38%,
      var(--stripe-yellow) 38% 42%,
      var(--stripe-green) 42% 44%,
      #F5EFE6 44% 45%,
      var(--stripe-cyan) 45% 49%,
      var(--stripe-blue) 49% 53%,
      #3D2F1F 53% 54.5%,
      var(--stripe-purple) 54.5% 58%,
      var(--stripe-red) 58% 62%,
      var(--stripe-pink) 62% 65%,
      #D4C4A8 65% 67%,
      var(--stripe-orange) 67% 72%,
      var(--stripe-yellow) 72% 74%,
      var(--stripe-green) 74% 78%,
      #F5EFE6 78% 79%,
      var(--stripe-cyan) 79% 83%,
      var(--stripe-blue) 83% 87%,
      var(--stripe-purple) 87% 90%,
      #6B5744 90% 92%,
      var(--stripe-pink) 92% 95%,
      var(--stripe-orange) 95% 98%,
      var(--stripe-red) 98% 100%
    ) border-box;
  border: 3px solid transparent;
}

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

/* Results area */
.results {
  background: #FFFFFF;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 1.5rem;
  min-height: 200px;
  box-shadow: inset 0 1px 2px rgba(107, 93, 79, 0.05);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--sand-300);
}

.results-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--sand-900);
}

.results-meta {
  font-size: 0.75rem;
  color: var(--sand-600);
}

.results-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  color: var(--sand-900);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sand-600);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
}

.spinner {
  border: 3px solid var(--sand-300);
  border-top-color: var(--stripe-orange);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.error {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-left: 4px solid var(--stripe-red);
  padding: 1rem;
  border-radius: 0.375rem;
  color: #7F1D1D;
}

/* Success indicator */
.success-badge {
  display: inline-block;
  background: #ECFDF5;
  color: #065F46;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--stripe-green);
}

/* Streaming indicator */
.streaming-badge {
  display: inline-block;
  background: #EFF6FF;
  color: #1E40AF;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--stripe-blue);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Paul Smith Stripe Pattern - The Signature 5% Accent */
.border-stripe {
  border: 3px solid transparent;
  background: 
    linear-gradient(white, white) padding-box,
    linear-gradient(90deg,
      /* Complex rhythmic pattern with varying widths */
      var(--stripe-pink) 0% 3%,
      var(--stripe-orange) 3% 7%,
      var(--stripe-yellow) 7% 10%,
      #F5EFE6 10% 11.5%,  /* cream - thin */
      var(--stripe-green) 11.5% 16%,
      var(--stripe-cyan) 16% 19%,
      #D4C4A8 19% 21%,  /* beige - thin */
      var(--stripe-blue) 21% 26%,
      var(--stripe-purple) 26% 29%,
      var(--stripe-pink) 29% 31%,
      #6B5744 31% 33%,  /* brown - medium */
      var(--stripe-orange) 33% 38%,
      var(--stripe-yellow) 38% 42%,
      var(--stripe-green) 42% 44%,
      #F5EFE6 44% 45%,  /* cream - thin */
      var(--stripe-cyan) 45% 49%,
      var(--stripe-blue) 49% 53%,
      #3D2F1F 53% 54.5%,  /* dark brown - thin */
      var(--stripe-purple) 54.5% 58%,
      var(--stripe-red) 58% 62%,
      var(--stripe-pink) 62% 65%,
      #D4C4A8 65% 67%,  /* beige - medium */
      var(--stripe-orange) 67% 72%,
      var(--stripe-yellow) 72% 74%,
      var(--stripe-green) 74% 78%,
      #F5EFE6 78% 79%,  /* cream - thin */
      var(--stripe-cyan) 79% 83%,
      var(--stripe-blue) 83% 87%,
      var(--stripe-purple) 87% 90%,
      #6B5744 90% 92%,  /* brown - medium */
      var(--stripe-pink) 92% 95%,
      var(--stripe-orange) 95% 98%,
      var(--stripe-red) 98% 100%
    ) border-box;
}

/* Active/Selected state with stripe border */
.project-card.active,
.version-btn.active {
  background: 
    linear-gradient(white, white) padding-box,
    linear-gradient(90deg,
      var(--stripe-pink) 0% 3%,
      var(--stripe-orange) 3% 7%,
      var(--stripe-yellow) 7% 10%,
      #F5EFE6 10% 11.5%,
      var(--stripe-green) 11.5% 16%,
      var(--stripe-cyan) 16% 19%,
      #D4C4A8 19% 21%,
      var(--stripe-blue) 21% 26%,
      var(--stripe-purple) 26% 29%,
      var(--stripe-pink) 29% 31%,
      #6B5744 31% 33%,
      var(--stripe-orange) 33% 38%,
      var(--stripe-yellow) 38% 42%,
      var(--stripe-green) 42% 44%,
      #F5EFE6 44% 45%,
      var(--stripe-cyan) 45% 49%,
      var(--stripe-blue) 49% 53%,
      #3D2F1F 53% 54.5%,
      var(--stripe-purple) 54.5% 58%,
      var(--stripe-red) 58% 62%,
      var(--stripe-pink) 62% 65%,
      #D4C4A8 65% 67%,
      var(--stripe-orange) 67% 72%,
      var(--stripe-yellow) 72% 74%,
      var(--stripe-green) 74% 78%,
      #F5EFE6 78% 79%,
      var(--stripe-cyan) 79% 83%,
      var(--stripe-blue) 83% 87%,
      var(--stripe-purple) 87% 90%,
      #6B5744 90% 92%,
      var(--stripe-pink) 92% 95%,
      var(--stripe-orange) 95% 98%,
      var(--stripe-red) 98% 100%
    ) border-box;
  border: 3px solid transparent;
}

/* Stripe divider for decorative elements */
.stripe-divider {
  height: 4px;
  background: linear-gradient(90deg,
    var(--stripe-pink) 0% 3%,
    var(--stripe-orange) 3% 7%,
    var(--stripe-yellow) 7% 10%,
    #F5EFE6 10% 11.5%,
    var(--stripe-green) 11.5% 16%,
    var(--stripe-cyan) 16% 19%,
    #D4C4A8 19% 21%,
    var(--stripe-blue) 21% 26%,
    var(--stripe-purple) 26% 29%,
    var(--stripe-pink) 29% 31%,
    #6B5744 31% 33%,
    var(--stripe-orange) 33% 38%,
    var(--stripe-yellow) 38% 42%,
    var(--stripe-green) 42% 44%,
    #F5EFE6 44% 45%,
    var(--stripe-cyan) 45% 49%,
    var(--stripe-blue) 49% 53%,
    #3D2F1F 53% 54.5%,
    var(--stripe-purple) 54.5% 58%,
    var(--stripe-red) 58% 62%,
    var(--stripe-pink) 62% 65%,
    #D4C4A8 65% 67%,
    var(--stripe-orange) 67% 72%,
    var(--stripe-yellow) 72% 74%,
    var(--stripe-green) 74% 78%,
    #F5EFE6 78% 79%,
    var(--stripe-cyan) 79% 83%,
    var(--stripe-blue) 83% 87%,
    var(--stripe-purple) 87% 90%,
    #6B5744 90% 92%,
    var(--stripe-pink) 92% 95%,
    var(--stripe-orange) 95% 98%,
    var(--stripe-red) 98% 100%
  );
  border-radius: 2px;
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.tab-btn {
  background: var(--sand-300);
  border: 2px solid var(--sand-400);
  border-radius: 0.375rem;
  padding: 0.5rem 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--sand-700);
  font-size: 0.875rem;
}

.tab-btn:hover:not(:disabled) {
  background: var(--sand-200);
  border-color: var(--stripe-orange);
}

.tab-btn.active {
  background: 
    linear-gradient(white, white) padding-box,
    linear-gradient(90deg,
      var(--stripe-pink) 0% 3%,
      var(--stripe-orange) 3% 7%,
      var(--stripe-yellow) 7% 10%,
      #F5EFE6 10% 11.5%,
      var(--stripe-green) 11.5% 16%,
      var(--stripe-cyan) 16% 19%,
      #D4C4A8 19% 21%,
      var(--stripe-blue) 21% 26%,
      var(--stripe-purple) 26% 29%,
      var(--stripe-pink) 29% 31%,
      #6B5744 31% 33%,
      var(--stripe-orange) 33% 38%,
      var(--stripe-yellow) 38% 42%,
      var(--stripe-green) 42% 44%,
      #F5EFE6 44% 45%,
      var(--stripe-cyan) 45% 49%,
      var(--stripe-blue) 49% 53%,
      #3D2F1F 53% 54.5%,
      var(--stripe-purple) 54.5% 58%,
      var(--stripe-red) 58% 62%,
      var(--stripe-pink) 62% 65%,
      #D4C4A8 65% 67%,
      var(--stripe-orange) 67% 72%,
      var(--stripe-yellow) 72% 74%,
      var(--stripe-green) 74% 78%,
      #F5EFE6 78% 79%,
      var(--stripe-cyan) 79% 83%,
      var(--stripe-blue) 83% 87%,
      var(--stripe-purple) 87% 90%,
      #6B5744 90% 92%,
      var(--stripe-pink) 92% 95%,
      var(--stripe-orange) 95% 98%,
      var(--stripe-red) 98% 100%
    ) border-box;
  border: 3px solid transparent;
  color: var(--sand-900);
}

.tab-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* History Grid */
.history-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* History Cards */
.history-card {
  background: #FFFFFF;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(107, 93, 79, 0.05);
}

.history-card:hover {
  border-color: var(--stripe-orange);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(232, 120, 56, 0.15);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.history-version-badge {
  background: var(--sand-300);
  color: var(--sand-900);
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.history-date {
  font-size: 0.75rem;
  color: var(--sand-600);
}

.history-preview {
  font-size: 0.875rem;
  color: var(--sand-700);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--sand-600);
}

/* History Detail */
.history-detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.history-detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-detail-label {
  font-weight: 600;
  color: var(--sand-900);
  font-size: 0.875rem;
}

.history-detail-content {
  background: #FFFFFF;
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  color: var(--sand-900);
  font-size: 0.875rem;
  max-height: 300px;
  overflow-y: auto;
}

.history-detail-meta {
  background: var(--sand-100);
  border: 2px solid var(--sand-300);
  border-radius: 0.375rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  font-size: 0.875rem;
}

.history-detail-meta div {
  color: var(--sand-700);
}

.history-detail-meta strong {
  color: var(--sand-900);
}

/* Responsive */
@media (max-width: 768px) {
  .main-grid, .history-grid {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 1rem;
  }
  
  .tab-navigation {
    flex-wrap: wrap;
  }
  
  .history-detail-meta {
    grid-template-columns: 1fr;
  }
}

