/* CSS Variables for Dynamic Theming */
:root {
  --primary-color: #0057ff;
  --secondary-color: #ffaa00;
  --font-header: 'Roboto', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --font-header-weight: 700;
  --font-body-weight: 400;
  --font-header-size: 2.5rem;
  --font-body-size: 1rem;
  
  /* Interface Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-dark: #212529;
  --text-primary: #000000;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

/* App Layout */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--bg-primary);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.app-header h1 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.app-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.main-content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  flex: 1;
  min-height: calc(100vh - 80px);
}

/* Configuration Panel - Compact */
.config-panel {
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  padding: 1rem;
  overflow-y: auto;
  height: calc(100vh - 80px);
  position: sticky;
  top: 0;
}

.config-section {
  margin-bottom: 1.25rem;
}

.config-section h3 {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* Color Controls - Compact */
.color-group {
  margin-bottom: 1rem;
}

.color-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.color-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.color-inputs input[type="color"] {
  width: 60px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
}

.color-inputs input[type="text"] {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: monospace;
}

.color-inputs input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

/* Font Controls - Compact Version */
.font-group {
  margin-bottom: 1rem;
}

.font-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.font-controls-compact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.font-search, .font-filter, .font-select {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.85rem;
  background: white;
}

.font-search:focus, .font-filter:focus, .font-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

/* Font Settings Row */
.font-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
}

.setting-group label {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
}

.setting-group select {
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.85rem;
  background: white;
}

.setting-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

.font-group select {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  background: white;
}

.font-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

/* Font Pairing Suggestions - Compact */
.font-suggestions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.font-suggestions label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.font-pairs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.font-pair-btn {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.font-pair-btn:hover {
  border-color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 5%, white);
}

.pair-header {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.pair-body {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.pair-style {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.8;
}

/* Font Loading Status */
.font-status {
  background: color-mix(in srgb, var(--primary-color) 5%, white);
  border: 1px solid color-mix(in srgb, var(--primary-color) 20%, white);
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.loading-text {
  color: var(--primary-color);
  font-weight: 500;
}

.font-count {
  color: var(--text-secondary);
  font-weight: 400;
}

.font-status.hidden {
  display: none;
}

.font-status.loading {
  display: flex;
}

.font-status.loaded {
  background: color-mix(in srgb, #28a745 5%, white);
  border-color: color-mix(in srgb, #28a745 20%, white);
}

.font-status.loaded .loading-text {
  color: #28a745;
}

/* Enhanced Font Controls */
.font-sort {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  background: white;
}

.font-sort:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

/* Copy Link Button */
.copy-link-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.copy-link-btn:hover {
  background: color-mix(in srgb, var(--primary-color) 85%, black);
}

.copy-feedback {
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: center;
  transition: opacity 0.3s;
}

.copy-feedback.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.copy-feedback.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.copy-feedback.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Preview Area */
.preview-area {
  background: var(--bg-secondary);
  padding: 2rem;
  overflow-y: auto;
}

.preview-section {
  background: var(--bg-primary);
  margin-bottom: 2rem;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* Preview Typography - Dynamic Sizing */
.preview-h1 {
  font-family: var(--font-header);
  font-weight: var(--font-header-weight);
  font-size: var(--font-header-size);
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.preview-h2 {
  font-family: var(--font-header);
  font-weight: var(--font-header-weight);
  font-size: calc(var(--font-header-size) * 0.8);
  color: var(--secondary-color);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.preview-h3 {
  font-family: var(--font-header);
  font-weight: var(--font-header-weight);
  font-size: calc(var(--font-header-size) * 0.6);
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.preview-h4 {
  font-family: var(--font-header);
  font-weight: var(--font-header-weight);
  font-size: calc(var(--font-header-size) * 0.5);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.preview-body {
  font-family: var(--font-body);
  font-weight: var(--font-body-weight);
  font-size: var(--font-body-size);
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.preview-list {
  font-family: var(--font-body);
  font-weight: var(--font-body-weight);
  font-size: var(--font-body-size);
  color: var(--text-primary);
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.preview-list li {
  margin-bottom: 0.25rem;
}

/* Preview Buttons */
.preview-btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 1rem;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.preview-btn.primary {
  background: var(--primary-color);
  color: white;
}

.preview-btn.primary:hover {
  background: color-mix(in srgb, var(--primary-color) 85%, black);
}

.preview-btn.secondary {
  background: transparent;
  color: var(--secondary-color);
  border: 2px solid var(--secondary-color);
}

.preview-btn.secondary:hover {
  background: var(--secondary-color);
  color: white;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--primary-color) 5%, white), 
    color-mix(in srgb, var(--secondary-color) 3%, white)
  );
  text-align: center;
  padding: 3rem 2rem;
}

/* Inverted Section */
.inverted-section {
  background: var(--primary-color);
  color: white;
}

.inverted-section .preview-h2 {
  color: white;
}

.inverted-section .preview-body {
  color: rgba(255, 255, 255, 0.9);
}

.inverted-section .preview-btn.primary {
  background: var(--secondary-color);
  color: var(--text-primary);
}

.inverted-section .preview-btn.primary:hover {
  background: color-mix(in srgb, var(--secondary-color) 85%, black);
}

/* Info Box */
.info-box {
  background: color-mix(in srgb, var(--secondary-color) 10%, white);
  border: 1px solid color-mix(in srgb, var(--secondary-color) 30%, white);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.info-box .preview-h4 {
  color: var(--secondary-color);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.preview-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.preview-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.preview-card .preview-h4 {
  color: var(--primary-color);
}

/* New Preview Sections */

/* Quote Section */
.quote-section {
  background: color-mix(in srgb, var(--secondary-color) 5%, white);
  border-left: 4px solid var(--secondary-color);
}

.preview-quote {
  margin: 0;
  font-style: italic;
}

.quote-author {
  display: block;
  margin-top: 1rem;
  font-style: normal;
  color: var(--secondary-color);
  font-weight: 600;
}

/* Form Elements */
.form-preview {
  margin-top: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-body);
  font-weight: var(--font-body-weight);
  font-size: var(--font-body-size);
  color: var(--text-primary);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: var(--font-body-size);
  margin-bottom: 1rem;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.2);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Pricing Table */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.pricing-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.pricing-card.featured {
  border-color: var(--primary-color);
  border-width: 2px;
  position: relative;
}

.pricing-card.featured::before {
  content: "Populair";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.price {
  font-family: var(--font-header);
  font-weight: var(--font-header-weight);
  font-size: calc(var(--font-header-size) * 0.8);
  color: var(--primary-color);
  margin: 1rem 0;
}

.price-period {
  font-family: var(--font-body);
  font-weight: var(--font-body-weight);
  font-size: calc(var(--font-body-size) * 0.9);
  color: var(--text-secondary);
}

.pricing-features {
  text-align: left;
  margin: 1.5rem 0;
}

.pricing-features li {
  padding: 0.25rem 0;
}

/* Contact Section */
.contact-section {
  background: color-mix(in srgb, var(--primary-color) 5%, white);
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.contact-item {
  text-align: center;
}

.contact-item .preview-h4 {
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  
  .config-panel {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .preview-area {
    padding: 1rem;
  }
  
  .preview-section {
    padding: 1.5rem;
  }
  
  .preview-h1 {
    font-size: 2rem;
  }
  
  .preview-h2 {
    font-size: 1.5rem;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .pricing-grid {
    grid-template-columns: 1fr;
  }
  
  .contact-info {
    grid-template-columns: 1fr;
  }
  
  .hero-section {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 1rem;
  }
  
  .config-panel {
    padding: 1rem;
  }
  
  .color-inputs {
    gap: 0.75rem;
  }
  
  .preview-h1 {
    font-size: 1.75rem;
  }
  
  .preview-h2 {
    font-size: 1.25rem;
  }
  
  .preview-btn {
    display: block;
    margin-right: 0;
    margin-bottom: 0.75rem;
  }
}