<script setup lang="ts">
import type { ThemeVariables } from '../../stores/theme'

defineProps<{
  variables: ThemeVariables | null
}>()
</script>

<template>
  <div class="theme-preview">
    <div class="preview-section">
      <h4>Colors</h4>
      <div class="color-swatches">
        <div class="swatch" style="background: var(--bg-primary)">
          <span>Primary</span>
        </div>
        <div class="swatch" style="background: var(--bg-secondary)">
          <span>Secondary</span>
        </div>
        <div class="swatch" style="background: var(--bg-hover)">
          <span>Hover</span>
        </div>
        <div class="swatch" style="background: var(--bg-tertiary)">
          <span>Tertiary</span>
        </div>
      </div>
    </div>

    <div class="preview-section">
      <h4>Text</h4>
      <div class="text-samples">
        <p style="color: var(--text-primary)">Primary Text</p>
        <p style="color: var(--text-secondary)">Secondary Text</p>
        <p style="color: var(--text-muted)">Muted Text</p>
      </div>
    </div>

    <div class="preview-section">
      <h4>Components</h4>
      <div class="component-samples">
        <button class="sample-btn primary">Primary Button</button>
        <button class="sample-btn secondary">Secondary</button>
        <button class="sample-btn danger">Danger</button>
      </div>

      <div class="sample-card">
        <h5>Sample Card</h5>
        <p>This is a preview of how cards will look with the current theme.</p>
        <div class="card-actions">
          <button class="sample-btn primary small">Action</button>
        </div>
      </div>

      <div class="sample-input-group">
        <input type="text" placeholder="Sample input..." class="sample-input" />
      </div>
    </div>

    <div class="preview-section">
      <h4>Status</h4>
      <div class="status-badges">
        <span class="badge success">Success</span>
        <span class="badge warning">Warning</span>
        <span class="badge error">Error</span>
        <span class="badge info">Info</span>
      </div>
    </div>
  </div>
</template>

<style scoped>
.theme-preview {
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.preview-section {
  margin-bottom: 1.5rem;
}

.preview-section:last-child {
  margin-bottom: 0;
}

.preview-section h4 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
}

.color-swatches {
  display: flex;
  gap: 0.5rem;
}

.swatch {
  flex: 1;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  padding: 0.25rem 0.5rem;
}

.swatch span {
  font-size: 0.65rem;
  color: var(--text-secondary);
  mix-blend-mode: difference;
}

.text-samples {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.text-samples p {
  margin: 0;
  font-size: 0.875rem;
}

.component-samples {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sample-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sample-btn.primary {
  background: var(--accent);
  color: var(--accent-text);
}

.sample-btn.primary:hover {
  background: var(--accent-hover);
}

.sample-btn.secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.sample-btn.danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}

.sample-btn.small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.sample-card {
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.sample-card h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.sample-card p {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
}

.sample-input-group {
  margin-top: 0.75rem;
}

.sample-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition-fast);
}

.sample-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.status-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.error {
  background: var(--error-bg);
  color: var(--error);
}

.badge.info {
  background: var(--info-bg);
  color: var(--info);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .theme-preview {
    padding: 0.75rem;
  }

  .preview-section {
    margin-bottom: 1rem;
  }

  .color-swatches {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .swatch {
    height: 40px;
  }

  .swatch span {
    font-size: 0.6rem;
  }

  .component-samples {
    flex-direction: column;
  }

  .sample-btn {
    width: 100%;
    text-align: center;
  }

  .sample-card {
    padding: 0.75rem;
  }

  .sample-card h5 {
    font-size: 0.875rem;
  }

  .sample-card p {
    font-size: 0.8rem;
  }

  .status-badges {
    gap: 0.375rem;
  }

  .badge {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .color-swatches {
    grid-template-columns: 1fr;
  }

  .swatch {
    height: 36px;
  }
}
</style>
