:root {
  --primary-green: #388e23;
  --secondary-green: #63dc63;
  --light-green-bg: #f0fff0;
  --dark-text: #7c7c7c;
  --border-color: #ddd;
  --win-color: #00ff3c;
  --loss-color: #ff006f;
  --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
body {
  font-family: "Vazirmatn", sans-serif;
  background-color: var(--light-green-bg);
  color: var(--dark-text);
  margin: 0;
  padding: 20px;
  direction: rtl;
  transition: background 0.3s, color 0.3s;
  background-image: var(--bamboo-bg);
}
.dark-mode {
  --primary-green: #00c853;
  --secondary-green: #263238;
  --light-green-bg: #181c1b;
  --dark-text: #888888;
  --border-color: #333;
  --win-color: #00ff3c;
  --loss-color: #ff006f;
  background-color: var(--light-green-bg);
  color: var(--dark-text);
  background-image: none;
}
.container {
  max-width: auto;
  margin: 0 auto;
  padding: 20px;
}
/* --- Bamboo Style for Note & Checklist --- */
.bamboo-tools-bar {
  float: right;
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: start;
  right: 0;
  top: 160px;
  transform: translateY(-70%);
  position: fixed;
}

.bamboo-tool-btn {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid var(--primary-green);
  border-radius: 15px;
  padding: 5px 14px;
  font-size: 1.1em;
  font-weight: bold;
  color: var(--primary-green);
  box-shadow: 0 2px 8px #b2dfdb33;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  user-select: none;
  overflow: hidden;
}

.bamboo-tool-btn:hover {
  background: #e0ffe0;
  color: #222;
  box-shadow: 0 4px 16px #b2dfdb55;
  gap: 8px;
}

.bamboo-tool-btn:hover .tool-name {
  width: 200px;
  visibility: visible;
}

.bamboo-tool-btn .tool-name {
  width: 0;
  visibility: hidden;
  white-space: nowrap;
  transition: all ease-in-out 0.4s;
}

.bamboo-icon {
  font-size: 1.2em;
  filter: drop-shadow(0 1px 0 #6f7070);
}

.table-wrapper {
  overflow-y: auto;
  max-height: 500px;
}

.table-wrapper thead {
  position: sticky;
  top: 0;
}

.bamboo-modal {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.bamboo-modal-content {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px #0002;
  padding: 32px 24px 24px 24px;
  min-width: 340px;
  max-width: 98vw;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 4px solid #b2dfdb;
}
.dark-mode .bamboo-modal-content {
  background: #232b2b;
  color: #e0e0e0;
  border: 4px solid #263238;
  background-image: none;
}
.bamboo-modal-close {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 1.5em;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}
.bamboo-modal-close:hover {
  color: #ff006f;
}
/* --- Note --- */
.bamboo-note-title {
  font-size: 1.3em;
  color: var(--primary-green);
  margin-bottom: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bamboo-note-textarea {
  width: 100%;
  min-height: 180px;
  border-radius: 10px;
  border: 1.5px solid var(--primary-green);
  padding: 14px;
  font-size: 1.1em;
  background: #f8fff8;
  color: #222;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border 0.2s;
}
.bamboo-note-textarea:focus {
  border-color: #00c853;
}
.dark-mode .bamboo-note-textarea {
  background: #232b2b;
  color: #e0e0e0;
  border: 1.5px solid #00c853;
}
.bamboo-note-save {
  background: var(--primary-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}
.bamboo-note-save:hover {
  background: #2e6e1c;
}
/* --- Checklist --- */
.bamboo-checklist-title {
  font-size: 1.2em;
  color: var(--primary-green);
  margin-bottom: 8px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bamboo-checklist-section {
  margin-bottom: 18px;
  background: #f8fff8;
  border-radius: 10px;
  padding: 12px 10px 8px 10px;
  border: 1.5px solid #b2dfdb;
}
.dark-mode .bamboo-checklist-section {
  background: #232b2b;
  border: 1.5px solid #263238;
}
.bamboo-checklist-section-header {
  font-weight: bold;
  color: #388e23;
  margin-bottom: 6px;
  font-size: 1.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bamboo-checklist-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bamboo-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 1em;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 2px 0;
  transition: background 0.2s;
}
.bamboo-checklist-item.checked {
  text-decoration: line-through;
  color: #888;
  opacity: 0.7;
}
.bamboo-checklist-checkbox {
  accent-color: var(--primary-green);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.bamboo-checklist-delete {
  background: none;
  border: none;
  color: #ff006f;
  font-size: 1.1em;
  cursor: pointer;
  margin-right: 2px;
  margin-left: 2px;
  transition: color 0.2s;
}
.bamboo-checklist-delete:hover {
  color: #b71c1c;
}
.bamboo-checklist-add-bar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.bamboo-checklist-add-input {
  flex: 1;
  border-radius: 6px;
  border: 1px solid #b2dfdb;
  padding: 6px 10px;
  font-size: 1em;
  font-family: inherit;
  background: #fff;
  color: #222;
}
.dark-mode .bamboo-checklist-add-input {
  background: #232b2b;
  color: #e0e0e0;
  border: 1px solid #263238;
}
.bamboo-checklist-add-btn {
  background: var(--primary-green);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.bamboo-checklist-add-btn:hover {
  background: #2e6e1c;
}
@media (max-width: 900px) {
  .bamboo-tools-bar {
    flex-direction: column;
    gap: 10px;
  }
  .bamboo-modal-content {
    min-width: 90vw;
  }
}

/* ~~~~~~~~~~~~~~ */
:root {
  --primary-green: #388e23;
  --secondary-green: #8fbc8f;
  --light-green-bg: #f0fff0;
  --dark-text: #333;
  --border-color: #ddd;
  --win-color: #00ff3c;
  --loss-color: #ff006f;
  --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
body {
  align-items: center;
  font-family: "Vazirmatn", sans-serif;
  background-color: var(--light-green-bg);
  color: var(--dark-text);
  margin: 0;
  padding: 20px;
  direction: rtl;
  transition: background 0.3s, color 0.3s;
  overflow: hidden;
}
.dark-mode {
  --primary-green: #00c853;
  --secondary-green: #263238;
  --light-green-bg: #181c1b;
  --dark-text: #e0e0e0;
  --border-color: #333;
  --win-color: #00ff3c;
  --loss-color: #ff006f;
  background-color: var(--light-green-bg);
  color: var(--dark-text);
}
.container {
  align-items: center;
  max-width: auto;
  margin: 0 auto;
  padding: 20px;
}
header {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary-green);
}
header h1 {
  margin: 0;
  font-size: 2.5rem;
}
header p {
  font-size: 1.1rem;
  color: var(--secondary-green);
}
.main-content {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.sidebar {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.main-panel {
  flex: 2;
  min-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.card {
  background-color: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--primary-green);
  transition: background 0.3s, color 0.3s;
}
.dark-mode .card {
  background-color: #232b2b;
  color: var(--dark-text);
  border-left: 5px solid var(--primary-green);
}
.card h2 {
  margin-top: 0;
  color: var(--primary-green);
  border-bottom: 2px solid var(--secondary-green);
  padding-bottom: 10px;
  margin-bottom: 20px;
}
.form-group {
  margin-bottom: 15px;
}

#trade-form .inputs-container {
  height: 500px;
  overflow-y: auto;
}

#analysis-content {
  height: 500px;
  overflow-y: auto;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-family: "Vazirmatn", sans-serif;
  box-sizing: border-box;
  background: white;
  color: grey;
  transition: background 0.3s, color 0.3s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 5px rgba(107, 142, 35, 0.5);
}
button {
  font-family: "Vazirmatn", sans-serif;
  cursor: pointer;
}
button.primary-btn,
button[type="submit"] {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-green);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: bold;
  transition: background-color 0.3s;
  margin-top: 10px;
}
button.primary-btn:hover,
button[type="submit"]:hover {
  background-color: #00811c;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}
thead th {
  background-color: var(--secondary-green);
  color: white;
  position: sticky;
  top: 0;
}
.dark-mode thead th {
  background-color: #263238;
  color: #fff;
}
tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}
.dark-mode tbody tr:nth-child(even) {
  background-color: #232b2b;
}
tbody tr:hover {
  background-color: #e9f5e9;
}
.dark-mode tbody tr:hover {
  background-color: #263238;
}
.pnl-win {
  color: var(--win-color);
  font-weight: bold;
}
.pnl-loss {
  color: var(--loss-color);
  font-weight: bold;
}
.delete-btn {
  background-color: var(--loss-color);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
}
.delete-btn:hover {
  opacity: 0.8;
}
.analysis-container p {
  margin: 10px 0;
  font-size: 1rem;
}
.analysis-container span {
  font-weight: bold;
  font-family: monospace;
  font-size: 1.1rem;
}
#net-pnl.pnl-win,
#current-balance.pnl-win {
  color: var(--win-color);
}
#net-pnl.pnl-loss,
#current-balance.pnl-loss {
  color: var(--loss-color);
}
.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}
.account-bar {
  max-width: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}
.account-bar select {
  min-width: 120px;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  font-family: inherit;
}
.account-bar button {
  padding: 6px 12px;
  font-size: 0.95em;
  border-radius: 5px;
  border: none;
  background: var(--primary-green);
  color: #fff;
  font-weight: bold;
  transition: background 0.2s;
}
.account-bar button:hover {
  background: #2e6e1c;
}
.account-bar input {
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  font-family: inherit;
}
.theme-toggle-btn {
  margin-left: 10px;
  padding: 6px 16px;
  border-radius: 5px;
  border: none;
  background: #222;
  color: #fff;
  font-weight: bold;
  font-size: 1em;
  transition: background 0.2s, color 0.2s;
}
.theme-toggle-btn.light {
  background: #fff;
  color: #222;
  border: 1px solid #bbb;
}
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
}
.Saber {
  color: grey;
}
#bamboo-note-list li {
  padding: 7px 10px;
  border-radius: 7px;
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  font-size: 1em;
  border: 1px solid transparent;
}
#bamboo-note-list li.selected {
  background: #e0ffe0;
  color: var(--primary-green);
  border: 1px solid var(--primary-green);
  font-weight: bold;
}
#bamboo-note-list li:hover:not(.selected) {
  background: #f0fff0;
}
#bamboo-note-list .note-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#bamboo-note-list .note-date {
  font-size: 0.85em;
  color: #888;
  margin-right: 6px;
}
.dark-mode #bamboo-note-list li.selected {
  background: #263238;
  color: #00c853;
  border: 1px solid #00c853;
}
.dark-mode #bamboo-note-list li:hover:not(.selected) {
  background: #232b2b;
}
@keyframes fadeOutRow {
  from {
    opacity: 1;
    height: 48px;
  }
  to {
    opacity: 0;
    height: 0;
  }
}
.tr-fade-out {
  animation: fadeOutRow 0.5s forwards;
}

@keyframes wideIn {
  from {
    width: 0;
  }

  to {
    width: auto;
  }
}

#splash {
  inset: 0;
  z-index: 1000;
  position: fixed;
  display: grid;
  place-content: center;
  background: var(--secondary-green);
}

/* Chrome, Edge, and Safari */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(126, 126, 126, 0.2);
  border-radius: 10px;
  transition: background-color 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 171, 88, 0.907) transparent;
}

/* =========================
   Responsive overrides (no color/structure changes)
   ========================= */

/* 1) اجازه اسکرول در موبایل (override روی overflow:hidden قدیمی) */
body {
  overflow-x: hidden;
  overflow-y: auto;
  font-size: clamp(14px, 1.9vw, 16px);
}

/* 2) چینش ستون‌ها در صفحات کوچک بدون اسکرول افقی */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
  .sidebar,
  .main-panel {
    min-width: 100% !important;
    flex: 1 1 100%;
  }
}

/* 3) ابزارهای شناور: در موبایل پایین صفحه و افقی */
@media (max-width: 768px) {
  .bamboo-tools-bar {
    right: 12px;
    bottom: 12px;
    top: auto;
    transform: none;
    flex-direction: row;
    gap: 10px;
  }
  .bamboo-tool-btn .tool-name {
    width: auto;
    visibility: visible;
  }
}

/* 4) مودال‌ها در موبایل عرض مناسب بگیرند */
@media (max-width: 900px) {
  .bamboo-modal-content {
    min-width: auto;
    width: 92vw;
    max-width: 96vw;
    padding: 24px 18px 18px 18px;
  }
}

/* 5) جدول: اسکرول افقی در موبایل + sticky header ایمن */
.table-wrapper {
  overflow: auto; /* override */
  max-height: 500px;
}
.table-wrapper thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* جدول روی صفحه‌های کوچک کمی پهن‌تر بشه تا اسکرول افقی داشته باشه */
@media (max-width: 768px) {
  table {
    min-width: 900px;
  }
}

/* 6) ارتفاع بخش‌های اسکرول‌دار در دستگاه‌های کوچک‌تر */
@media (max-width: 768px) {
  #trade-form .inputs-container {
    max-height: 60vh;
    height: auto;
  }
  #analysis-content {
    max-height: 60vh;
    height: auto;
  }
}

/* 7) آیتم‌های آمار در موبایل ستونی شوند */
@media (max-width: 600px) {
  .stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* 8) نوار اکانت در موبایل بشکند و آیتم‌ها تمام‌عرض شوند */
@media (max-width: 600px) {
  .account-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .account-bar select,
  .account-bar input,
  .account-bar button {
    flex: 1 1 100%;
  }
}

/* 9) تایپوگرافی تطبیقی برای سرصفحه (بدون تغییر رنگ‌ها) */
header h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.5rem);
}
header p {
  font-size: clamp(0.9rem, 2.6vw, 1.1rem);
}

/* 10) تیتر کارت‌ها در صفحه‌های کوچک‌تر کمی جمع‌وجورتر شوند */
.card h2 {
  font-size: clamp(1.05rem, 3.2vw, 1.3rem);
}

/* 11) پیشگیری از بیرون‌زدگی محتوا در کانتینر اصلی */
.container {
  padding: clamp(12px, 2vw, 20px);
}
