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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  color: #2c3e50;
  padding: 28px 20px 40px;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

/* ===== PAGE TITLE ===== */
h1 {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 600;
  color: #34495e;
  margin-bottom: 32px;
  letter-spacing: -0.3px;
}

/* ===== CHART ===== */
.chart-container {
  background: #ffffff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 28px;
}

.chart-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #7f8c8d;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.chart-wrapper {
  position: relative;
  height: 420px;
}

/* ===== LIVE SECTION ===== */
.live-section {
  background: #ffffff;
  border-radius: 12px;
  padding: 28px 24px 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.live-subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: #95a5a6;
  margin-bottom: 24px;
  letter-spacing: 0.2px;
  position: relative;
}

.history-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid #dfe6e9;
  color: #95a5a6;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

.history-toggle:hover {
  background: #f8f9fa;
  border-color: #bdc3c7;
  color: #7f8c8d;
}

.history-panel {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid #e8ecf0;
  display: none;
}

.history-panel.show {
  display: block;
}

.history-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #7f8c8d;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
  background: #bdc3c7;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: #95a5a6;
}

.history-item {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: #5a6c7d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.history-item.addition {
  border-left: 3px solid #27ae60;
}

.history-item.removal {
  border-left: 3px solid #e74c3c;
}

.history-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}

.history-delete {
  background: transparent;
  border: none;
  color: #bdc3c7;
  font-size: 0.7rem;
  padding: 2px 6px;
  margin-left: 8px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.history-item:hover .history-delete {
  opacity: 1;
}

.history-delete:hover {
  background: #ecf0f1;
  color: #95a5a6;
}

.history-value {
  font-weight: 600;
  color: #34495e;
}

.history-value.positive {
  color: #27ae60;
}

.history-value.negative {
  color: #e74c3c;
}

.history-empty {
  text-align: center;
  color: #bdc3c7;
  font-size: 0.7rem;
  padding: 16px;
  font-style: italic;
}

#liveContainer {
  max-width: 560px;
  margin: 0 auto;
}

/* ===== LIVE ITEMS ===== */
.live-item {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  border-left: 3px solid #bdc3c7;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.live-item:hover {
  border-left-color: #3498db;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.item-info {
  margin-bottom: 16px;
}

.item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2c3e50;
  display: block;
  margin-bottom: 8px;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecf0f1;
  padding: 4px 10px;
  border-radius: 6px;
}

.current-label {
  font-size: 0.7rem;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.current-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #34495e;
}

/* ===== CONTROLS ===== */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.quantity-label {
  font-size: 0.8rem;
  color: #7f8c8d;
  font-weight: 500;
  min-width: 70px;
}

.item-input {
  flex: 1;
  max-width: 120px;
  padding: 10px 12px;
  font-size: 0.9rem;
  text-align: center;
  border-radius: 8px;
  border: 1.5px solid #dfe6e9;
  background: #ffffff;
  color: #2c3e50;
  font-weight: 500;
  transition: all 0.2s ease;
}

.item-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ===== BUTTONS ===== */
.action-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 10px 18px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.apply-btn {
  background: #e8ecf0;
  color: #34495e;
}

.apply-btn:hover {
  background: #d5dce3;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.remove-btn {
  background: #ecf0f1;
  color: #34495e;
}

.remove-btn:hover {
  background: #bdc3c7;
  transform: translateY(-1px);
}

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

/* ===== FOOTER ===== */
.app-footer {
  max-width: 1100px;
  margin: 40px auto 0;
  padding-top: 20px;
  border-top: 1px solid #dfe6e9;
  text-align: center;
  font-size: 0.75rem;
  color: #95a5a6;
  letter-spacing: 0.2px;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  body {
      padding: 20px 16px 32px;
      text-align: center;
  }

  .container {
      display: flex;
      flex-direction: column;
      align-items: center;
  }

  h1 {
      font-size: 1.5rem;
      margin-bottom: 24px;
  }

  .chart-container {
      padding: 20px 16px;
      width: 100%;
  }

  .chart-wrapper {
      height: 340px;
  }

  .live-section {
      padding: 16px 12px 20px;
      width: 100%;
  }

  .live-subtitle {
      font-size: 0.7rem;
      margin-bottom: 16px;
  }

  .history-toggle {
      position: static;
      transform: none;
      display: block;
      margin: 12px auto 0;
      font-size: 0.65rem;
      padding: 4px 8px;
  }

  #liveContainer {
      text-align: left;
      max-width: 100%;
  }

  .live-item {
      padding: 14px;
  }

  .item-name {
      font-size: 0.85rem;
  }

  .current-label {
      font-size: 0.65rem;
  }

  .current-value {
      font-size: 0.78rem;
  }

  .quantity-controls {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
  }

  .quantity-label {
      font-size: 0.72rem;
  }

  .item-input {
      max-width: 100%;
      padding: 8px 10px;
      font-size: 0.85rem;
  }

  .action-buttons {
      gap: 8px;
  }

  .btn {
      font-size: 0.72rem;
      padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .chart-wrapper {
      height: 300px;
  }
}