/* ==========================================================================
   Analysis Pages CSS - AAAInfoWeb-Cloudflare (2026 Redesign)
   ========================================================================== */

/* ---------- General ---------- */
.tech-search-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 20px;
  font-size: 13px;
}

/* ---------- Page Banner ---------- */
.page-banner {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #1E40AF 100%);
  color: #fff;
  padding: 18px 28px;
  border-radius: 0 0 12px 12px;
  margin: 0 -20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(15,23,42,0.12);
}
.page-banner h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.page-banner-actions { display: flex; gap: 8px; align-items: center; }
.banner-btn {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
}
.banner-btn:hover { background: rgba(255,255,255,0.2); color: #fff; text-decoration: none; transform: translateY(-1px); }
.banner-btn-highlight { background: linear-gradient(135deg, #F59E0B, #D97706); border-color: #D97706; font-weight: bold; }
.banner-btn-highlight:hover { background: linear-gradient(135deg, #D97706, #B45309); }

/* ---------- Form Controls ---------- */
.tech-search-container select,
.tech-search-container input[type="text"],
.tech-search-container input[type="number"],
.tech-search-container input[type="date"] {
  border: 1px solid #CBD5E1;
  padding: 5px 8px;
  font-size: 13px;
  margin: 0 2px;
  height: 30px;
  box-sizing: border-box;
  border-radius: 6px;
  transition: all 0.2s;
  background: #fff;
}
.tech-search-container select:focus,
.tech-search-container input:focus {
  border-color: #3B82F6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.tech-search-container input[type="checkbox"] {
  vertical-align: middle;
  margin-right: 4px;
  accent-color: #3B82F6;
}
.w-small { width: 70px; }
.w-medium { width: 150px; }
.w-date { width: 135px; }

/* ---------- Search / Reset Buttons ---------- */
button.search-btn {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border: none;
  padding: 10px 30px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 8px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
button.search-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
  transform: translateY(-1px);
}
button.reset-btn {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  border: none;
  padding: 10px 30px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 8px;
  margin-left: 10px;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
button.reset-btn:hover {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  box-shadow: 0 4px 12px rgba(239,68,68,0.35);
  transform: translateY(-1px);
}

/* ---------- Saved Criteria ---------- */
.saved-criteria-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.save-btn, .delete-btn {
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #F8FAFC;
  transition: all 0.2s;
}
.save-btn:hover { background: #E2E8F0; border-color: #94A3B8; }
.delete-btn { border-color: #FCA5A5; color: #DC2626; }
.delete-btn:hover { background: #FEF2F2; border-color: #DC2626; }

/* ---------- Criteria Modal ---------- */
.criteria-modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15,23,42,0.5); backdrop-filter: blur(4px); z-index: 1000; justify-content: center; align-items: center;
}
.criteria-modal-overlay.active { display: flex; }
.criteria-modal {
  background: #fff; border-radius: 16px; padding: 28px; min-width: 600px; max-width: 800px;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.criteria-modal h3 { margin: 0 0 16px; font-size: 18px; color: #0F172A; font-weight: 700; }
.criteria-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.criteria-table th, .criteria-table td { padding: 10px 12px; border-bottom: 1px solid #E2E8F0; text-align: left; }
.criteria-table th { background: #F1F5F9; font-weight: 600; color: #1E3A5F; }
.criteria-table tr:hover { background: #F8FAFC; }
.cm-btn { padding: 5px 12px; font-size: 12px; cursor: pointer; border: 1px solid #CBD5E1; border-radius: 6px; background: #F8FAFC; margin-right: 4px; transition: all 0.2s; }
.cm-btn:hover { background: #E2E8F0; border-color: #94A3B8; }
.cm-btn-del { border-color: #FCA5A5; color: #DC2626; }
.cm-btn-del:hover { background: #FEF2F2; border-color: #DC2626; }

/* ---------- Layout Sections ---------- */
.header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  gap: 15px;
}
.date-section {
  border: 1px solid #DBEAFE;
  padding: 15px;
  background: #F8FAFC;
  border-radius: 10px;
  flex: 1;
}
.date-section > div:first-child { color: #1E3A5F; font-weight: 600; }
.date-options { margin-bottom: 10px; }
.date-options label { margin-right: 15px; }
.right-controls { display: flex; flex-direction: column; justify-content: space-between; }
.control-buttons { text-align: right; margin-bottom: 10px; }
.limit-setting { text-align: right; margin-top: 10px; }

/* ---------- Main Content / Columns ---------- */
.main-content {
  border: 1px solid #DBEAFE;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  display: flex;
  gap: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.section-label {
  font-size: 14px;
  font-weight: 700;
  color: #1E3A5F;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #DBEAFE;
  display: flex;
  align-items: center;
  gap: 6px;
}
.left-col { flex: 2; }
.condition-row {
  margin-bottom: 10px;
  line-height: 28px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.condition-row:hover { background: #F8FAFC; }
.divider { border-top: 2px solid #DBEAFE; margin: 18px 0; }
.chip-select { width: 120px; }
.right-col { flex: 1; min-width: 280px; }
.ma-range-box {
  border: 2px solid #DBEAFE;
  padding: 12px;
  border-radius: 10px;
  background: #F8FAFC;
}
.ma-range-box legend { font-weight: 700; padding: 0 8px; color: #1E3A5F; }
.ma-row { margin-bottom: 8px; display: flex; align-items: center; }
.ma-row input[type="text"],
.ma-row input[type="number"] { width: 50px; }
.ma-row span { margin: 0 5px; white-space: nowrap; }
.footer-check {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #ccc;
  clear: both;
  width: 100%;
}

/* ---------- Login / Error Notices ---------- */
.login-notice {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  padding: 20px;
  border-radius: 4px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
}
.error-message {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  color: #721c24;
}

/* ---------- Results Table ---------- */
.results-section { margin-top: 20px; }
.results-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12px;
}
.results-table th {
  background: linear-gradient(135deg, #1E3A5F, #0F172A);
  color: white;
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  border: 1px solid #1E3A5F;
  font-size: 13px;
}
.results-table td { padding: 6px 8px; border: 1px solid #E2E8F0; }
.results-table tr:nth-child(even) { background-color: #F8FAFC; }
.results-table tr:hover { background-color: #F1F5F9; }
.results-table tr { cursor: pointer; }

/* ---------- Pagination ---------- */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
  font-size: 13px;
}
.pagination-bar select { border: 1px solid #CBD5E1; padding: 3px 8px; font-size: 13px; height: 28px; border-radius: 4px; }
.pagination-nav { display: flex; gap: 4px; align-items: center; }
.pagination-nav button {
  padding: 5px 12px;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  cursor: pointer;
  font-size: 12px;
  border-radius: 6px;
  transition: all 0.2s;
}
.pagination-nav button:hover:not(:disabled) { background: #1E3A5F; color: white; border-color: #1E3A5F; }
.pagination-nav button:disabled { opacity: 0.4; cursor: default; }
.pagination-nav button.active { background: #1E3A5F; color: white; border-color: #1E3A5F; font-weight: bold; }
.pagination-info { color: #64748B; }
.btn-backtest {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-backtest:hover {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
  transform: translateY(-1px);
}

/* ---------- Chip Analysis ---------- */
#main-chart-wrapper { position: relative; width: 100%; }
#chart-annotations {
  position: absolute; top: 0; right: 0;
  width: 240px; height: 100%;
  font-size: 11px; overflow: hidden;
  pointer-events: none; z-index: 10;
}
.annotation-item {
  position: absolute; left: 5px;
  line-height: 1.25; padding: 2px;
  white-space: pre-wrap;
  font-family: 'Courier New', Courier, monospace;
}

/* ---------- Market Profile ---------- */
.chart-controls {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: .25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075);
}

/* ---------- AI Analysis ---------- */
.analysis-container {
  background-color: #fff;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;
  margin: 0 auto;
  border: 1px solid #E2E8F0;
}
.analysis-container .input-group {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.analysis-container .input-group input[type="text"] {
  flex-grow: 1;
  padding: 12px 16px;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  font-size: 16px;
  box-sizing: border-box;
  transition: all 0.2s;
  background: #F8FAFC;
}
.analysis-container .input-group input[type="text"]:focus {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
  background: #fff;
}
.analysis-container .input-group button {
  padding: 12px 24px;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.analysis-container .input-group button:hover {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}
.results-area {
  margin-top: 25px; padding: 24px;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
}
.results-area h2 { color: #1E3A5F; margin-top: 0; border-bottom: 1px solid #E2E8F0; padding-bottom: 10px; font-weight: 700; }
#chartContainer { width: 100%; height: 450px; margin: 0 auto 20px; }
.loader {
  border: 4px solid #E2E8F0;
  border-top: 4px solid #3B82F6;
  border-radius: 50%;
  width: 40px; height: 40px;
  animation: spin 0.7s linear infinite;
  margin: 20px auto;
  display: none;
}
#analysisOutput { line-height: 1.8; font-size: 16px; }
#analysisOutput h3 { color: #1E3A5F; border-bottom: 2px solid #E2E8F0; padding-bottom: 8px; margin-top: 24px; margin-bottom: 16px; }
#analysisOutput ul { padding-left: 20px; }
#analysisOutput li { margin-bottom: 8px; }
#analysisOutput strong, #analysisOutput b { color: #DC2626; }
.limit-error-container {
  text-align: center; padding: 30px;
  background: linear-gradient(135deg, #FEF2F2 0%, #fff 100%);
  border: 1px solid #FECACA; border-radius: 16px;
  box-shadow: 0 4px 15px rgba(220,38,38,0.08);
}
.limit-icon { font-size: 48px; margin-bottom: 15px; display: inline-block; }
.limit-title { color: #DC2626; font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.limit-desc { color: #64748B; margin-bottom: 15px; font-size: 16px; }
.limit-timer {
  display: inline-block; background-color: #FEF2F2; color: #B91C1C;
  padding: 6px 14px; border-radius: 20px; font-weight: 600; margin-bottom: 20px; font-size: 14px;
}
.btn-upgrade {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: white; border: none; padding: 12px 30px; border-radius: 25px;
  font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-block; box-shadow: 0 4px 15px rgba(220,38,38,0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-upgrade:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(220,38,38,0.35); color: white; }

/* ---------- Watchlist ---------- */
.watchlist-container {
  max-width: 1400px;
  margin: 20px auto;
  padding: 20px;
  font-size: 13px;
}
.watchlist-container h2 { margin: 0 0 15px; font-size: 20px; color: #0F172A; font-weight: 700; }
.watchlist-table {
  width: 100%; border-collapse: collapse; border: 1px solid #E2E8F0; font-size: 13px; border-radius: 8px; overflow: hidden;
}
.watchlist-table th, .watchlist-table td { border: 1px solid #E2E8F0; padding: 8px 10px; text-align: left; }
.watchlist-table th { background: #F1F5F9; font-weight: 600; white-space: nowrap; color: #1E3A5F; }
.watchlist-table tr:hover { background: #F8FAFC; }
.btn-remove {
  padding: 4px 12px; background: #EF4444; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.2s;
}
.btn-remove:hover { background: #DC2626; }
.loading-msg { padding: 30px; text-align: center; color: #94A3B8; font-size: 15px; }
.summary-bar {
  display: flex; gap: 20px; margin-bottom: 15px; padding: 12px 18px;
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; font-size: 14px;
}
.summary-bar .label { color: #64748B; }
.summary-bar .value { font-weight: bold; color: #0F172A; }
.btn-alert-action {
  padding: 4px 10px; background: #3B82F6; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 12px; margin-right: 4px; transition: all 0.2s;
}
.btn-alert-action:hover { background: #2563EB; }
.btn-settings {
  padding: 6px 16px; background: #475569; color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.btn-settings:hover { background: #334155; }

/* ---------- Modal Overlay ---------- */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
  z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-content-custom {
  background: #fff; border-radius: 16px; padding: 28px; min-width: 400px; max-width: 600px;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  border: 1px solid #E2E8F0;
}
.modal-content-custom h3 { margin-top: 0; color: #0F172A; font-weight: 700; }
.form-row-custom { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.form-row-custom label { min-width: 80px; font-weight: 600; color: #1E3A5F; }

/* ---------- Analysis Panel ---------- */
.analysis-panel {
  display: none; margin-top: 15px; padding: 20px; border: 1px solid #E2E8F0;
  border-radius: 12px; background: #fff; max-height: 600px; overflow-y: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.analysis-panel.active { display: block; }
.analysis-panel h3 { margin: 0 0 10px; font-size: 16px; color: #0F172A; font-weight: 700; }
.analysis-panel .close-panel {
  float: right; cursor: pointer; font-size: 18px; color: #94A3B8;
  border: none; background: none; padding: 0 4px; transition: color 0.2s;
}
.analysis-panel .close-panel:hover { color: #0F172A; }
.analysis-content { line-height: 1.7; font-size: 14px; }
.analysis-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.analysis-content table th, .analysis-content table td { border: 1px solid #E2E8F0; padding: 6px 8px; font-size: 13px; }
.analysis-content table th { background: #F1F5F9; color: #1E3A5F; font-weight: 600; }

/* ---------- Historical Analysis ---------- */
.historical-container {
  max-width: 1400px; margin: 20px auto; padding: 20px; font-size: 13px;
}
.summary-card { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-box {
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 12px;
  padding: 15px 20px; min-width: 150px; text-align: center;
  transition: all 0.2s;
}
.stat-box:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
.stat-box .label { font-size: 12px; color: #64748B; margin-bottom: 5px; }
.stat-box .value { font-size: 24px; font-weight: 700; color: #0F172A; }
.stat-box .value.positive { color: #DC2626; }
.stat-box .value.negative { color: #16A34A; }
.chart-container-box {
  background: #fff; border: 1px solid #E2E8F0; border-radius: 12px;
  padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stats-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 20px;
}
.stats-table th { background: linear-gradient(135deg, #1E3A5F, #0F172A); color: white; padding: 8px; text-align: center; border: 1px solid #1E3A5F; }
.stats-table td { padding: 6px 8px; text-align: center; border: 1px solid #E2E8F0; }
.stats-table tr:nth-child(even) { background-color: #F8FAFC; }
.occurrence-table {
  width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 15px;
}
.occurrence-table th { background: linear-gradient(135deg, #475569, #334155); color: white; padding: 6px; text-align: center; border: 1px solid #475569; }
.occurrence-table td { padding: 4px 6px; text-align: center; border: 1px solid #E2E8F0; }
.occurrence-table tr:nth-child(even) { background-color: #F8FAFC; }

/* ---------- Utility ---------- */
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-danger { color: #DC2626; }

/* ---------- Stock Autocomplete ---------- */
.stock-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #CBD5E1;
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
  z-index: 9999;
}
.stock-ac-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #F1F5F9;
  transition: all 0.15s;
}
.stock-ac-item:last-child { border-bottom: none; }
.stock-ac-item:hover,
.stock-ac-item.active {
  background: #EFF6FF;
  color: #1E3A5F;
}
.stock-ac-item strong {
  color: #3B82F6;
}
.text-success { color: #16A34A; }
.back-link { display: inline-block; margin-bottom: 15px; color: #64748B; text-decoration: none; transition: color 0.2s; }
.back-link:hover { text-decoration: underline; color: #1E3A5F; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .main-content { flex-direction: column; }
  .header { flex-direction: column; }
  .page-banner { flex-direction: column; gap: 10px; text-align: center; }
  .right-controls { align-items: stretch; }
  .control-buttons { text-align: center; }
}
@media (max-width: 767px) {
  .tech-search-container { padding: 0 10px 10px; }
  .results-table { font-size: 11px; }
  .results-table th, .results-table td { padding: 4px 5px; }
  .criteria-modal { min-width: auto; width: 95vw; }
  .summary-bar { flex-direction: column; gap: 8px; }
  .analysis-container { padding: 15px; }
}

/* ---------- Animations ---------- */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
