/* ====================================
   GfL Blog Generator – Design System
   Geben für Leben Brand Colors:
   - Primary Gold: #F5C518
   ==================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

/* ---- Dark Mode (Default) ---- */
:root {
  --gold: #F5C518;
  --gold-light: #ffd54f;
  --gold-dark: #c49b00;

  --bg: #0d1117;
  --surface: #161b22;
  --card: #1c2333;
  --border: #30363d;
  --hover: #252d3a;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --success: #3fb950;
  --error: #f85149;
  --warning: #d29922;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(245, 197, 24, 0.15);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --bg-pattern-1: rgba(245, 197, 24, 0.08);
  --bg-pattern-2: rgba(245, 197, 24, 0.05);
}

/* ---- Light Mode ---- */
[data-theme="light"] {
  --gold: #c49b00;
  --gold-light: #c49b00;
  --gold-dark: #a07e00;

  --bg: #f6f8fa;
  --surface: #ffffff;
  --card: #ffffff;
  --border: #d0d7de;
  --hover: #f0f3f6;

  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8c959f;

  --success: #1a7f37;
  --error: #cf222e;
  --warning: #9a6700;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 30px rgba(196, 155, 0, 0.12);
  --bg-pattern-1: rgba(196, 155, 0, 0.06);
  --bg-pattern-2: rgba(196, 155, 0, 0.04);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

/* ---- Background Pattern ---- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, var(--bg-pattern-1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, var(--bg-pattern-2) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Layout ---- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ---- Header ---- */
.header {
  position: relative;
  text-align: center;
  padding: 40px 0 36px;
}

.header__logo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.header__icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: var(--shadow-glow);
}

.header__title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.header__subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: absolute;
  top: 40px;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
  background: var(--hover);
}

/* ---- Tabs ---- */
.tabs-container {
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  white-space: nowrap;
}

.tab:hover {
  background: var(--hover);
  color: var(--text-primary);
}

.tab.active {
  background: rgba(245, 197, 24, 0.12);
  color: var(--gold);
  font-weight: 600;
}

[data-theme="light"] .tab.active {
  background: rgba(196, 155, 0, 0.1);
}

/* ---- Card ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition), background var(--transition);
}

.card:hover {
  border-color: rgba(245, 197, 24, 0.2);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card__header-icon {
  width: 36px;
  height: 36px;
  background: rgba(245, 197, 24, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.card__header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.form-group label .required {
  color: var(--gold);
  margin-left: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  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='%238b949e' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ---- Length Selector ---- */
.length-selector {
  display: flex;
  gap: 8px;
}

.length-btn {
  flex: 1;
  padding: 10px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  line-height: 1.3;
}

.length-btn small {
  font-size: 10px;
  opacity: 0.65;
  font-weight: 400;
}

.length-btn:hover {
  border-color: var(--gold);
  color: var(--text-primary);
}

.length-btn.active {
  background: rgba(245, 197, 24, 0.12);
  border-color: var(--gold);
  color: var(--gold);
}

[data-theme="light"] .length-btn.active {
  background: rgba(196, 155, 0, 0.1);
}

/* ---- Category Selector ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.category-btn {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-btn:hover {
  background: var(--hover);
  border-color: var(--gold);
  color: var(--text-primary);
}

.category-btn.active {
  background: rgba(245, 197, 24, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}

[data-theme="light"] .category-btn.active {
  background: rgba(196, 155, 0, 0.08);
}

.category-btn__icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* ---- Platform Selector (Social Media) ---- */
.platform-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platform-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.platform-label input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--gold);
}

.platform-label:hover {
  border-color: var(--gold);
  color: var(--text-primary);
}

.platform-label.checked {
  background: rgba(245, 197, 24, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}

[data-theme="light"] .platform-label.checked {
  background: rgba(196, 155, 0, 0.08);
}

/* ---- Dynamic Fields ---- */
.dynamic-fields {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1a1a;
  width: 100%;
  box-shadow: 0 4px 16px rgba(245, 197, 24, 0.25);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(245, 197, 24, 0.35);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 20px;
  font-size: 13px;
}

.btn--secondary:hover {
  background: var(--hover);
  border-color: var(--gold);
}

.btn--copy {
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--success);
  padding: 10px 20px;
  font-size: 13px;
}

.btn--copy:hover {
  background: rgba(63, 185, 80, 0.2);
}

.btn--copy.copied {
  background: rgba(63, 185, 80, 0.2);
  border-color: var(--success);
}

.btn--refine {
  background: rgba(245, 197, 24, 0.08);
  border: 1px solid rgba(245, 197, 24, 0.3);
  color: var(--gold);
  padding: 10px 20px;
  font-size: 13px;
}

.btn--refine:hover {
  background: rgba(245, 197, 24, 0.16);
}

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

/* ---- Loading ---- */
.loading-overlay {
  display: none;
  position: relative;
  padding: 48px 20px;
  text-align: center;
}

.loading-overlay.active {
  display: block;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

.loading-spinner--sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
  margin: 0;
  display: inline-block;
  vertical-align: middle;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-text span {
  display: inline-block;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* ---- Result Area ---- */
.result-area {
  display: none;
}

.result-area.active {
  display: block;
  animation: slideDown 0.4s ease-out;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.result-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  max-height: 600px;
  overflow-y: auto;
}

.result-content::-webkit-scrollbar { width: 6px; }
.result-content::-webkit-scrollbar-track { background: transparent; }
.result-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ---- Social Media Result Sections ---- */
.social-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.social-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.social-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(245, 197, 24, 0.05);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .social-section-header {
  background: rgba(196, 155, 0, 0.04);
}

.social-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.social-section-content {
  padding: 16px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

/* ---- Refinement Section ---- */
.refinement-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.refinement-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.refinement-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  min-height: 80px;
  resize: vertical;
  outline: none;
  transition: all var(--transition);
  margin-bottom: 10px;
}

.refinement-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.1);
}

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

.refinement-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.refinement-spinner {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.refinement-spinner.active {
  display: flex;
}

/* ---- Demo Banner ---- */
.demo-banner {
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Error ---- */
.error-message {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--error);
  font-size: 14px;
  display: none;
  margin-bottom: 16px;
}

.error-message.active {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: slideDown 0.3s ease-out;
}

/* ---- Text Stats ---- */
.text-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- SEO Result Box ---- */
.seo-result {
  background: rgba(245, 197, 24, 0.06);
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.seo-result__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold);
  margin-bottom: 6px;
}

.seo-result__content {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ---- SEO Toggle ---- */
.seo-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 4px;
}

.seo-toggle:hover {
  border-color: var(--gold);
}

.seo-toggle input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--gold);
}

.seo-toggle span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.seo-toggle small {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ---- Select All Button ---- */
.select-all-btn {
  display: inline-block;
  background: none;
  border: none;
  color: var(--gold);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}

.select-all-btn:hover {
  background: rgba(245, 197, 24, 0.1);
}

/* ---- Field Hint ---- */
.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Token Usage ---- */
.usage-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: right;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 32px 0 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.footer a {
  color: var(--gold);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .app-container {
    padding: 16px 14px 40px;
  }

  .header {
    padding: 24px 0 28px;
  }

  .header__title {
    font-size: 22px;
  }

  .theme-toggle {
    top: 24px;
  }

  .card {
    padding: 20px;
  }

  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tabs {
    flex-direction: column;
  }

  .tab {
    text-align: left;
  }
}

@media (max-width: 500px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  .length-selector {
    flex-direction: column;
  }
}
