/* ==========================================================================
   Encyclopedia Styles - ReBalance Lab
   modules/encyclopedia
   ========================================================================== */

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

.encyclopedia-page {
  --brand-primary: #333;
  --brand-accent: #1a73e8;
  --card-bg: #ffffff;
  --subtle-bg: #f9f9f9;
  --border-color: #e0e0e0;
  --text-color: #333;
  --muted-color: #666;
  --accent-color: #1a73e8;
  --hover-bg: #f5f5f5;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans JP', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--subtle-bg);
}

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */

.page-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

.breadcrumb {
  font-size: 0.875rem;
  color: var(--muted-color);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--accent-color);
  text-decoration: none;
}

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

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
}

.page-subtitle {
  color: var(--muted-color);
  font-size: 1.125rem;
  margin: 0;
}

/* ==========================================================================
   BRAND PAGE
   ========================================================================== */

.brand-header {
  padding-bottom: 0;
}

.brand-hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
}

.brand-logo-large {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--subtle-bg);
  padding: 1rem;
}

.brand-info {
  flex: 1;
}

.brand-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--brand-primary);
}

.brand-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--brand-accent);
  color: #fff;
  border-radius: 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.5rem;
}

.brand-description {
  margin-top: 1rem;
  font-size: 1.125rem;
  color: var(--muted-color);
  max-width: 600px;
}

/* ==========================================================================
   CONTENT GRID
   ========================================================================== */

.page-main {
  padding: 2rem 1.5rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

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

.main-column {
  min-width: 0;
}

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent-color);
}

/* ==========================================================================
   METRICS
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: var(--subtle-bg);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-color);
}

/* ==========================================================================
   PRODUCTS GRID
   ========================================================================== */

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* ==========================================================================
   TECHNOLOGY LIST
   ========================================================================== */

.technology-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.technology-list li {
  padding: 0.75rem 1rem;
  background: var(--subtle-bg);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  position: relative;
  padding-left: 2rem;
}

.technology-list li::before {
  content: '✓';
  position: absolute;
  left: 0.75rem;
  color: var(--accent-color);
}

/* ==========================================================================
   NEWS LIST
   ========================================================================== */

.news-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ==========================================================================
   SIDEBAR BLOCKS
   ========================================================================== */

.sidebar-block {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
}

.sidebar-block h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* Quick Facts */
.quick-facts dl {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.quick-facts dt {
  color: var(--muted-color);
  font-size: 0.875rem;
}

.quick-facts dd {
  margin: 0;
  font-weight: 500;
}

.quick-facts a {
  color: var(--accent-color);
  text-decoration: none;
  word-break: break-all;
}

/* Certifications */
.certifications ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.certifications li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.875rem;
}

.certifications li:last-child {
  border-bottom: none;
}

/* Related */
.related-brands,
.related-products {
  margin-top: 1.5rem;
}

.related-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.related-link {
  padding: 0.375rem 0.75rem;
  background: var(--subtle-bg);
  border-radius: 20px;
  font-size: 0.8125rem;
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.2s ease;
}

.related-link:hover {
  background: var(--accent-color);
  color: #fff;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* ==========================================================================
   PRODUCT PAGE
   ========================================================================== */

.product-hero {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 2rem;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .product-hero {
    grid-template-columns: 1fr;
  }
}

.product-image-large {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  background: var(--subtle-bg);
}

.product-image-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-info {
  display: flex;
  flex-direction: column;
}

.product-info .product-brand {
  font-size: 0.875rem;
  color: var(--brand-accent);
  font-weight: 500;
  text-decoration: none;
}

.product-info .product-brand:hover {
  text-decoration: underline;
}

.product-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.product-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--subtle-bg);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--muted-color);
  margin-bottom: 1.5rem;
}

/* Trust Display */
.trust-display {
  margin: 1.5rem 0;
}

.trust-display .trust-label {
  font-size: 0.75rem;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trust-bar-large {
  height: 12px;
  background: var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.trust-bar-large .trust-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color) 0%, #34a853 100%);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.trust-display .trust-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

/* Price Display */
.price-display {
  margin: 1rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.price-display .price-label {
  font-size: 0.75rem;
  color: var(--muted-color);
}

.price-display .price-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.price-display .price-change {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.price-change.up {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.price-change.down {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

/* Features List */
.features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.features-list li {
  padding: 0.75rem 1rem;
  background: var(--subtle-bg);
  border-radius: 8px;
  padding-left: 2.5rem;
  position: relative;
}

.features-list li::before {
  content: '✓';
  position: absolute;
  left: 1rem;
  color: #28a745;
  font-weight: 700;
}

/* EID Section */
.eid-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.eid-item {
  text-align: center;
  padding: 1rem;
  background: var(--subtle-bg);
  border-radius: 8px;
  border-left: 4px solid var(--eid-color, var(--accent-color));
}

.eid-layer {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-color);
  margin-bottom: 0.25rem;
}

.eid-item .eid-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--eid-color);
}

/* Specifications */
.specifications dl {
  margin: 0;
}

.specifications dt {
  font-size: 0.75rem;
  color: var(--muted-color);
  margin-top: 0.75rem;
}

.specifications dt:first-child {
  margin-top: 0;
}

.specifications dd {
  margin: 0.25rem 0 0 0;
  font-weight: 500;
}

/* ==========================================================================
   KEYWORD PAGE
   ========================================================================== */

.keyword-hero {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.keyword-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
}

.keyword-stats {
  display: flex;
  gap: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-color);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.trend-up .stat-value { color: #28a745; }
.trend-down .stat-value { color: #dc3545; }
.trend-stable .stat-value { color: var(--muted-color); }

/* Definition */
.definition-section p {
  font-size: 1.125rem;
  line-height: 1.8;
}

/* Brands Chips */
.brands-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.brand-chip {
  padding: 0.5rem 1rem;
  background: var(--subtle-bg);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.brand-chip:hover {
  background: var(--accent-color);
  color: #fff;
}

/* Keywords Cloud */
.keywords-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   INDEX PAGE
   ========================================================================== */

.index-page .page-header {
  text-align: center;
  padding: 3rem 1.5rem;
}

.index-page .page-main {
  max-width: 1400px;
  margin: 0 auto;
}

.index-page .section {
  margin-bottom: 3rem;
}

.index-page .section h2 {
  text-align: center;
  font-size: 1.5rem;
}

.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.view-all-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.view-all-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   PAGE FOOTER
   ========================================================================== */

.page-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted-color);
  font-size: 0.875rem;
}

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

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

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .brand-hero {
    flex-direction: column;
    text-align: center;
  }

  .brand-logo-large {
    margin: 0 auto;
  }

  .brand-description {
    margin: 1rem auto 0;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

  .keyword-stats {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ==========================================================================
   CHANGE HISTORY BLOCK
   ========================================================================== */

.sidebar-block.change-history {
  background: var(--subtle-bg);
  border: 1px dashed var(--border-color);
}

.change-history h3 {
  color: #6c757d;
}

.history-hint {
  font-size: 0.8125rem;
  color: var(--muted-color);
  margin-bottom: 0.75rem;
}

.history-api-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #6c757d;
  color: #fff;
  text-decoration: none;
  font-size: 0.8125rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.history-api-link:hover {
  background: #5a6268;
}
