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

:root {
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-light: #ccfbf1;
  --primary-glow: rgba(15, 118, 110, 0.25);
  --accent: #f59e0b;
  --bg-gradient: linear-gradient(135deg, #f0fdfa 0%, #fefce8 50%, #f8fafc 100%);
  --surface: #ffffff;
  --surface-secondary: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #0f766e;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #475569;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 20px rgba(15, 118, 110, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Header & Navigation */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.45rem;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.brand-badge {
  background: #ccfbf1;
  color: #0f766e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
}

.nav-btn:hover {
  background: var(--surface-secondary);
  border-color: #cbd5e1;
  color: var(--text-main);
}

.nav-btn.active {
  background: var(--primary-light);
  border-color: #99f6e4;
  color: var(--primary);
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f766e;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin-bottom: 1rem;
}

.hero-title span.highlight {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Tool Container */
.tool-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  width: 100%;
}

.card-search-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
}

.card-search-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0f766e, #14b8a6, #f59e0b);
}

/* Platform Tabs */
.platform-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  scrollbar-width: thin;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: #f8fafc;
  color: var(--text-sub);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.tab-btn.active {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #99f6e4;
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.08);
}

/* Main Input Bar */
.search-form-row {
  display: grid;
  grid-template-columns: 1fr 240px 140px;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 840px) {
  .search-form-row {
    grid-template-columns: 1fr;
  }
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: #94a3b8;
  font-size: 1.1rem;
  pointer-events: none;
}

.text-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.85rem;
  font-size: 1.05rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.5rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
}

.select-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-search {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.25);
}

.btn-search:hover {
  background: linear-gradient(135deg, #115e59, #0f766e);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.35);
}

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

/* Expansion Options Checkboxes */
.expansion-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type='checkbox'] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Progress Box */
.progress-box {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-md);
  display: none;
}

.progress-box.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f766e;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #ccfbf1;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  width: 0%;
  transition: width 0.15s ease-out;
}

.btn-stop {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-stop:hover {
  background: #fecaca;
}

/* Results Section */
.results-section {
  display: none;
  margin-top: 2rem;
}

.results-section.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.results-stats {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.stat-pill {
  background: #f1f5f9;
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-pill strong {
  color: var(--primary);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--surface-secondary);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.action-btn.primary {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #99f6e4;
}

.action-btn.primary:hover {
  background: #99f6e4;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: white;
  outline: none;
}

.filter-input:focus {
  border-color: var(--primary);
}

.filter-chip {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-sub);
}

.filter-chip.active {
  background: #0f766e;
  color: white;
  border-color: #0f766e;
}

/* Keywords Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.kw-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.kw-table th {
  background: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.kw-table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.kw-table tr:hover td {
  background: #f8fafc;
}

.kw-text {
  font-weight: 500;
  color: var(--text-main);
}

.type-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}

.type-tag.seed { background: #e0e7ff; color: #4338ca; }
.type-tag.alphabet-suffix { background: #fef3c7; color: #92400e; }
.type-tag.alphabet-prefix { background: #fed7aa; color: #9a3412; }
.type-tag.question { background: #dcfce7; color: #15803d; }
.type-tag.preposition { background: #fce7f3; color: #9d174d; }
.type-tag.number { background: #f1f5f9; color: #475569; }

/* Metrics styling */
.metric-val {
  font-weight: 700;
  color: #0f172a;
}

.diff-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.725rem;
  font-weight: 700;
}

.diff-easy {
  background: #dcfce7;
  color: #15803d;
}

.diff-medium {
  background: #fef3c7;
  color: #b45309;
}

.diff-hard {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-fetch-metric {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-fetch-metric:hover {
  background: #ffedd5;
  border-color: #fdba74;
}

.kw-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #94a3b8;
  transition: var(--transition);
}

.icon-btn:hover {
  background: #f1f5f9;
  color: var(--primary);
  border-color: #e2e8f0;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Modal for Saved Lists */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.list-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
