/* Modern Pool Web UI Theme - Compatible with index.html */

/* CSS Variables for Theme System */
:root {
  /* Light Theme Colors (matching pool web app) */
  --background: hsl(240 5% 98%);
  --foreground: hsl(240 10% 4%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(240 10% 4%);
  --primary: hsl(217 89% 55%);
  --primary-foreground: hsl(0 0% 98%);
  --secondary: hsl(210 20% 97%);
  --secondary-foreground: hsl(240 10% 4%);
  --muted: hsl(220 14% 96%);
  --muted-foreground: hsl(215 14% 46%);
  --accent: hsl(220 14% 94%);
  --accent-foreground: hsl(240 10% 4%);
  --border: hsl(215 16% 89%);
  --input: hsl(215 16% 89%);
  --ring: hsl(217 89% 55% / 0.2);
  --radius: 0.5rem;
  
  /* Status Colors */
  --success: hsl(142 76% 36%);
  --warning: hsl(38 92% 50%);
  --error: hsl(0 72% 51%);
  --info: hsl(217 89% 55%);
}

/* Dark Theme */
[data-theme="dark"] {
  --background: hsl(222.2 84% 4.9%);
  --foreground: hsl(210 40% 98%);
  --card: hsl(222.2 84% 5.9%);
  --card-foreground: hsl(210 40% 98%);
  --primary: hsl(217.2 91.2% 59.8%);
  --primary-foreground: hsl(222.2 47.4% 11.2%);
  --secondary: hsl(217.2 32.6% 17.5%);
  --secondary-foreground: hsl(210 40% 98%);
  --muted: hsl(217.2 32.6% 17.5%);
  --muted-foreground: hsl(215 20.2% 65.1%);
  --accent: hsl(217.2 32.6% 17.5%);
  --accent-foreground: hsl(210 40% 98%);
  --border: hsl(217.2 32.6% 17.5%);
  --input: hsl(217.2 32.6% 17.5%);
  --ring: hsl(224.3 76.3% 48%);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header Styles */
.header {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: static;
  backdrop-filter: none;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.logo:hover {
  color: var(--primary);
  opacity: 0.8;
}

/* Navigation */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Search */
.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search__inner {
  position: relative;
  width: 300px;
}

.search__text {
  width: 100%;
  padding: 0.5rem 1rem;
  padding-right: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search__text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--ring);
}

.search__helper {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  font-size: 1rem;
  pointer-events: none;
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--foreground);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
}

.theme-toggle:hover {
  background-color: var(--accent);
  border-color: var(--primary);
}

/* Theme Selector */
.themes {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100vh;
  background-color: var(--card);
  border-left: 1px solid var(--border);
  transition: right 0.3s ease;
  z-index: 100;
  padding: 1rem;
  overflow-y: auto;
}

.themes.active {
  right: 0;
}

.themes__item {
  display: block;
  width: 100%;
  height: 3rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
  cursor: pointer;
  overflow: hidden;
}

.themes__item:hover {
  border-color: var(--primary);
}

.themes__item.active {
  border-color: var(--primary);
}

/* Cards */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-body {
  padding: 1.5rem;
}

.card h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 1rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: auto;
  min-width: 800px; /* Ensure minimum width for proper display */
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table th {
  background-color: var(--muted);
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table tbody tr:hover {
  background-color: var(--muted);
}

.table td {
  color: var(--foreground);
}

.table img {
  border-radius: 50%;
  width: 32px;
  height: 32px;
  object-fit: cover;
}

/* Ensure hashrate and numeric data stays on one line */
.table td span,
.table td strong {
  white-space: nowrap !important;
  display: inline-block;
  min-width: fit-content;
}

/* Links */
.table a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.table a:hover {
  color: var(--primary);
  opacity: 0.8;
}

/* Content */
.content {
  padding: 1rem 0;
}

.content__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.content__title {
  margin-bottom: 2rem;
  text-align: center;
}

.content__title h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

/* Algorithm Sections */
.search-pool-algo {
  margin-bottom: 2rem;
}

.search-pool-algo:last-child {
  margin-bottom: 0;
}

/* Footer */
.footer {
  background-color: var(--card);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  color: var(--muted-foreground);
}

.footer p {
  margin-bottom: 1rem;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--primary);
  opacity: 0.8;
}

.footer img {
  vertical-align: middle;
  margin: 0 0.25rem;
}

/* Referral Section */
.referral-section {
  background: linear-gradient(135deg, var(--primary), var(--muted));
  padding: 1.5rem;
  border-radius: calc(var(--radius) + 2px);
  margin: 2rem 0;
  text-align: center;
  color: var(--primary-foreground);
}

.referral-section h4 {
  color: var(--primary-foreground);
  margin-bottom: 0.5rem;
}

.referral-section p {
  margin-bottom: 1rem;
  opacity: 0.9;
}

.referral-section a {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--primary-foreground);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.referral-section a:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-controls {
    width: 100%;
    justify-content: center;
  }
  
  .search__inner {
    width: 100%;
    max-width: 300px;
  }
  
  .content__title h1 {
    font-size: 2rem;
  }
  
  .table-responsive {
    font-size: 0.75rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .content__inner {
    padding: 0 0.5rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .content__title h1 {
    font-size: 1.75rem;
  }
}

/* Loading Spinner */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.page-loader__spinner {
  width: 3rem;
  height: 3rem;
  animation: spin 1s linear infinite;
}

.page-loader__spinner svg {
  width: 100%;
  height: 100%;
}

.page-loader__spinner circle {
  stroke: var(--primary);
  stroke-dasharray: 90;
  stroke-dashoffset: 90;
  animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
  0% { stroke-dashoffset: 90; }
  50% { stroke-dashoffset: 45; }
  100% { stroke-dashoffset: 90; }
}

/* Hide loader after page loads */
.page-loaded .page-loader {
  display: none;
}

/* Smooth transitions */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }