/* ============================================
   TRY FREE PAGE - CLEAN & PROFESSIONAL
   ============================================ */

/* Dark Mode - TRUE BLACK */
[data-theme="dark"] body {
  background-color: #000000 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .navbar {
  background-color: #0a0a0a !important;
  border-bottom-color: #1a1a1a !important;
}

/* Fix Dark Mode Text Colors */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
  color: #f1f5f9 !important;
}

[data-theme="dark"] p,
[data-theme="dark"] label {
  color: #d1d5db !important;
}

[data-theme="dark"] .navbar a,
[data-theme="dark"] .navbar span,
[data-theme="dark"] .navbar button {
  color: #f1f5f9 !important;
}

/* Select dropdown - Light mode */
select,
option {
  background-color: #ffffff !important;
  color: #1f2937 !important;
  border-color: #d1d5db !important;
}

/* Select dropdown - Dark mode */
[data-theme="dark"] select,
[data-theme="dark"] option {
  background-color: #1a1a1a !important;
  color: #f1f5f9 !important;
  border-color: #374151 !important;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(0, 0, 0, 0.95);
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

[data-theme="dark"] .loading-spinner {
  border-color: #1a1a1a;
  border-top-color: #60a5fa;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Theme Toggle Icons */
[data-theme="light"] .sun-icon {
  display: inline;
  color: #1f2937;
}

[data-theme="light"] .moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: inline;
  color: #f1f5f9;
}

/* Icon Hover */
.icon-hover {
  transition: background-color 0.15s ease;
}

.icon-hover:hover {
  background-color: var(--bg-tertiary);
}

/* Mobile Sidebar - Slide from Left */
.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-primary);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.mobile-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-primary);
}

.sidebar-nav {
  padding: 12px;
}

.sidebar-link {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.15s ease;
  margin-bottom: 4px;
}

.sidebar-link:hover {
  background-color: var(--bg-tertiary);
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: 12px 0;
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Profile Dropdown */
.profile-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 160px;
  background: var(--card-bg);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 6px;
  z-index: 50;
}

.dropdown-item {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.15s ease;
  cursor: pointer;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font-weight: 500;
}

.dropdown-item:hover {
  background-color: var(--bg-tertiary);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: 6px 0;
}

/* Screener Cards - Better Design */
.screener-card {
  background: var(--card-bg);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

[data-theme="dark"] .screener-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.free-card {
  border-left: 3px solid #10b981;
}

.premium-card {
  border-left: 3px solid #f59e0b;
  opacity: 0.9;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stock-count {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
}

/* Badges */
.badge-free {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background-color: #dcfce7;
  color: #16a34a;
}

[data-theme="dark"] .badge-free {
  background-color: #064e3b;
  color: #6ee7b7;
}

.badge-premium {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background-color: #fef3c7;
  color: #d97706;
}

[data-theme="dark"] .badge-premium {
  background-color: #78350f;
  color: #fcd34d;
}

/* Buttons */
.btn-view {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background-color: #3b82f6;
  color: white;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.btn-view:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-upgrade {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background-color: #f59e0b;
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-top: auto;
}

.btn-upgrade:hover {
  background-color: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

/* Modal */
.screener-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.screener-modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-primary);
}

.close-modal-btn {
  padding: 6px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.close-modal-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Table */
#screenerResults table {
  width: 100%;
  border-collapse: collapse;
}

#screenerResults th {
  background-color: var(--table-header-bg);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

#screenerResults td {
  padding: 14px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 14px;
  color: var(--text-primary);
}

#screenerResults tr:hover {
  background-color: var(--table-row-hover);
}

#screenerResults a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
}

[data-theme="dark"] #screenerResults a {
  color: #60a5fa;
}

#screenerResults a:hover {
  text-decoration: underline;
}

/* Positive/Negative */
.positive {
  color: #10b981 !important;
  font-weight: 600;
}

.negative {
  color: #ef4444 !important;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .screener-card {
    padding: 16px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-description {
    font-size: 13px;
  }

  .modal-content {
    max-height: 95vh;
    border-radius: 8px;
  }

  .modal-header,
  .modal-body {
    padding: 16px;
  }

  #screenerResults {
    overflow-x: auto;
  }

  #screenerResults table {
    min-width: 600px;
  }
}

/* ============================================
   FOOTER
   ============================================ */

footer {
  background-color: var(--bg-primary);
  transition: background-color 0.2s ease;
}

[data-theme="dark"] footer {
  background-color: #000000;
  border-top-color: #1a1a1a !important;
}

footer p {
  margin: 0;
}

/* ============================================
   COPY CONTROLS & PAGINATION
   ============================================ */

.copy-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  flex-wrap: wrap;
}

.copy-btn {
  padding: 8px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.copy-btn:hover {
  background: #2563eb;
}

.copy-range {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.range-input {
  width: 70px;
  padding: 6px 8px;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
}

.page-btn {
  padding: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: #3b82f6;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================
   TABLE IMPROVEMENTS
   ============================================ */

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

#screenerResults table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary);
}

#screenerResults table thead th {
  background: var(--bg-secondary);
  box-shadow: 0 1px 0 var(--border-primary);
}

.stock-name-cell {
  cursor: pointer;
  position: relative;
}

.stock-symbol {
  color: #3b82f6;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.stock-name-cell:hover .stock-symbol {
  color: #2563eb;
  text-decoration: underline;
}

/* ============================================
   CHART PREVIEW HOVER
   ============================================ */

.chart-preview {
  position: fixed;
  z-index: 10000;
  background: var(--card-bg);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 8px;
  pointer-events: none;
  animation: fadeIn 0.2s ease;
}

[data-theme="dark"] .chart-preview {
  background: #1a1a1a;
  border-color: #333;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   CHECKBOX STYLING
   ============================================ */

input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

#screenerResults td:first-child,
#screenerResults th:first-child {
  width: 40px;
  text-align: center;
}

.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.sortable-header:hover {
  background-color: var(--bg-tertiary) !important;
}

.sort-icon {
  margin-left: 5px;
  font-size: 12px;
  opacity: 0.6;
}
