/* Premium Design Tokens */
:root {
  --bg-primary: #0a0a12;
  --bg-panel: rgba(16, 16, 28, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Brand Accent Colors */
  --accent-primary: #6366f1; /* Indigo */
  --accent-secondary: #a855f7; /* Purple */
  --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  --accent-glow: rgba(99, 102, 241, 0.15);
  --success-color: #10b981; /* Emerald */
  --danger-color: #f43f5e; /* Rose */
  
  /* Font Stacks */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease-out;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Dynamic Mesh Background Glows */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

.bg-glow-1 {
  background: var(--accent-primary);
  top: -10%;
  left: -10%;
  animation: floatGlow1 20s infinite alternate ease-in-out;
}

.bg-glow-2 {
  background: var(--accent-secondary);
  bottom: -10%;
  right: -10%;
  animation: floatGlow2 20s infinite alternate ease-in-out;
}

@keyframes floatGlow1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(150px, 100px) scale(1.2); }
}

@keyframes floatGlow2 {
  0% { transform: translate(0, 0) scale(1.2); }
  100% { transform: translate(-150px, -100px) scale(0.9); }
}

/* App Container Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2.5rem 4rem;
  max-width: 1600px;
  margin: 0 auto;
  gap: 2rem;
}

/* App Header Styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: var(--accent-gradient);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.logo-text h1 {
  font-family: var(--font-title);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.version-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  vertical-align: middle;
  margin-left: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

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

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.github-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Layout Workspace Split Grid */
.app-workspace {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
  align-items: start;
}

/* Workspace Panels */
.workspace-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: border-color 0.3s ease;
}

.workspace-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.panel-header h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.btn-link:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* Drag & Drop Zone */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: var(--transition-smooth);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: inset 0 0 16px rgba(99, 102, 241, 0.05);
}

.drop-icon {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  transition: var(--transition-smooth);
}

.drop-zone:hover .drop-icon, .drop-zone.dragover .drop-icon {
  color: var(--accent-primary);
  transform: translateY(-4px);
}

.drop-text-primary {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.drop-text-secondary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Configuration & Ignore Sections */
.config-section h3, 
.templates-section h3, 
.custom-prompt-section h3, 
.output-header-section h3 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.ignore-input-wrapper textarea, 
.custom-prompt-section textarea {
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: vertical;
  transition: var(--transition-fast);
}

.ignore-input-wrapper textarea:focus, 
.custom-prompt-section textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}

.custom-prompt-section textarea {
  height: 100px;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

/* Custom Styled Checkboxes */
.checkbox-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 1.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 1.5px;
  left: 0;
  height: 16px;
  width: 16px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--accent-gradient);
  border-color: transparent;
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* File list display styling */
.file-list-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
}

.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-search-wrapper input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.file-search-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-glow);
}

.file-list-scrollable {
  max-height: 250px;
  min-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* File row styling */
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: transparent;
  transition: var(--transition-fast);
}

.file-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.file-row-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0; /* allows overflow truncation */
}

.file-path {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row.ignored .file-path {
  color: var(--text-muted);
  text-decoration: line-through;
}

.file-size {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

/* Template Cards Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.template-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.template-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-hover);
}

.template-card.active {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}

.template-icon {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.template-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.template-card.active .template-title {
  color: #fff;
}

.template-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Collapsible class utility */
.hidden {
  display: none !important;
}

/* Metrics Row */
.metrics-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.metric-badge {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.metric-badge.highlight {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.03);
}

.metric-badge .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.metric-badge .val {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.metric-badge.highlight .val {
  color: #a855f7;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Code Output Area */
.output-preview-wrapper {
  border: 1px solid var(--border-color);
  background: #07070d;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.output-toolbar {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.output-filename {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.output-actions {
  display: flex;
  gap: 0.5rem;
}

.preview-area {
  padding: 1.25rem;
  max-height: 350px;
  overflow-y: auto;
}

.preview-area pre {
  margin: 0;
}

.preview-area code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: #a78bfa;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Footer Styling */
.app-footer {
  text-align: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toast alert notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  padding: 0.8rem 1.75rem;
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive CSS Rules */
@media (max-width: 1024px) {
  .app-container {
    padding: 1.5rem 2rem;
  }
  .app-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 1rem;
  }
  .app-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  .header-actions {
    justify-content: flex-start;
  }
  .template-grid {
    grid-template-columns: 1fr;
  }
  .metrics-row {
    flex-direction: column;
  }
}
