/* Myanmar Daily Reference Prices - Paper & Ink Theme */

/* === DESIGN TOKENS === */
:root {
  /* Paper colors */
  --paper-cream: #f9f7f4;
  --paper-beige: #ede8e0;
  --paper-aged: #e8e3d8;

  /* Ink colors */
  --ink-black: #2b2520;
  --ink-dark: #3d3530;
  --ink-medium: #5c554d;
  --ink-light: #8a8175;

  /* Accent colors */
  --sepia-brown: #8b7355;
  --sepia-light: #a89176;
  --accent-gold: #c9a961;

  /* Status colors */
  --status-up: #c05746;
  /* Rust red for increases */
  --status-down: #4a7c59;
  /* Forest green for decreases */
  --status-stable: var(--ink-medium);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  /* Typography */
  --font-serif: 'Crimson Text', 'Georgia', serif;
  --font-sans: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--paper-cream) 0%, var(--paper-beige) 100%);
  color: var(--ink-black);
  line-height: 1.6;
  min-height: 100vh;
  padding: var(--space-md);
}

/* Paper texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

/* === TYPOGRAPHY === */
h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
  color: var(--ink-black);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
  font-size: 1.25rem;
  color: var(--ink-dark);
  margin-bottom: var(--space-xs);
}

.subtitle {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-medium);
  font-style: italic;
}

/* === LAYOUT === */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  padding: var(--space-lg) 0;
  border-bottom: 2px solid var(--paper-aged);
  margin-bottom: var(--space-lg);
}

.last-updated {
  font-size: 0.875rem;
  color: var(--ink-light);
  margin-top: var(--space-xs);
}

/* === TAB NAVIGATION === */
.tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
  border-bottom: 2px solid var(--paper-aged);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-light);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink-black);
  background: rgba(255, 255, 255, 0.5);
}

.tab.active {
  color: var(--ink-black);
  background: white;
  border-color: var(--paper-aged);
  border-bottom-color: white;
  position: relative;
  bottom: -2px;
}

.tab-icon {
  font-style: normal;
  margin-right: var(--space-xs);
}

/* === QUICK STATS BAR === */
.quick-stats {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: rgba(232, 227, 216, 0.4);
  border-radius: 6px;
  margin-bottom: var(--space-md);
  overflow-x: auto;
  font-size: 0.85rem;
}

.quick-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  white-space: nowrap;
}

.quick-stat-label {
  color: var(--ink-medium);
  font-weight: 500;
}

.quick-stat-value {
  font-family: var(--font-mono);
  color: var(--ink-black);
  font-weight: 600;
}

/* === PRICE GRID === */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* === PRICE CARD === */
.price-card {
  background: white;
  border: 1px solid var(--paper-aged);
  border-radius: 8px;
  padding: var(--space-md);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.price-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-gold);
  opacity: 0.4;
}

.price-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.price-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.price-card__title {
  font-size: 0.95rem;
  color: var(--ink-medium);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.price-card__source {
  font-size: 0.75rem;
  color: var(--ink-light);
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--paper-aged);
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: var(--paper-cream);
}

.price-card__value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink-black);
  margin-bottom: var(--space-xs);
}

.price-card__unit {
  font-size: 0.875rem;
  color: var(--ink-light);
  font-family: var(--font-sans);
  margin-left: var(--space-xs);
}

.price-card__delta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 600;
}

.price-card__sparkline {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--paper-aged);
}

/* Delta indicators */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.delta--up {
  background: rgba(192, 87, 70, 0.1);
  color: var(--status-up);
}

.delta--down {
  background: rgba(74, 124, 89, 0.1);
  color: var(--status-down);
}

.delta--stable {
  background: rgba(92, 85, 77, 0.1);
  color: var(--status-stable);
}

.delta__arrow {
  font-size: 1rem;
  font-weight: bold;
}

/* === SPARKLINE === */
.sparkline {
  width: 100%;
  height: 60px;
  margin-top: var(--space-xs);
}

.sparkline__path {
  fill: none;
  stroke: var(--sepia-brown);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline__area {
  fill: var(--sepia-brown);
  opacity: 0.1;
}

/* === FOOTER === */
footer {
  text-align: center;
  padding: var(--space-lg) 0;
  border-top: 2px solid var(--paper-aged);
  margin-top: var(--space-xl);
  color: var(--ink-light);
}

.sources {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
}

.source-link {
  color: var(--sepia-brown);
  text-decoration: none;
  border-bottom: 1px dotted var(--sepia-brown);
  transition: color 0.2s ease;
}

.source-link:hover {
  color: var(--ink-black);
  border-bottom-style: solid;
}

.disclaimer {
  font-size: 0.8rem;
  color: var(--ink-light);
  font-style: italic;
  max-width: 600px;
  margin: 0 auto;
}

/* === LOADING STATE === */
.loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ink-medium);
}

.loading::after {
  content: '...';
  animation: loading 1.5s infinite;
}

@keyframes loading {

  0%,
  20% {
    content: '.';
  }

  40% {
    content: '..';
  }

  60%,
  100% {
    content: '...';
  }
}

/* === ERROR STATE === */
.error {
  background: rgba(192, 87, 70, 0.1);
  border: 1px solid var(--status-up);
  border-radius: 8px;
  padding: var(--space-md);
  text-align: center;
  color: var(--status-up);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .price-grid {
    grid-template-columns: 1fr;
  }

  .price-card__value {
    font-size: 1.75rem;
  }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.price-card {
  animation: fadeIn 0.5s ease backwards;
}

.price-card:nth-child(1) {
  animation-delay: 0.1s;
}

.price-card:nth-child(2) {
  animation-delay: 0.2s;
}

.price-card:nth-child(3) {
  animation-delay: 0.3s;
}

.price-card:nth-child(4) {
  animation-delay: 0.4s;
}

.price-card:nth-child(5) {
  animation-delay: 0.5s;
}

.price-card__unit {
  font-size: 0.875rem;
  color: var(--ink-light);
  font-family: var(--font-sans);
  margin-left: var(--space-xs);
}

.price-card__delta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 600;
}

.price-card__sparkline {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--paper-aged);
}

/* Delta indicators */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.delta--up {
  background: rgba(192, 87, 70, 0.1);
  color: var(--status-up);
}

.delta--down {
  background: rgba(74, 124, 89, 0.1);
  color: var(--status-down);
}

.delta--stable {
  background: rgba(92, 85, 77, 0.1);
  color: var(--status-stable);
}

.delta__arrow {
  font-size: 1rem;
  font-weight: bold;
}

/* === SPARKLINE === */
.sparkline {
  width: 100%;
  height: 60px;
  margin-top: var(--space-xs);
}

.sparkline__path {
  fill: none;
  stroke: var(--sepia-brown);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline__area {
  fill: var(--sepia-brown);
  opacity: 0.1;
}

/* === FOOTER === */
footer {
  text-align: center;
  padding: var(--space-lg) 0;
  border-top: 2px solid var(--paper-aged);
  margin-top: var(--space-xl);
  color: var(--ink-light);
}

.sources {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
}

.source-link {
  color: var(--sepia-brown);
  text-decoration: none;
  border-bottom: 1px dotted var(--sepia-brown);
  transition: color 0.2s ease;
}

.source-link:hover {
  color: var(--ink-black);
  border-bottom-style: solid;
}

.disclaimer {
  font-size: 0.8rem;
  color: var(--ink-light);
  font-style: italic;
  max-width: 600px;
  margin: 0 auto;
}

/* === LOADING STATE === */
.loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--ink-medium);
}

.loading::after {
  content: '...';
  animation: loading 1.5s infinite;
}

@keyframes loading {

  0%,
  20% {
    content: '.';
  }

  40% {
    content: '..';
  }

  60%,
  100% {
    content: '...';
  }
}

/* === ERROR STATE === */
.error {
  background: rgba(192, 87, 70, 0.1);
  border: 1px solid var(--status-up);
  border-radius: 8px;
  padding: var(--space-md);
  text-align: center;
  color: var(--status-up);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .price-grid {
    grid-template-columns: 1fr;
  }

  .price-card__value {
    font-size: 1.75rem;
  }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.price-card {
  animation: fadeIn 0.5s ease backwards;
}

.price-card:nth-child(1) {
  animation-delay: 0.1s;
}

.price-card:nth-child(2) {
  animation-delay: 0.2s;
}

.price-card:nth-child(3) {
  animation-delay: 0.3s;
}

.price-card:nth-child(4) {
  animation-delay: 0.4s;
}

.price-card:nth-child(5) {
  animation-delay: 0.5s;
}

/* === ADD TO LIST BUTTON === */
.price-card__add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(135deg, var(--paper-cream) 0%, var(--paper-beige) 100%);
  border: 1px solid var(--paper-aged);
  border-radius: 6px;
  color: var(--ink-dark);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.price-card__add-btn:hover {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #d4b86a 100%);
  color: var(--ink-black);
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

.price-card__add-btn--added {
  background: var(--status-down) !important;
  color: white !important;
  border-color: var(--status-down) !important;
}

.price-card__add-icon {
  font-size: 1rem;
  font-weight: bold;
}

/* === SHOPPING CALCULATOR === */
.calculator {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: white;
  border-left: 2px solid var(--paper-aged);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.calculator--open {
  right: 0;
}

.calculator__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: linear-gradient(135deg, var(--paper-cream) 0%, var(--paper-beige) 100%);
  border-bottom: 1px solid var(--paper-aged);
}

.calculator__title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-black);
  margin: 0;
}

.calculator__icon {
  font-size: 1.5rem;
}

.calculator__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  background: var(--accent-gold);
  color: var(--ink-black);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 999px;
}

.calculator__close-btn {
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: 1px solid var(--paper-aged);
  border-radius: 6px;
  color: var(--ink-medium);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calculator__close-btn:hover {
  background: var(--status-up);
  color: white;
  border-color: var(--status-up);
}

.calculator__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.calculator__items {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.calculator__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  color: var(--ink-light);
}

.calculator__empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.calculator__empty-hint {
  font-size: 0.85rem;
  margin-top: var(--space-xs);
}

.calculator__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--paper-cream);
  border: 1px solid var(--paper-aged);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.calculator__item:hover {
  border-color: var(--accent-gold);
}

.calculator__item-info {
  display: flex;
  flex-direction: column;
}

.calculator__item-name {
  font-weight: 500;
  color: var(--ink-black);
  font-size: 0.9rem;
}

.calculator__item-price {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-light);
}

.calculator__item-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.calculator__qty-btn {
  width: 1.75rem;
  height: 1.75rem;
  background: white;
  border: 1px solid var(--paper-aged);
  border-radius: 4px;
  color: var(--ink-dark);
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calculator__qty-btn:hover {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}

.calculator__qty-input {
  width: 3rem;
  padding: 0.25rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border: 1px solid var(--paper-aged);
  border-radius: 4px;
  background: white;
}

.calculator__qty-input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.calculator__item-subtotal {
  flex: 1;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-black);
  font-size: 0.9rem;
}

.calculator__remove-btn {
  width: 1.75rem;
  height: 1.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink-light);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calculator__remove-btn:hover {
  background: var(--status-up);
  color: white;
}

.calculator__footer {
  padding: var(--space-md);
  background: linear-gradient(135deg, var(--paper-cream) 0%, var(--paper-beige) 100%);
  border-top: 2px solid var(--paper-aged);
}

.calculator__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.calculator__total-label {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink-dark);
}

.calculator__total-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink-black);
}

.calculator__clear-btn {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: 1px solid var(--status-up);
  border-radius: 6px;
  color: var(--status-up);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calculator__clear-btn:hover {
  background: var(--status-up);
  color: white;
}

/* === FLOATING ACTION BUTTON === */
.calculator__fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 4rem;
  height: 4rem;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #d4b86a 100%);
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s ease;
}

.calculator__fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.calculator__fab-icon {
  font-size: 1.75rem;
}

.calculator__fab-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  background: var(--status-up);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calculator__fab--has-items {
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  50% {
    box-shadow: 0 4px 20px rgba(201, 169, 97, 0.5);
  }
}

/* Hide FAB when calculator is open */
.calculator--open~.calculator__fab {
  opacity: 0;
  pointer-events: none;
}

/* === RESPONSIVE CALCULATOR === */
@media (max-width: 768px) {
  .calculator {
    width: 100%;
    right: -100%;
  }

  .calculator__fab {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
  }

  .calculator__fab-icon {
    font-size: 1.5rem;
  }
}