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

body {
  background-color: #ffffff;
  color: #000000;
  padding: 1rem;
  line-height: 1.6;
  font-size: 1rem;
  transition: background-color 0.3s ease, color 0.3s ease;
  font-family: 'DM Sans', 'Inter', sans-serif;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body,
input,
button,
select,
.setup-tag,
section,
#observedList li,
#trade-history li {
  transition:
  background-color 0.3s ease,
  color 0.3s ease,
  border-color 0.3s ease;
}

/* Headings */
h1, h2, h3 {
  color: #000000;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.25rem;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: #ffffff;
}

/* Theme Toggle */
#theme-toggle-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.625rem;
  padding-right: 1em;
}

/* 🔘 General Button Style */
button,
.btn-matched {
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

/* 🔵 Primary Button */
.btn-matched,
button:not(.secondary):not(#clear-fields-btn) {
  background-color: #007bff;
  color: white;
}

.btn-matched:hover,
button:not(.secondary):not(#clear-fields-btn):hover {
  background-color: #0056b3;
  transform: translateY(-0.5px);
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.4);
}

/* ⚪️ Secondary Button */
.btn-matched.secondary,
#clear-fields-btn {
  background: #eee;
  color: black;
  border: 1px solid #ccc;
}

.btn-matched.secondary:hover,
#clear-fields-btn:hover {
  background-color: #ddd;
}

/* 🚫 Disabled Buttons */
button:disabled {
  background-color: #777;
  color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

/* Sections */
section,
.sub-panel {
  background-color: #ffffff;
  color: #000;
}

body.dark-mode section,
body.dark-mode .sub-panel {
  background-color: #1E1E2F;
  color: #E0E0E0;
}

section {
  margin-bottom: 2rem;
}

.sub-panel {
  flex: 1 1 300px;
  margin-bottom: 1rem;
  border: 1px solid #2A2A3B;
}

/* Timeframe */
.timeframe-tag {
  display: inline-block;
  background-color: #007bff;
  color: white;
  padding: 2px 8px;
  border-radius: 1em;
  font-size: 0.75rem;
  margin-left: 0.375rem;
}
body.dark-mode .timeframe-tag {
  background-color: #3399ff;
  color: black;
}

/* Inputs & Buttons */
input, select, button {
  font-size: 1rem;
  padding: 0.6rem;
  margin: 0.5rem 0 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  background-color: #ffffff;
  color: #000;
  width: 100%;
  box-sizing: border-box;
}

/* Dark mode override */
body.dark-mode input,
body.dark-mode select,
body.dark-mode button {
  background-color: #1A1A2B;
  color: #E0E0E0;
  border: 1px solid #2A2A3B;
}

body.dark-mode #observedListWrapper,
body.dark-mode #tradeHistoryWrapper {
  background-color: #181825;
  border-color: #2a2a3b;
}

body.dark-mode .list-item {
  background-color: #1e1e1e;
  color: #fff;
}

/* Empty-State */
.empty-state {
  padding: 1rem;
  text-align: center;
  color: #aaa;
  font-style: italic;
  font-size: 0.95rem;
  border: 1px dashed #444;
  border-radius: 0.375rem;
  background-color: #1a1a1a;
}

body.dark-mode .empty-state {
  background-color: #262626;
  color: #aaa;
  border-color: #555;
}

/* Tag Buttons */
.tag-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.5rem;
}

/* ⚡️ Setup Tags */
.setup-tag {
  display: inline-block;
  border: 1px solid #999;
  background-color: #e0e0e0;
  color: #111;
  border-radius: 1em;
  padding: 0.375rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.setup-tag,
button {
  transition:
  background-color 0.3s ease,
  color 0.3s ease,
  box-shadow 0.3s ease,
  transform 0.2s ease,
  border-color 0.3s ease;
}

.setup-tag:hover {
  background-color: #d0d0d0;
  color: #000;
}

.setup-tag.active {
  background-color: #007bff;
  color: #fff;
  font-weight: bold;
  border-color: #0056b3;
  box-shadow: 0 0 4px rgba(0, 123, 255, 0.35);
  transform: scale(1.05);
}
 /* Dark Mode */
body.dark-mode {
  background-color: #121212;
  color: #E0E0E0;
}

body.dark-mode button:hover {
  background-color: #444;
  color: #fff;
}

/* Active Setup Tag (Dark Mode) */
body.dark-mode .setup-tag.active {
  background-color: #0d6efd;
  border-color: #0a58ca;
  color: #fff;
  box-shadow: 0 0 5px rgba(13, 110, 253, 0.45);
}

/* Dark-mode buttons and tags */
body.dark-mode button,
body.dark-mode .setup-tag,
body.dark-mode #clear-fields-btn {
  background-color: #2a2a3b;
  color: #e0e0e0;
  border: 1px solid #555;
}

/* Setup Tag Hover (Dark Mode) */
body.dark-mode .setup-tag:hover {
  background-color: #3a3f65;
  color: #fff;
}

/* Empty State (Dark Mode) */
body.dark-mode .empty-state {
  background-color: #262626;
  color: #aaa;
  border-color: #555;
}

/* Button Group */
.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 1rem 0;
}

/* Observed List Item */
#observedList {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px; /* optional: prevent text from hiding under scrollbar */
  margin-bottom: 1rem;
  border: 1px solid #2A2A3B;
  border-radius: 6px;
}

#observedListWrapper,
#tradeHistoryWrapper {
  background-color: #ffffff;
  border: 1px solid #ccc;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.list-item {
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  background-color: #f4f4f4;
  color: #000;
  font-weight: 500;
  line-height: 1.6;
  word-break: break-word;
}

.trade-entry {
  border-left: 4px solid #1E90FF;
}
body.dark-mode .trade-entry {
  border-left: 4px solid #3399ff;
}

#scrollable-list-wrapper::-webkit-scrollbar {
  width: 8px;
}
#scrollable-list-wrapper::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
}
#scrollable-list-wrapper::-webkit-scrollbar-track {
  background-color: transparent;
}

/* Observed Content Block */
.observed-content {
  flex: 1;
  min-width: 0;
}

/* Observed Labels and Tags Row */
.observed-content span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.95rem;
}

/* Observed Timestamp */
.observed-content .timestamp {
  font-size: 0.85rem;
  color: #ccc;
  margin-top: 4px;
}

/* Delete Button in Observed Setup */
#observedList .delete-btn {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.25rem;
  font-size: 1.25rem;
  padding: 0.25rem;
  color: #ff4d4d;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#observedList .delete-btn:hover {
  transform: scale(1.2);
}

/* Profit Result & Total P/L */
#profit-result,
#running-total {
  font-size: 1.2rem;
  font-weight: bold;
  margin-top: 1rem;
}

.negative {
  color: #FF4D4D;
}

#running-total {
  color: #00D084;
}

.section-heading {
  text-align: center;
  margin: 1.5rem 0 1rem;
  font-weight: bold;
  font-size: 1.1rem;
  color: #000000;
}

body.dark-mode .section-heading {
  color: #ffffff;
}

/* Chart */
canvas {
  background-color: #181825;
  padding: 1rem;
  border-radius: 10px;
  max-width: 100%;
  height: auto;
}

/* Profit Chart */
#profitChart {
  height: auto !important;
  width: 100% !important;
  aspect-ratio: 16 / 9;
}

#profitChartContainer {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  padding: 1rem;
  background: #111; /* optional for dark mode */
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Filters */
#trade-filters {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 1rem 0;
}

/* Prevent overflow in long entries */
#observedList li,
#trade-history li {
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
}

/* Clear Fields */
#clear-fields-btn {
  margin-left: 10px;
  background-color: #eee;
  border: 1px solid #ccc;
  padding: 6px 12px;
  cursor: pointer;
  color: black;
}

#clear-fields-btn:hover {
  background-color: #ddd;
}

.btn-matched {
  background-color: #007bff; /* Blue */
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: background-color 0.3s ease;
}

.btn-matched.secondary {
  background: #666;
  color: #fff;
}

.btn-matched:hover {
  background-color: #0056b3;
}

/* Reduced Motion Fallback */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ------------------------
   📱 Responsive Layout - Mobile (Up to 768px)
   ------------------------ */
@media (max-width: 768px) {
  body {
    padding: 10px;
    font-size: 0.95rem;
  }

  h1, h2, h3, .section-heading {
    font-size: 1.15rem;
    text-align: center;
    margin-bottom: 1rem;
  }

  input,
  select,
  label {
    font-size: 1rem;
    padding: 0.55rem 0.75rem;
    margin-bottom: 1rem;
  }

  .setup-tag {
    font-size: 0.85rem;
    padding: 5px 12px;
    margin-bottom: 1rem;
  }

  .list-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  button,
  #clear-fields-btn,
  #clear-history-btn,
  #export-csv-btn,
  #reset-filters-btn,
  #logObservedBtn,
  #export-observed-btn {
    width: 100%;
    min-height: 44px;
    margin: 8px 0 10px;
  }

  .button-group {
    flex-direction: column;
    gap: 10px;
  }

  .sub-panel,
  #profit-section {
    padding: 0.75rem;
    margin-bottom: 1.5rem;
  }

  #observedList,
  #tradeHistoryWrapper {
    max-height: 200px;
  }


  #profitChartContainer {
    padding: 1rem;
    margin: 1rem auto;
    max-width: 100%;
  }

  canvas {
    padding: 0.5rem;
  }
}