/* 全局 base（body、字体、#root、.ntq-content-inner）在 src/assets/scss/_global.scss */
/* 以下为历史/页面级 class，后续可逐页迁入模块 scss */

/* Container - 可以根据需要选择是否使用 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-full {
  margin: 0 auto;
  padding: 0 20px;
}

/* Page样式 */
.page {
  padding: 20px;
}

.page-full-width {
  width: 100%;
}

.page-limited-width {
  max-width: 1200px;
  margin: 0 auto;
}

.nav {
  background-color: #333;
  color: var(--ntq-text);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--ntq-text);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.nav-links a:hover {
  background-color: #555;
}

.nav-links a.active {
  background-color: #007bff;
}

.page {
  padding: 2rem 0;
}

.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
  padding: 20px;
}

/* 全宽页面的card */
.page-full-width .card {
  margin: 0;
  width: 100%;
  padding: 20px;
}

.btn {
  background-color: #007bff;
  color: var(--ntq-text);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

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

.btn:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
}

.error {
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.success {
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* 投资管理页面样式 */
.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #ddd;
}

.tab {
  background: none;
  border: none;
  padding: 1rem 2rem;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.3s;
}

.tab:hover {
  color: #007bff;
}

.tab.active {
  color: #007bff;
  border-bottom-color: #007bff;
  font-weight: bold;
}

.table-container {
  overflow-x: auto;
}

.investment-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.investment-table th {
  background-color: #f8f9fa;
  padding: 1rem;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid #ddd;
}

.investment-table td {
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.investment-table tr:hover {
  background-color: #f8f9fa;
}

.stock-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stock-id {
  font-weight: bold;
  color: #333;
}

.stock-name {
  color: #666;
  font-size: 0.9rem;
}

.first-buy-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.buy-date {
  color: #333;
  font-size: 0.9rem;
}

.buy-price {
  color: #666;
  font-size: 0.9rem;
  font-weight: bold;
}

.holding-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.holding-info strong {
  color: #333;
}

.total-invested {
  font-size: 1rem;
}

.total-invested strong {
  color: #333;
}

.next-target {
  color: #999;
  font-style: italic;
}

.placeholder {
  color: #ccc;
}

.profit-positive {
  color: #dc3545;
  font-weight: bold;
}

.profit-negative {
  color: #28a745;
  font-weight: bold;
}

.profit-amount {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

.current-price {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.current-price strong {
  font-size: 1.1rem;
  color: #333;
}

.price-date {
  font-size: 0.85rem;
  color: #666;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  background-color: #007bff;
  color: var(--ntq-text);
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.3s;
}

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

.expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: #666;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
}

.expand-btn:hover {
  color: #007bff;
}

.expanded-row {
  background-color: #f8f9fa;
}

.expanded-row td {
  padding: 1rem;
}

.operations-history {
  padding: 1rem;
  background: white;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.operations-history h4 {
  margin: 0 0 1rem 0;
  color: #333;
}

.operations-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.operation-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  background: white;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  align-items: center;
  border-left: 3px solid #ddd;
}

.operation-type {
  font-weight: bold;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.operation-type.buy {
  background-color: #e3f2fd;
  color: #1976d2;
}

.operation-type.sell {
  background-color: #fff3e0;
  color: #f57c00;
}

.operation-type.add {
  background-color: #f3e5f5;
  color: #7b1fa2;
}

.operation-date,
.operation-price,
.operation-amount,
.operation-note {
  color: #666;
  font-size: 0.9rem;
}

.operation-price {
  color: #333;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.empty-state p {
  margin-bottom: 1rem;
}

/* Modal样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #ddd;
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #333;
}

.modal form {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-secondary {
  background-color: #6c757d;
}

/* Autocomplete 样式 */
.autocomplete-container {
  position: relative;
  width: 100%;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin: 0;
  padding: 0;
  list-style: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background-color: #f5f5f5;
}

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

.stock-id-suggestion {
  font-weight: bold;
  color: #2196F3;
  margin-bottom: 4px;
}

.stock-name-suggestion {
  color: #333;
  font-size: 0.9em;
  margin-bottom: 2px;
}

.stock-industry-suggestion {
  color: #666;
  font-size: 0.8em;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

/* 下一目标样式 */
.next-target {
  min-width: 120px;
}

.targets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9em;
}

.target-item.take-profit {
  background-color: #ffebee;
  color: #c62828;
}

.target-item.stop-loss {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.target-label {
  font-weight: 600;
  min-width: 40px;
}

.target-price {
  font-weight: bold;
}

/* 紧凑版表格样式 */
.stock-info-compact {
  width: 100%;
}

.stock-id-compact {
  font-weight: bold;
  color: #2196F3;
  font-size: 0.95em;
}

.stock-name-compact {
  color: #333;
  font-size: 0.9em;
  margin: 4px 0;
}

.stock-meta {
  color: #666;
  font-size: 0.8em;
}

.holding-info-compact {
  width: 100%;
  font-size: 0.9em;
}

.holding-info-compact div {
  margin: 2px 0;
}

.text-muted {
  color: #666;
  font-size: 0.85em;
}

.current-price-compact {
  width: 100%;
}

.price-value {
  font-size: 0.95em;
}

.price-date-small {
  font-size: 0.75em;
  color: #666;
}

.profit-compact {
  width: 100%;
}

.next-target-compact {
  width: 100%;
}

.targets-list-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-item-compact {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8em;
}

.target-info-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-item-compact.take-profit {
  background-color: #ffebee;
  color: #c62828;
}

.target-item-compact.stop-loss {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.placeholder-small {
  font-size: 0.85em;
  color: #999;
}

.action-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.action-link {
  color: #007bff;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9em;
  padding: 2px 4px;
}

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

.action-link-delete {
  color: #dc3545;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9em;
  padding: 2px 4px;
}

.action-link-delete:hover {
  text-decoration: underline;
}

.stock-strategy {
  color: #666;
  font-size: 0.8em;
  margin-top: 4px;
}

/* Tooltip样式 */
.stock-info-wrapper {
  position: relative;
}

.tooltip-content {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
  min-width: 220px;
  max-width: 300px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 10000;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 5px;
  font-size: 0.85em;
}

.stock-info-wrapper:hover .tooltip-content {
  display: block;
}

/* 调整tooltip在表格中的显示，避免被裁剪 */
.investment-table td {
  overflow: visible !important;
}

.investment-table {
  overflow: visible;
}

.table-container {
  overflow: visible;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.85em;
}

.tooltip-label {
  color: #666;
}

.tooltip-value {
  font-weight: bold;
}
