/* ==========================================================================
   Analysis Pages CSS - AAAInfoWeb-Cloudflare
   ========================================================================== */

/* ---------- 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, #1a237e 0%, #283593 50%, #3949ab 100%);
  color: #fff;
  padding: 16px 24px;
  border-radius: 0 0 8px 8px;
  margin: 0 -20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(26,35,126,0.15);
}
.page-banner h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.5px; }
.page-banner-actions { display: flex; gap: 8px; align-items: center; }
.banner-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}
.banner-btn:hover { background: rgba(255,255,255,0.25); color: #fff; text-decoration: none; }
.banner-btn-highlight { background: #ff9800; border-color: #f57c00; font-weight: bold; }
.banner-btn-highlight:hover { background: #f57c00; }

/* ---------- 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 #b0bec5;
  padding: 4px 6px;
  font-size: 13px;
  margin: 0 2px;
  height: 28px;
  box-sizing: border-box;
  border-radius: 3px;
  transition: border-color 0.2s;
}
.tech-search-container select:focus,
.tech-search-container input:focus {
  border-color: #1976d2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(25,118,210,0.12);
}
.tech-search-container input[type="checkbox"] {
  vertical-align: middle;
  margin-right: 4px;
  accent-color: #1976d2;
}
.w-small { width: 70px; }
.w-medium { width: 150px; }
.w-date { width: 135px; }

/* ---------- Search / Reset Buttons ---------- */
button.search-btn {
  background: linear-gradient(135deg, #43a047, #388e3c);
  color: white;
  border: none;
  padding: 10px 30px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 6px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(56,142,60,0.25);
  transition: all 0.2s;
}
button.search-btn:hover {
  background: linear-gradient(135deg, #388e3c, #2e7d32);
  box-shadow: 0 3px 8px rgba(56,142,60,0.35);
  transform: translateY(-1px);
}
button.reset-btn {
  background: linear-gradient(135deg, #ef5350, #e53935);
  color: white;
  border: none;
  padding: 10px 30px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 6px;
  margin-left: 10px;
  box-shadow: 0 2px 4px rgba(229,57,53,0.25);
  transition: all 0.2s;
}
button.reset-btn:hover {
  background: linear-gradient(135deg, #e53935, #c62828);
  box-shadow: 0 3px 8px rgba(229,57,53,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: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  background: #fafafa;
  transition: all 0.2s;
}
.save-btn:hover { background: #e0e0e0; border-color: #9e9e9e; }
.delete-btn { border-color: #ef5350; color: #d32f2f; }
.delete-btn:hover { background: #ffebee; border-color: #d32f2f; }

/* ---------- Criteria Modal ---------- */
.criteria-modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center;
}
.criteria-modal-overlay.active { display: flex; }
.criteria-modal {
  background: #fff; border-radius: 10px; padding: 24px; min-width: 600px; max-width: 800px;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.criteria-modal h3 { margin: 0 0 16px; font-size: 18px; color: #1a237e; }
.criteria-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.criteria-table th, .criteria-table td { padding: 10px 12px; border-bottom: 1px solid #e0e0e0; text-align: left; }
.criteria-table th { background: #e8eaf6; font-weight: bold; color: #283593; }
.criteria-table tr:hover { background: #e3f2fd; }
.cm-btn { padding: 4px 10px; font-size: 12px; cursor: pointer; border: 1px solid #bdbdbd; border-radius: 4px; background: #fafafa; margin-right: 4px; transition: all 0.2s; }
.cm-btn:hover { background: #e0e0e0; border-color: #9e9e9e; }
.cm-btn-del { border-color: #ef5350; color: #d32f2f; }
.cm-btn-del:hover { background: #ffebee; border-color: #d32f2f; }

/* ---------- Layout Sections ---------- */
.header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  gap: 15px;
}
.date-section {
  border: 1px solid #c5cae9;
  padding: 15px;
  background: #f5f7ff;
  border-radius: 6px;
  flex: 1;
}
.date-section > div:first-child { color: #283593; }
.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 #c5cae9;
  background: #fff;
  padding: 18px;
  border-radius: 6px;
  display: flex;
  gap: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.section-label {
  font-size: 14px;
  font-weight: bold;
  color: #283593;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #c5cae9;
  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: #f5f7ff; }
.divider { border-top: 2px solid #c5cae9; margin: 18px 0; }
.chip-select { width: 120px; }
.right-col { flex: 1; min-width: 280px; }
.ma-range-box {
  border: 2px solid #c5cae9;
  padding: 12px;
  border-radius: 6px;
  background: #f5f7ff;
}
.ma-range-box legend { font-weight: bold; padding: 0 8px; color: #283593; }
.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, #3949ab, #283593);
  color: white;
  padding: 10px 8px;
  text-align: left;
  font-weight: bold;
  border: 1px solid #3949ab;
  font-size: 13px;
}
.results-table td { padding: 6px 8px; border: 1px solid #ddd; }
.results-table tr:nth-child(even) { background-color: #f9f9f9; }
.results-table tr:hover { background-color: #f0f0f0; }
.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 #7f9db9; padding: 3px; font-size: 13px; height: 24px; }
.pagination-nav { display: flex; gap: 4px; align-items: center; }
.pagination-nav button {
  padding: 4px 10px;
  border: 1px solid #3949ab;
  background: #f5f7ff;
  cursor: pointer;
  font-size: 12px;
  border-radius: 3px;
  transition: all 0.2s;
}
.pagination-nav button:hover:not(:disabled) { background: #3949ab; color: white; }
.pagination-nav button:disabled { opacity: 0.4; cursor: default; }
.pagination-nav button.active { background: #3949ab; color: white; font-weight: bold; }
.pagination-info { color: #666; }
.btn-backtest {
  background: linear-gradient(135deg, #1976d2, #1565c0);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-backtest:hover {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  box-shadow: 0 2px 4px rgba(21,101,192,0.3);
}

/* ---------- 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 Gemini Analysis ---------- */
.analysis-container {
  background-color: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;
  margin: 0 auto;
}
.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;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  box-sizing: border-box;
}
.analysis-container .input-group button {
  padding: 12px 18px;
  background-color: #1a73e8;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}
.analysis-container .input-group button:hover { background-color: #155ab6; }
.results-area {
  margin-top: 25px; padding: 20px;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}
.results-area h2 { color: #1a73e8; margin-top: 0; border-bottom: 1px solid #ddd; padding-bottom: 10px; }
#chartContainer { width: 100%; height: 450px; margin: 0 auto 20px; }
.loader {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #1a73e8;
  border-radius: 50%;
  width: 40px; height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
  display: none;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
#analysisOutput { line-height: 1.7; font-size: 16px; }
#analysisOutput h3 { color: #1a73e8; border-bottom: 2px solid #e0e0e0; padding-bottom: 8px; margin-top: 24px; margin-bottom: 16px; }
#analysisOutput ul { padding-left: 20px; }
#analysisOutput li { margin-bottom: 8px; }
#analysisOutput strong, #analysisOutput b { color: #d93025; }
.limit-error-container {
  text-align: center; padding: 30px;
  background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
  border: 1px solid #ffcdd2; border-radius: 12px;
  box-shadow: 0 4px 15px rgba(211,47,47,0.1);
}
.limit-icon { font-size: 48px; margin-bottom: 15px; display: inline-block; }
.limit-title { color: #d32f2f; font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.limit-desc { color: #555; margin-bottom: 15px; font-size: 16px; }
.limit-timer {
  display: inline-block; background-color: #ffebee; color: #c62828;
  padding: 6px 14px; border-radius: 20px; font-weight: 600; margin-bottom: 20px; font-size: 14px;
}
.btn-upgrade {
  background: linear-gradient(45deg, #FF512F 0%, #DD2476 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(221,36,118,0.3);
  transition: transform 0.2s;
}
.btn-upgrade:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(221,36,118,0.4); 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: #333; }
.watchlist-table {
  width: 100%; border-collapse: collapse; border: 1px solid #ccc; font-size: 13px;
}
.watchlist-table th, .watchlist-table td { border: 1px solid #ccc; padding: 6px 10px; text-align: left; }
.watchlist-table th { background: #e8eef4; font-weight: bold; white-space: nowrap; }
.watchlist-table tr:hover { background: #f5f8fc; }
.btn-remove {
  padding: 3px 10px; background: #ef5350; color: #fff; border: none;
  border-radius: 3px; cursor: pointer; font-size: 12px;
}
.btn-remove:hover { background: #c62828; }
.loading-msg { padding: 30px; text-align: center; color: #888; font-size: 15px; }
.summary-bar {
  display: flex; gap: 20px; margin-bottom: 15px; padding: 10px 15px;
  background: #f5f8fc; border: 1px solid #d0d8e0; border-radius: 4px; font-size: 14px;
}
.summary-bar .label { color: #666; }
.summary-bar .value { font-weight: bold; }
.btn-alert-action {
  padding: 3px 8px; background: #1976D2; color: #fff; border: none;
  border-radius: 3px; cursor: pointer; font-size: 12px; margin-right: 4px;
}
.btn-alert-action:hover { background: #1565C0; }
.btn-settings {
  padding: 6px 14px; background: #455A64; color: #fff; border: none;
  border-radius: 3px; cursor: pointer; font-size: 13px;
}
.btn-settings:hover { background: #37474F; }

/* ---------- Modal Overlay ---------- */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-content-custom {
  background: #fff; border-radius: 6px; padding: 20px; min-width: 400px; max-width: 600px;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.modal-content-custom h3 { margin-top: 0; }
.form-row-custom { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.form-row-custom label { min-width: 80px; font-weight: bold; }

/* ---------- Analysis Panel ---------- */
.analysis-panel {
  display: none; margin-top: 15px; padding: 15px; border: 1px solid #d0d8e0;
  border-radius: 6px; background: #fff; max-height: 600px; overflow-y: auto;
}
.analysis-panel.active { display: block; }
.analysis-panel h3 { margin: 0 0 10px; font-size: 16px; }
.analysis-panel .close-panel {
  float: right; cursor: pointer; font-size: 18px; color: #999;
  border: none; background: none; padding: 0 4px;
}
.analysis-panel .close-panel:hover { color: #333; }
.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 #ddd; padding: 6px 8px; font-size: 13px; }
.analysis-content table th { background: #f5f5f5; }

/* ---------- 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: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px;
  padding: 15px 20px; min-width: 150px; text-align: center;
}
.stat-box .label { font-size: 12px; color: #666; margin-bottom: 5px; }
.stat-box .value { font-size: 24px; font-weight: bold; color: #333; }
.stat-box .value.positive { color: #d32f2f; }
.stat-box .value.negative { color: #388e3c; }
.chart-container-box {
  background: #fff; border: 1px solid #dee2e6; border-radius: 8px;
  padding: 20px; margin-bottom: 20px;
}
.stats-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 20px;
}
.stats-table th { background-color: #5c7a99; color: white; padding: 8px; text-align: center; border: 1px solid #ddd; }
.stats-table td { padding: 6px 8px; text-align: center; border: 1px solid #ddd; }
.stats-table tr:nth-child(even) { background-color: #f9f9f9; }
.occurrence-table {
  width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 15px;
}
.occurrence-table th { background-color: #6c757d; color: white; padding: 6px; text-align: center; border: 1px solid #ddd; }
.occurrence-table td { padding: 4px 6px; text-align: center; border: 1px solid #ddd; }
.occurrence-table tr:nth-child(even) { background-color: #f9f9f9; }

/* ---------- Utility ---------- */
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-danger { color: #d32f2f; }
.text-success { color: #388e3c; }
.back-link { display: inline-block; margin-bottom: 15px; color: #5c7a99; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ---------- 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; }
}
