:root {
  /* Color Palette - Premium Dark Theme */
  --bg-color: #0b0c10;
  --surface-color: #1f2833;
  --surface-light: #2c3540;
  
  --primary-color: #45a29e;
  --primary-light: #66fcf1;
  --accent-color: #c5c6c7;
  
  --text-main: #ffffff;
  --text-muted: #8e959c;
  
  --error-color: #fca5a5;
  --success-color: #86efac;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Geometry & Shadows */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 20px rgba(102, 252, 241, 0.2);
  --shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.app-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(31, 40, 51, 0.5);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}
.logo-accent {
  color: var(--primary-light);
  font-weight: 400;
}

.header-actions { display: flex; gap: 16px; align-items: center; }

.btn-link {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.2s;
}
.btn-link:hover { color: var(--primary-light); }

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 24px;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(69,162,158,0.1) 0%, transparent 40%);
}

/* Panels */
.panel {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-controls {
  width: 380px;
  flex-shrink: 0;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.panel-results {
  flex: 1;
  background: #0f1319;
  position: relative;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
}

/* Forms & UI */
.section { margin-bottom: 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title { font-size: 0.95rem; font-weight: 600; color: var(--accent-color); margin-bottom: 12px; display: flex; align-items: center; }

.badge { font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; margin-left: 8px; text-transform: uppercase; font-weight: 700; }
.badge.optional { background: rgba(255,255,255,0.1); color: var(--text-muted); }
.badge.required { background: rgba(252, 165, 165, 0.2); color: var(--error-color); }

.form-textarea {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(69,162,158,0.2);
}

/* Accordion */
.accordion {
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
}
.accordion summary { font-size: 0.9rem; font-weight: 600; list-style: none; display: flex; align-items: center; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion[open] summary { margin-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; }

/* Drop Zone */
.drop-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(0,0,0,0.1);
}
.drop-zone:hover { border-color: var(--primary-light); color: var(--primary-light); background: rgba(102, 252, 241, 0.05); }

/* Reference Preview Images */
.preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.preview-container img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.2);
}

/* Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}
.chip:hover { background: rgba(255,255,255,0.1); }
.chip.active {
  background: rgba(69,162,158,0.2);
  border-color: var(--primary-light);
  color: var(--primary-light);
  box-shadow: 0 0 10px rgba(102, 252, 241, 0.1);
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #000; }
.btn-icon-glass {
  background: rgba(255,255,255,0.1);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
}
.btn-icon-glass:hover { background: rgba(255,255,255,0.2); }
.btn-sparkle {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.generate-area {
  padding: 16px 24px;
  background: var(--surface-light);
  border-top: 1px solid rgba(255,255,255,0.05);
}
.btn-generate {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  color: #0b0c10;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.btn-generate .btn-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, var(--primary-light) 0%, #45a29e 100%);
  z-index: 0;
  transition: filter 0.3s;
}
.btn-generate:hover .btn-bg { filter: brightness(1.1); }
.btn-generate .btn-text { position: relative; z-index: 1; text-transform: uppercase; letter-spacing: 1px;}
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

/* Output Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}
.icon-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.icon-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="%232c3540" d="M0 0h8v8H0zM8 8h8v8H8z"/></svg>') repeat;
}
.icon-actions {
  display: flex;
  padding: 12px;
  gap: 8px;
  background: rgba(0,0,0,0.3);
}
.btn-icon-action {
  flex: 1;
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 8px;
}
.btn-icon-action:hover { background: rgba(255,255,255,0.2); }

/* States */
.state-container {
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.state-container h3 { margin: 16px 0 8px; color: var(--text-main); font-family: var(--font-display); }
.empty-icon { font-size: 4rem; opacity: 0.5; filter: grayscale(1); }
.error-icon { font-size: 4rem; color: var(--error-color); }
.results-meta { margin-top: 24px; text-align: center; color: var(--text-muted); font-size: 0.8rem; }

/* Loader */
.loader {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(102, 252, 241, 0.2);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: var(--surface-color); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg); width: 400px; max-width: 90%; box-shadow: var(--shadow-panel); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid rgba(255,255,255,0.05); text-align: right; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 8px; color: var(--accent-color); }
.form-group input { width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); padding: 10px 12px; border-radius: var(--radius-sm); color: #fff; }
.input-wrapper { display: flex; }
.hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px;}
.toast { background: var(--surface-light); color: #fff; padding: 12px 24px; border-radius: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-size: 0.9rem; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
