/**
 * ledger.css - Ledger Board Styles
 * Phase: RWL-LEDGER-BOARD-01
 *
 * Design: Financial dashboard aesthetic
 * - Minimal, data-focused
 * - No flashy elements
 * - High information density
 */

/* =============================================================================
   LAYOUT
   ============================================================================= */

.ledger-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.ledger-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid #1a1a1a;
}

.ledger-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}

.ledger-subtitle {
  font-size: 0.875rem;
  color: #666;
  margin: 0;
}

.ledger-timestamp {
  font-size: 0.75rem;
  color: #999;
  font-family: monospace;
}

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

.ledger-section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-icon {
  font-size: 1.1rem;
}

.section-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f0f0f0;
  color: #666;
}

.section-badge.highlight {
  background: #c30d23;
  color: #fff;
}

/* =============================================================================
   TABS (All / Watched)
   ============================================================================= */

.ledger-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.ledger-tab {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ledger-tab:hover {
  background: #f5f5f5;
}

.ledger-tab.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.ledger-tab-count {
  margin-left: 4px;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* =============================================================================
   CHANGE TABLE
   ============================================================================= */

.change-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.change-table th,
.change-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.change-table th {
  font-weight: 500;
  color: #999;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.change-table tr:hover {
  background: #fafafa;
}

.change-table tr.watched {
  background: #fffef0;
}

.change-table tr.watched:hover {
  background: #fffde0;
}

/* Change Type Icons */
.change-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.875rem;
}

.change-type.price {
  background: #e8f5e9;
}

.change-type.copy {
  background: #e3f2fd;
}

.change-type.cert {
  background: #fff3e0;
}

/* Value Change */
.value-change {
  font-family: monospace;
  font-size: 0.8125rem;
}

.value-change .before {
  color: #999;
  text-decoration: line-through;
}

.value-change .arrow {
  color: #ccc;
  margin: 0 4px;
}

.value-change .after {
  color: #1a1a1a;
  font-weight: 500;
}

/* Brand/Product Links */
.brand-name {
  font-size: 0.75rem;
  color: #666;
}

.product-link {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
}

.product-link:hover {
  text-decoration: underline;
}

/* Watched Indicator */
.watched-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c30d23;
  margin-right: 6px;
}

/* =============================================================================
   SUMMARY GRID
   ============================================================================= */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.summary-card {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
}

.summary-card.highlight {
  border-color: #1a1a1a;
  border-width: 2px;
}

.summary-label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  font-family: monospace;
}

.summary-value.zero {
  color: #ccc;
}

.summary-detail {
  font-size: 0.75rem;
  color: #999;
  margin-top: 4px;
}

/* =============================================================================
   TOP CHANGED PRODUCTS
   ============================================================================= */

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

.top-product-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.top-product-item:last-child {
  border-bottom: none;
}

.top-product-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #666;
  margin-right: 12px;
}

.top-product-rank.top3 {
  background: #1a1a1a;
  color: #fff;
}

.top-product-info {
  flex: 1;
}

.top-product-name {
  font-weight: 500;
  color: #1a1a1a;
  text-decoration: none;
}

.top-product-name:hover {
  text-decoration: underline;
}

.top-product-brand {
  font-size: 0.75rem;
  color: #666;
}

.top-product-count {
  font-family: monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
  background: #f0f0f0;
  padding: 4px 12px;
  border-radius: 4px;
}

/* =============================================================================
   OFFICIAL UPDATES (Issue Feed)
   ============================================================================= */

.updates-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.update-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.update-item:hover {
  border-color: #ccc;
}

.update-item.watched {
  background: #fef2f2;
  border-color: #fecaca;
}

.update-source {
  font-size: 0.75rem;
  font-weight: 500;
  color: #666;
  background: #e0e0e0;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  height: fit-content;
}

.update-source.watched {
  background: #c30d23;
  color: #fff;
}

.update-content {
  flex: 1;
  min-width: 0;
}

.update-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a1a;
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.update-title a {
  color: inherit;
  text-decoration: none;
}

.update-title a:hover {
  text-decoration: underline;
}

.update-meta {
  font-size: 0.75rem;
  color: #999;
}

.update-date {
  font-family: monospace;
}

.new-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  color: #fff;
  background: #c30d23;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #999;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.875rem;
}

/* =============================================================================
   SHARE TOOLBAR
   ============================================================================= */

.share-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f8f8f8;
  border-radius: 6px;
  font-size: 0.75rem;
}

.share-label {
  color: #999;
  font-weight: 500;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  color: #666;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-btn:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.share-btn.copied {
  background: #4caf50;
  border-color: #4caf50;
  color: #fff;
}

.share-icon {
  font-size: 0.8rem;
}

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

@media (max-width: 768px) {
  .ledger-container {
    padding: 16px 12px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

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

  .change-table {
    font-size: 0.8125rem;
  }

  .change-table th,
  .change-table td {
    padding: 8px 4px;
  }

  .update-item {
    flex-direction: column;
    gap: 8px;
  }
}

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

  .ledger-tabs {
    flex-wrap: wrap;
  }
}
