/* style.css for International Stock Screener */
:root {
  --bg-color: #f5f7fa;
  --card-bg: #fff;
  --text-color: #333;
  --border-color: #ddd;
  --navbar-bg: linear-gradient(90deg,#0052cc,#003366);
  --chart-bg: #fff;
  --chart-text: #333;
  --chart-grid: #eee;
  --chart-border: #ccc;
  --btn-text-color: #333;
  --btn-border-color: #ddd;
  --btn-bg-color: #fff;
  --light-bg: #f8f9fa;
  --dark-light-bg: #2d3748;
  --muted-text: #6c757d;
  --dark-muted-text: #a0aec0;
}

[data-theme="dark"] {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-color: #e0e0e0;
  --border-color: #333;
  --navbar-bg: linear-gradient(90deg,#003366,#001a33);
  --chart-bg: #1e1e1e;
  --chart-text: #e0e0e0;
  --chart-grid: #333;
  --chart-border: #444;
  --btn-text-color: #e0e0e0;
  --btn-border-color: #444;
  --btn-bg-color: #2d2d2d;
  --light-bg: #2d3748;
  --dark-light-bg: #1a202c;
  --muted-text: #a0aec0;
  --dark-muted-text: #718096;
}

body { 
  background: var(--bg-color); 
  font-family:'Inter',sans-serif; 
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
}

.navbar { 
  background: var(--navbar-bg); 
  padding: 0.8rem 0;
}

.navbar-brand { 
  color: #fff !important; 
  font-weight: 600; 
  font-size: 1.2rem;
}

.navbar-toggler {
  border: 1px solid rgba(255,255,255,0.3);
}

.navbar-toggler-icon {
  filter: invert(1);
}

.btn-outline-light {
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}

.btn-outline-light:hover {
  background-color: rgba(255,255,255,0.1);
  border-color: #fff;
}

.btn-warning {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #212529;
  font-weight: 600;
}

.card { 
  background: var(--card-bg); 
  border-radius: 12px; 
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-header {
  background-color: var(--light-bg) !important;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  font-weight: 600;
}

.card-body {
  background-color: var(--card-bg);
  color: var(--text-color);
}

.bg-light {
  background-color: var(--light-bg) !important;
  color: var(--text-color);
}

.text-muted {
  color: var(--muted-text) !important;
}

.stock-link { 
  text-decoration: none; 
  transition: all 0.3s ease; 
  font-weight: 600;
  color: #0052cc;
}

.stock-link:hover { 
  text-decoration: underline; 
  color: #003366;
}

.table {
  margin-bottom: 0;
}

.table th { 
  background-color: #003366; 
  color: #fff; 
  font-weight: 600;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-color: #eef1f5;
}

.table-hover tbody tr:hover {
  background-color: rgba(0, 82, 204, 0.05);
}

.align-middle {
  vertical-align: middle !important;
}

.price-up { color: #26a69a; } 
.price-down { color: #ef5350; }
.text-success { color: #26a69a !important; }
.text-danger { color: #ef5350 !important; }

.chart-container { 
  height: 400px; 
  width: 100%; 
}

.volume-container { 
  height: 120px; 
  width: 100%; 
}

.technical-card { 
  background: var(--light-bg); 
  padding: 15px; 
  border-radius: 8px; 
  border-left: 4px solid #0052cc; 
  margin-bottom: 10px; 
}

.info-badge { 
  background: #e3f2fd; 
  color: #1976d2; 
  padding: 8px 12px; 
  border-radius: 6px; 
  font-size: 0.9em; 
}

/* Dark mode adjustments for technical cards */
[data-theme="dark"] .technical-card {
  background: var(--dark-light-bg);
  border-left-color: #4a90e2;
}

[data-theme="dark"] .info-badge {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

/* Button Styles for Theme Support */
.toggle-container {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 16px;
  background: var(--btn-bg-color);
  border: 1px solid var(--btn-border-color);
  color: var(--btn-text-color);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.8rem;
}

.toggle-btn.active {
  background: #0052cc;
  color: white;
  border-color: #0052cc;
}

.timeframe-btn {
  font-weight: 500;
  transition: all 0.2s ease;
  color: var(--btn-text-color);
  border-color: var(--btn-border-color);
  background-color: var(--btn-bg-color);
}

.timeframe-btn.btn-primary {
  background-color: #0052cc !important;
  color: #fff !important;
  border-color: #0044aa !important;
}

.timeframe-btn.btn-outline-primary {
  color: #0052cc;
  border-color: #0052cc;
  background-color: var(--btn-bg-color);
}

.timeframe-btn.btn-outline-primary:hover {
  background-color: #0052cc;
  color: #fff;
}

.timeframe-btn.btn-primary:hover {
  background-color: #003d99 !important;
}

.indicator-btn {
  font-size: 0.75rem;
  padding: 2px 6px;
  color: var(--btn-text-color);
  border-color: var(--btn-border-color);
  background-color: var(--btn-bg-color);
}

.indicator-btn.active {
  background-color: #0052cc !important;
  color: white !important;
  border-color: #0052cc !important;
}

.chart-type-btn {
  font-size: 0.8rem;
  padding: 3px 8px;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #0052cc;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.volume-scale-info {
  font-size: 0.8em;
  color: var(--text-color);
  text-align: center;
  margin-top: 10px;
}

.indicator-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .chart-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-container {
    height: 300px;
  }
  .volume-container {
    height: 100px;
  }
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
}

.crosshair-info {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255,255,255,0.9);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 100;
  border: 1px solid #ddd;
  color: #333;
}

[data-theme="dark"] .crosshair-info {
  background: rgba(30,30,30,0.9);
  color: #e0e0e0;
  border-color: #444;
}

.chart-wrapper {
  position: relative;
}

.fullscreen-info-label {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 1000;
}

.recommendation-buy {
  border-left: 4px solid #28a745 !important;
}

.recommendation-sell {
  border-left: 4px solid #dc3545 !important;
}

.recommendation-hold {
  border-left: 4px solid #ffc107 !important;
}

.confidence-high {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
}

.confidence-medium {
  background: linear-gradient(45deg, #ffc107, #fd7e14);
  color: white;
}

.confidence-low {
  background: linear-gradient(45deg, #6c757d, #495057);
  color: white;
}

/* Fix for all text elements */
h1, h2, h3, h4, h5, h6,
.card-title, .card-subtitle,
.table, .table th, .table td,
.small, .text-muted,
.badge, .alert {
  color: var(--text-color) !important;
}

/* Specific fixes for technical analysis section */
#technicalAnalysis h5,
#technicalAnalysis h6,
#technicalAnalysis .h4,
#technicalAnalysis .h5,
#technicalAnalysis strong {
  color: var(--text-color) !important;
}

#technicalAnalysis .card.border-0 {
  background-color: var(--light-bg);
  border: 1px solid var(--border-color);
}

#technicalAnalysis .rounded {
  background-color: var(--light-bg);
}

/* Ensure support/resistance text is visible */
.text-success, .text-danger {
  opacity: 1 !important;
}

/* ---------- Fullscreen Chart Mode ---------- */
.fullscreen {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  background: var(--card-bg);
  z-index: 9999;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 10px;
  overflow: hidden;
}

.fullscreen #chartFullWrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
}

.fullscreen #chartContainer {
  flex: 1;
  min-height: 70%;
}

.fullscreen #volumeContainer {
  height: 20vh !important;
  min-height: 100px;
}

.fullscreen .volume-scale-info {
  text-align: center;
  font-size: 0.8rem;
  margin-top: 5px;
}

/* Fullscreen Chart Info Label */
.fullscreen-info-label {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 82, 204, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  z-index: 1000;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

[data-theme="dark"] .fullscreen-info-label {
  background: rgba(0, 82, 204, 0.8);
  border-color: rgba(255,255,255,0.1);
}

/* Fullscreen time scale fix */
.fullscreen .tv-lightweight-charts {
  overflow: visible !important;
}

.fullscreen .chart-container,
.fullscreen .volume-container {
  overflow: visible !important;
}

/* Additional International Screener Styles */
.badge.bg-secondary {
  background-color: #6c757d !important;
}

.currency-badge {
  font-size: 0.7rem;
  background: #6c757d;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Spinner alignment */
.spinner-border {
  vertical-align: middle;
}

/* Alert styling */
.alert {
  border: 1px solid transparent;
  border-radius: 8px;
}

.alert-info {
  background-color: #e3f2fd;
  border-color: #bbdefb;
  color: #1565c0;
}

.alert-danger {
  background-color: #ffebee;
  border-color: #ffcdd2;
  color: #c62828;
}

/* Table responsive fix */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Container max width */
.container {
  max-width: 1400px;
}

/* Responsive text sizes */
@media (max-width: 576px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }
  .h4 { font-size: 1rem; }
  .h5 { font-size: 0.9rem; }
}