@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Ultra-Sophisticated Over/Under Trading Platform Variables */
:root {
  --primary-blue: #1a365d;
  --secondary-blue: #2563eb;
  --accent-blue: #3b82f6;
  --light-blue: #60a5fa;
  --dark-navy: #0f172a;
  --slate: #1e293b;
  --light-slate: #475569;
  --white: #ffffff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --glass-bg: rgba(15, 23, 42, 0.85);
  --glass-light: rgba(59, 130, 246, 0.08);
  --glass-medium: rgba(59, 130, 246, 0.12);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-hover: rgba(255, 255, 255, 0.2);
  --shadow-compact: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 12px rgba(59, 130, 246, 0.4);
  --shadow-active: 0 8px 20px rgba(59, 130, 246, 0.3);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.4);
  --gradient-primary: linear-gradient(135deg, #1a365d 0%, #2563eb 50%, #3b82f6 100%);
  --gradient-accent: linear-gradient(45deg, #3b82f6 0%, #60a5fa 100%);
  --gradient-black: linear-gradient(135deg, #000000 0%, #1f2937 50%, #374151 100%);
  --gradient-success: linear-gradient(135deg, #065f46 0%, #10b981 50%, #34d399 100%);
  --gradient-shimmer: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-bounce: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 30%, #334155 60%, #475569 100%);
  color: var(--white);
  font-size: 10px;
  position: relative;
}

/* Sophisticated Background Animation */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 40% 60%, rgba(168, 85, 247, 0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
  animation: backgroundShift 20s ease-in-out infinite;
}

/* Floating Particles */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, rgba(59, 130, 246, 0.3), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(16, 185, 129, 0.3), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(168, 85, 247, 0.3), transparent),
    radial-gradient(1px 1px at 60% 10%, rgba(59, 130, 246, 0.3), transparent);
  background-repeat: repeat;
  background-size: 550px 550px, 350px 350px, 250px 250px, 150px 150px;
  animation: particleFloat 40s linear infinite;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

.container {
  position: relative;
  width: 100%;
  height: 100vh;
  padding: 2px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: containerGlow 3s ease-in-out infinite;
}

/* Premium Header with Advanced Animations */
.input-container {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--glass-light);
  backdrop-filter: blur(15px) saturate(1.3);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    var(--shadow-compact),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  margin-bottom: 2px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  animation: slideDown 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
}

.input-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-shimmer);
  animation: shimmer 3s ease-in-out infinite;
}

.input-container:hover {
  border-color: var(--glass-border-hover);
  box-shadow: 
    var(--shadow-hover),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Ultra-Premium Select Styling */
#symbolInput {
  flex: 1;
  min-width: 100px;
  padding: 4px 6px;
  font-size: 8px;
  font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, var(--dark-navy) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 1px solid var(--slate);
  border-radius: 6px;
  outline: none;
  transition: var(--transition-spring);
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

#symbolInput::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 6px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition-smooth);
  z-index: -1;
}

#symbolInput:hover, #symbolInput:focus {
  border-color: var(--accent-blue);
  box-shadow: 
    0 0 0 2px rgba(59, 130, 246, 0.3),
    inset 0 1px 3px rgba(0, 0, 0, 0.3),
    var(--shadow-glow);
  transform: scale(1.02) translateY(-1px);
}

#symbolInput:focus::before {
  opacity: 0.1;
}

/* Advanced Input Styling */
#digitsInput {
  width: 50px;
  padding: 4px;
  font-size: 8px;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--dark-navy) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 1px solid var(--slate);
  border-radius: 6px;
  text-align: center;
  outline: none;
  transition: var(--transition-spring);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

#digitsInput:hover, #digitsInput:focus {
  border-color: var(--accent-blue);
  box-shadow: 
    0 0 0 2px rgba(59, 130, 246, 0.3),
    inset 0 1px 3px rgba(0, 0, 0, 0.3),
    var(--shadow-glow);
  transform: scale(1.05) translateY(-1px);
}

#digitsInput:focus {
  animation: inputPulse 2s ease-in-out infinite;
}

.small-buttons-container,
.medium-buttons-container {
  display: flex;
  gap: 2px;
}

.small-button,
.medium-button {
  padding: 3px 6px;
  font-size: 7px;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--dark-navy) 0%, var(--slate) 100%);
  border: 1px solid var(--light-slate);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: var(--transition-spring);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-compact);
}

.small-button::before,
.medium-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  transition: var(--transition-smooth);
  z-index: -1;
}

.small-button::after,
.medium-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: var(--transition-bounce);
}

.small-button:hover::before,
.medium-button:hover::before {
  left: 0;
}

.small-button:hover,
.medium-button:hover {
  transform: scale(1.05) translateY(-1px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-blue);
}

.small-button:active::after,
.medium-button:active::after {
  width: 100px;
  height: 100px;
}

.small-button.clicked,
.medium-button.clicked {
  background: var(--gradient-primary);
  box-shadow: var(--shadow-glow);
  animation: buttonSuccess 0.3s ease-out;
}

/* Price Display with Advanced Effects */
#priceDisplay {
  padding: 4px 6px;
  margin: 1px 0;
  font-size: 9px;
  font-weight: 700;
  color: var(--white);
  background: var(--glass-light);
  backdrop-filter: blur(15px) saturate(1.2);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 
    var(--shadow-compact),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: priceGlow 2s ease-in-out infinite;
  flex-shrink: 0;
}

#priceDisplay::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-shimmer);
  animation: shimmer 4s ease-in-out infinite;
}

/* Last Digits List with Premium Effects */
#lastDigitsList {
  padding: 4px 6px;
  margin: 1px 0;
  font-size: 7px;
  font-weight: 600;
  color: var(--white);
  background: var(--glass-light);
  backdrop-filter: blur(15px) saturate(1.2);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 
    var(--shadow-compact),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: digitsReveal 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
}

#lastDigitsList::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-shimmer);
  animation: shimmer 4s ease-in-out infinite;
}

/* Chart Container with Advanced Effects - Optimized for Full Screen */
.chart-container {
  display: flex;
  width: 100%;
  flex: 1;
  gap: 2px;
  min-height: 0;
  margin: 1px 0;
  height: calc(100vh - 120px);
}

.chart-container canvas {
  flex: 1;
  background: var(--glass-light);
  backdrop-filter: blur(15px) saturate(1.2);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  padding: 2px;
  position: relative;
  overflow: hidden;
  animation: chartReveal 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 
    var(--shadow-compact),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  cursor: crosshair;
  transition: var(--transition-smooth);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  color: var(--white);
  min-height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
}

.chart-container canvas:hover {
  filter: brightness(1.1) contrast(1.05);
  box-shadow: var(--shadow-hover);
}

/* Individual Chart Styling - Optimized for Full Screen */
#barChart, #differsFromChart, #lineChart {
  width: 100% !important;
  height: calc(100vh - 140px) !important;
  min-height: calc(100vh - 140px) !important;
  max-height: calc(100vh - 140px) !important;
  background: var(--glass-light);
  backdrop-filter: blur(15px) saturate(1.2);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  padding: 4px;
  margin: 1px 0;
  box-shadow: 
    var(--shadow-compact),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  cursor: crosshair;
  transition: var(--transition-smooth);
  animation: chartReveal 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#barChart:hover, #differsFromChart:hover, #lineChart:hover {
  filter: brightness(1.1) contrast(1.05);
  box-shadow: var(--shadow-hover);
}

.chartContainer {
  margin: 2px 0;
}

/* Table Styling - Maintaining existing display properties */
table {
  width: 100%;
  margin: 2px 0;
  background: var(--glass-light);
  backdrop-filter: blur(15px) saturate(1.2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 
    var(--shadow-compact),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-size: 7px;
  animation: tableSlide 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

thead {
  background: var(--gradient-primary);
}

th {
  padding: 4px;
  font-size: 7px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 3px 4px;
  font-size: 6px;
  font-weight: 500;
  color: var(--white);
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
}

tbody tr:hover {
  background: var(--glass-medium);
  transform: scale(1.02);
}

/* Advanced Progress Bar */
.progress {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  width: 2px;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
}

.bar {
  display: block;
  height: 0;
  width: 100%;
  background: var(--gradient-primary);
  box-shadow: 
    0 0 8px rgba(59, 130, 246, 0.8),
    0 0 16px rgba(59, 130, 246, 0.4);
  transition: height 0.2s ease;
  position: relative;
}

.bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(59, 130, 246, 0.8) 0%, transparent 70%);
  filter: blur(4px);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Premium Scrollbar */
::-webkit-scrollbar {
  width: 3px;
}

::-webkit-scrollbar-track {
  background: var(--dark-navy);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gradient-accent);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

/* Select Options */
select option {
  background: var(--dark-navy);
  color: var(--white);
  padding: 4px;
  font-size: 8px;
  font-weight: 600;
}

/* Advanced Animations */
@keyframes backgroundShift {
  0%, 100% { transform: translateX(0) translateY(0); }
  25% { transform: translateX(-20px) translateY(-10px); }
  50% { transform: translateX(20px) translateY(10px); }
  75% { transform: translateX(-10px) translateY(20px); }
}

@keyframes particleFloat {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-100vh) rotate(360deg); }
}

@keyframes containerGlow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 20px rgba(59, 130, 246, 0.1); }
}

@keyframes shimmer {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

@keyframes slideDown {
  0% { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes digitsReveal {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes chartReveal {
  0% { transform: scale(0.9) rotateX(10deg); opacity: 0; }
  100% { transform: scale(1) rotateX(0deg); opacity: 1; }
}

@keyframes tableSlide {
  0% { transform: translateX(-20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes priceGlow {
  0%, 100% { 
    box-shadow: 
      var(--shadow-compact),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% { 
    box-shadow: 
      var(--shadow-hover),
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      0 0 10px rgba(16, 185, 129, 0.3);
  }
}

@keyframes priceUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes inputPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.6); }
}

@keyframes buttonSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Responsive Design */
@media screen and (max-width: 480px) {
  .container {
    padding: 2px;
  }
  
  .input-container {
    padding: 4px;
    gap: 2px;
  }
  
  #symbolInput {
    font-size: 7px;
    padding: 3px 4px;
    min-width: 80px;
  }
  
  #digitsInput {
    width: 40px;
    font-size: 7px;
    padding: 3px;
  }
  
  .small-button,
  .medium-button {
    padding: 2px 4px;
    font-size: 6px;
  }
  
  #priceDisplay {
    font-size: 8px;
    padding: 4px 6px;
  }
  
  #lastDigitsList {
    font-size: 6px;
    padding: 4px 6px;
  }
  
  .chart-container canvas,
  #barChart, #differsFromChart, #lineChart {
    max-height: 100px;
  }
  
  th {
    font-size: 6px;
    padding: 3px;
  }
  
  td {
    font-size: 5px;
    padding: 2px 3px;
  }
}

@media screen and (max-width: 360px) {
  .container {
    padding: 1px;
  }
  
  .input-container {
    padding: 3px;
  }
  
  #symbolInput {
    font-size: 6px;
    min-width: 70px;
  }
  
  #digitsInput {
    width: 35px;
    font-size: 6px;
  }
  
  .small-button,
  .medium-button {
    padding: 2px 3px;
    font-size: 5px;
  }
  
  #lastDigitsList {
    font-size: 5px;
  }
}

#digitTable,
#percentageTable {
  display: none;
}

/* Hide barChart to make differsFromChart take full space */
#barChart {
  display: none;
}
/* ===== FLEXIBLE CHART LAYOUT (OVERRIDE) ===== */
.container {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  overflow: hidden !important;
}

/* All top sections keep their natural height */
.input-container,
#lastDigitsList,
#priceDisplay {
  flex-shrink: 0 !important;
}

/* Chart container takes the rest of the space */
.chart-container {
  flex: 1 1 0 !important;        /* grow/shrink, start from 0 */
  min-height: 0 !important;      /* essential for shrinking */
  display: flex !important;
  gap: 2px !important;
  margin: 1px 0 !important;
  height: auto !important;       /* override any fixed height */
}

/* Canvas fills its container */
#differsFromChart {
  width: 100% !important;
  height: 100% !important;       /* fill the flex container */
  max-height: none !important;   /* remove any max-height limits */
}

/* Hide barChart (as you already have) */
#barChart {
  display: none !important;
}

/* Override any conflicting media query rules */
@media screen and (max-width: 480px) {
  .chart-container canvas,
  #barChart,
  #differsFromChart,
  #lineChart {
    max-height: none !important;  /* remove the 100px limit */
  }
}