/* Design Style Finder Pro - Base Styles */

:root {
  --bg: #0a0a0f;
  --bg-card: #14141c;
  --bg-hover: #1a1a24;
  --border: rgba(255,255,255,0.1);
  --text: #ffffff;
  --text-secondary: #888;
  --text-muted: #555;
  --accent: #4285f4;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Noto Sans JP', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  position: relative;
}

/* Visual Effect: Background Pattern Overlay */
body[data-style-theme]::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-pattern, none);
  background-size: var(--bg-pattern-size, auto);
  opacity: var(--bg-pattern-opacity, 1);
  pointer-events: none;
  z-index: 0;
}

/* Visual Effect: Vignette Overlay (Film Noir) */
body[data-style-theme]::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--vignette, none);
  pointer-events: none;
  z-index: 0;
}

/* Ensure content is above overlays */
header, main, nav, .overlay, .detail-panel, .compare-bar, .compare-modal, .current-theme-badge {
  position: relative;
  z-index: 1;
}

/* Visual Effect: Neon/Cyber/Matrix Text Glow */
[data-style-theme="neon"] header h1,
[data-style-theme="neon"] .tone-title {
  text-shadow: 0 0 20px var(--glow-color, transparent), 0 0 40px var(--glow-color, transparent);
}

[data-style-theme="cyber"] header h1,
[data-style-theme="cyber"] .tone-title {
  text-shadow: 0 0 15px var(--glow-color, transparent), 0 0 30px var(--glow-color, transparent);
}

[data-style-theme="matrix"] header h1,
[data-style-theme="matrix"] .tone-title {
  text-shadow: 0 0 15px var(--glow-color, transparent), 0 0 30px var(--glow-color, transparent);
}

/* Header */
header {
  text-align: center;
  padding: 48px 20px 32px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 700;
  margin-bottom: 8px;
}

.header-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4285f4, #9c5cff);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}

header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Tone Navigation */
.tone-nav {
  display: flex;
  gap: 8px;
  padding: 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.tone-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
}

.tone-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(66,133,244,0.1);
}

.tone-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.tone-btn .emoji { font-size: 18px; }
.tone-btn .count {
  font-size: 11px;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 100px;
}

/* Search Box */
.search-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.search-box {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(66,133,244,0.2);
}

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

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-results-count {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.clear-search.visible {
  display: block;
}

.clear-search:hover {
  color: var(--text);
}

/* Main Content */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px;
}

.tone-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tone-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tone-title .emoji { font-size: 32px; }

.tone-desc {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 600px;
}

/* Style Grid */
.style-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Style Card */
.style-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
}

.style-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.style-preview {
  height: 180px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.style-info {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.style-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.style-name-jp {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.style-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.style-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.style-tag {
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px;
  color: var(--text-muted);
}

/* Tone Sections */
.tone-section { display: none; }
.tone-section.active { display: block; }

/* Preview Notice */
.preview-notice {
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  color: white;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: preview-glow 2s ease-in-out infinite;
}

.preview-notice .preview-icon {
  font-size: 16px;
}

@keyframes preview-glow {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

/* Apply Style Button */
.apply-style-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.apply-style-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 80%, #000));
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.apply-style-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66,133,244,0.4);
}

.apply-style-btn.applied {
  background: linear-gradient(135deg, #10b981, #059669);
}

.reset-style-btn {
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-style-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.current-theme-badge {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.current-theme-badge.visible {
  display: flex;
}

.current-theme-badge button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Purpose Tabs */
.purpose-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.purpose-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.purpose-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.purpose-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.purpose-tab .icon {
  font-size: 14px;
}

/* Detail Panel */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  overflow-y: auto;
}
.detail-panel.open { transform: translateX(0); }

.detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}
.detail-title { font-size: 15px; font-weight: 700; }

.close-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-content { padding: 20px; }
.detail-preview {
  height: 140px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.detail-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.color-chip { text-align: center; }
.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  margin-bottom: 4px;
  border: 1px solid var(--border);
}
.color-name { font-size: 9px; color: var(--text-muted); }

.detail-fonts { display: flex; flex-direction: column; gap: 6px; }
.font-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
}
.font-label { font-size: 10px; color: var(--text-muted); }
.font-name { font-size: 12px; font-weight: 500; }

.detail-features { display: flex; flex-wrap: wrap; gap: 5px; }
.feature-tag {
  font-size: 10px;
  padding: 4px 10px;
  background: rgba(66,133,244,0.1);
  border: 1px solid rgba(66,133,244,0.2);
  border-radius: 100px;
  color: var(--accent);
}

.yaml-block {
  background: #0d1117;
  border-radius: 8px;
  overflow: hidden;
}
.yaml-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #161b22;
  border-bottom: 1px solid var(--border);
}
.yaml-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.copy-btn {
  padding: 4px 10px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
}
.copy-btn.copied { background: #34a853; }
.yaml-content {
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  line-height: 1.7;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}
.yaml-content pre { margin: 0; white-space: pre-wrap; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 150;
}
.overlay.open { opacity: 1; visibility: visible; }

.tone-nav::-webkit-scrollbar { display: none; }
.tone-nav { -ms-overflow-style: none; scrollbar-width: none; }

@media (max-width: 600px) {
  .style-grid { grid-template-columns: 1fr; }
  .detail-panel { max-width: 100%; }
}

/* ===== Favorites ===== */

/* Card Favorite Button */
.favorite-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 5;
  color: rgba(255,255,255,0.6);
}

.favorite-btn:hover {
  background: rgba(0,0,0,0.6);
  color: #ff6b6b;
  transform: scale(1.1);
}

.favorite-btn.active {
  color: #ff6b6b;
  background: rgba(255,107,107,0.2);
}

.favorite-btn.active svg {
  fill: #ff6b6b;
}

.favorite-btn svg {
  transition: all 0.2s;
}

/* ===== Compare Mode ===== */

/* Card Compare Checkbox */
.compare-checkbox {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 5;
}

.compare-checkbox:hover {
  border-color: var(--accent);
  background: rgba(66,133,244,0.2);
}

.compare-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.compare-checkbox svg {
  opacity: 0;
  color: white;
  transition: opacity 0.2s;
}

.compare-checkbox.checked svg {
  opacity: 1;
}

/* Compare Bar */
.compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 300;
}

.compare-bar.visible {
  transform: translateY(0);
}

.compare-bar-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compare-selected {
  display: flex;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
}

.compare-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  white-space: nowrap;
}

.chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.chip-remove:hover {
  color: var(--text);
}

.compare-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.compare-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.compare-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66,133,244,0.4);
}

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

.compare-clear-btn {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-clear-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Compare Modal */
.compare-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 400;
}

.compare-overlay.open {
  opacity: 1;
  visibility: visible;
}

.compare-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 450;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.compare-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

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

.compare-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.compare-modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.compare-modal-close:hover {
  border-color: var(--accent);
  background: rgba(66,133,244,0.1);
}

.compare-modal-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Compare Grid */
.compare-grid {
  display: grid;
  gap: 20px;
}

.compare-grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.compare-grid[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.compare-grid[data-count="4"] { grid-template-columns: repeat(4, 1fr); }

.compare-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.compare-item-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.compare-item-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.compare-item-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

.compare-item-preview {
  height: 120px;
  overflow: hidden;
}

.compare-item-preview .style-preview {
  height: 100%;
  transform: scale(0.8);
  transform-origin: center;
}

.compare-item-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.compare-item-section:last-child {
  border-bottom: none;
}

.compare-section-title {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.compare-colors {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.compare-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}

.compare-color-swatch:hover {
  transform: scale(1.1);
}

.compare-fonts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-font {
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.compare-font-label {
  color: var(--text-muted);
}

.compare-font-name {
  color: var(--text);
  font-weight: 500;
}

.compare-features {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.compare-feature-tag {
  font-size: 9px;
  padding: 3px 8px;
  background: rgba(66,133,244,0.1);
  border-radius: 100px;
  color: var(--accent);
}

.compare-apply-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.compare-apply-btn:hover {
  background: var(--accent-hover, #3574e0);
}

@media (max-width: 900px) {
  .compare-grid[data-count="3"],
  .compare-grid[data-count="4"] {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .compare-bar-content {
    flex-direction: column;
    align-items: stretch;
  }

  .compare-selected {
    justify-content: center;
  }

  .compare-actions {
    justify-content: center;
  }

  .compare-grid[data-count="2"],
  .compare-grid[data-count="3"],
  .compare-grid[data-count="4"] {
    grid-template-columns: 1fr;
  }
}
