/**
 * Binary Simulator CSS
 * WordPress-compatible styling for the trading simulator
 */

/* Import Google Fonts - Enhanced for Cyrillic support */
@import url('https://fonts.googleapis.com/css2?family=Arvo:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700;800;900&display=swap');

/* CSS Variables for theming - Updated to match original */
:root {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-panel: #1c1d38;
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --card-border: #334155;
  
  /* Trading colors matching original */
  --green: #00c853;
  --red: #ff3d00;
  --yellow: #ffd600;
  --blue: #2962ff;
  --purple: #8b5cf6;
  
  /* Legacy color mappings for compatibility */
  --accent-green: var(--green);
  --accent-red: var(--red);
  --accent-blue: var(--blue);
  --accent-cyan: #06b6d4;
  
  --border-radius: 12px;
  
  /* Spacing tokens */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Additional color variants */
  --green-dark: #00a843;
  --red-dark: #e63500;
  --blue-dark: #1e4ed8;
  --yellow-dark: #e6c200;
  --purple-dark: #7c3aed;
}

/* WordPress compatibility - scope all styles to avoid conflicts */
.binary-simulator-page {
  font-family: 'Exo 2', 'Roboto Slab', 'Arvo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-weight: 600;
}

/* Reset WordPress default styles within simulator */
.binary-simulator-page * {
  box-sizing: border-box;
}

.binary-simulator-page h1,
.binary-simulator-page h2,
.binary-simulator-page h3,
.binary-simulator-page h4,
.binary-simulator-page h5,
.binary-simulator-page h6 {
  margin: 0;
  font-weight: 700;
}

.binary-simulator-page p {
  margin: 0;
}

.binary-simulator-page button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
}

.binary-simulator-page a {
  text-decoration: none;
  color: inherit;
}

/* Utility Classes */
.min-h-screen { min-height: 100vh; }
.max-w-7xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pb-2 { padding-bottom: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-shrink { flex-shrink: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* Grid utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

/* Text utilities */
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.font-bold { font-weight: 700; }
.text-left { text-align: left; }
.text-center { text-align: center; }

/* Color utilities */
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-green-400 { color: #4ade80; }
.text-red-400 { color: #f87171; }
.text-white { color: #ffffff; }

/* Background utilities */
.bg-green-600 { background-color: #16a34a; }
.bg-green-700 { background-color: #15803d; }
.bg-red-600 { background-color: #dc2626; }
.bg-red-700 { background-color: #b91c1c; }
.bg-blue-600 { background-color: #2563eb; }
.bg-blue-700 { background-color: #1d4ed8; }
.bg-blue-800 { background-color: #1e40af; }
.bg-orange-600 { background-color: #ea580c; }
.bg-orange-700 { background-color: #c2410c; }
.bg-purple-600 { background-color: #9333ea; }
.bg-purple-700 { background-color: #7c3aed; }
.bg-purple-800 { background-color: #6b21a8; }
.bg-green-800 { background-color: #166534; }
.bg-transparent { background-color: transparent; }

/* Phase 4 Advanced Feature Buttons */
#autoTradingBtn, #marketAnalysisBtn, #quickAutoTradeBtn {
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease-in-out;
}

#autoTradingBtn:hover, #marketAnalysisBtn:hover, #quickAutoTradeBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#autoTradingBtn:active, #marketAnalysisBtn:active, #quickAutoTradeBtn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Keyboard shortcut badges */
kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.25rem;
  padding: 0.125rem 0.25rem;
  margin-left: 0.25rem;
}

/* Border utilities */
.border-0 { border-width: 0; }
.border-2 { border-width: 2px; }
.border-b { border-bottom-width: 1px; }
.border-slate-700 { border-color: #334155; }
.border-cyan-900 { border-color: #164e63; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

/* Display utilities */
.block { display: block; }
.hidden { display: none; }

/* Overflow utilities */
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Height utilities */
.h-5 { height: 1.25rem; }
.h-12 { height: 3rem; }
.max-h-96 { max-height: 24rem; }

/* Width utilities */
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-12 { width: 3rem; }
.w-full { width: 100%; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.inset-x-0 { left: 0; right: 0; }
.top-0 { top: 0; }
.top-4 { top: 1rem; }
.right-4 { right: 1rem; }

/* Additional utility classes for timer */
.bg-slate-900\/90 { background-color: rgba(15, 23, 42, 0.9); }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.border-slate-600 { border-color: #475569; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-slate-500 { color: #64748b; }
.text-cyan-400 { color: #22d3ee; }
.mb-1 { margin-bottom: 0.25rem; }

/* Hover effects */
.hover\:bg-green-700:hover { background-color: #15803d; }
.hover\:bg-red-700:hover { background-color: #b91c1c; }
.hover\:bg-orange-700:hover { background-color: #c2410c; }
.hover\:border-white:hover { border-color: #ffffff; }

/* Transition utilities */
.transition { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

/* Shadow utilities */
.shadow-none { box-shadow: none; }

/* Divide utilities */
.divide-y > :not([hidden]) ~ :not([hidden]) { border-top-width: 1px; }
.divide-slate-700 > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }

/* Custom Classes */
.arvo-bold {
  font-family: 'Exo 2', 'Roboto Slab', 'Arvo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 800;
}

/* Enhanced font rendering for Russian/Cyrillic text */
.binary-simulator-page h1,
.binary-simulator-page h2,
.binary-simulator-page h3,
.binary-simulator-page .text-3xl,
.binary-simulator-page .font-bold,
.binary-simulator-page button,
.binary-simulator-page .btn {
  font-family: 'Exo 2', 'Roboto Slab', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Specific styling for button text to ensure thickness */
.binary-simulator-page button,
.binary-simulator-page .btn {
  font-weight: 800;
  text-rendering: optimizeLegibility;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.trading-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
}

.trading-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.1);
}

/* Button Styles - Matching original Pico CSS design */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

.btn-success {
  background: var(--green);
  color: white;
}

.btn-success:hover {
  background: #00a843;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 200, 83, 0.3);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover {
  background: #e63500;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 61, 0, 0.3);
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: #1e4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(41, 98, 255, 0.3);
}

/* Button States */
button[data-active="true"] {
  background-color: var(--accent-blue) !important;
  color: white !important;
  border-color: var(--accent-blue) !important;
}

/* Beautiful Balance Button */
#balance {
  background-color: var(--bg-body) !important;
  border: 2px solid #0891b2 !important;
  border-radius: 9999px !important;
  padding: 12px 20px !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
  box-shadow: 0 0 20px rgba(8, 145, 178, 0.3) !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

#balance:hover {
  box-shadow: 0 0 30px rgba(8, 145, 178, 0.5) !important;
  border-color: #06b6d4 !important;
  transform: translateY(-1px) !important;
}

#balance svg {
  width: 20px !important;
  height: 20px !important;
  color: #06b6d4 !important;
}

/* Trading Control Buttons - Original Design Match */
#buy, #sell {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#buy {
  background-color: #16a34a;
}

#buy:hover {
  background-color: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#sell {
  background-color: #dc2626;
}

#sell:hover {
  background-color: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#wager, #duration {
  background-color: #374151;
  color: white;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: none;
}

#wager:hover, #duration:hover {
  background-color: #4b5563;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#wager {
  min-width: 80px;
  font-size: 1.125rem;
}

#duration {
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

/* Trading Controls Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
}

/* Chart Canvas */
#chart {
  background-color: var(--bg-body);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

/* Beautiful Trade Messages with Effects */
#tradeMessage {
  text-align: center !important;
  width: 100%;
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  padding: 8px 16px;
  border-radius: 8px;
  margin: 8px auto;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  opacity: 1;
  backdrop-filter: blur(8px);
  border: 1px solid transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  animation: messageSlideIn 0.5s ease-out;
}

/* Trade Message Animation */
@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Success/Buy Trade Messages */
#tradeMessage.success,
#tradeMessage:contains("BUY"),
#tradeMessage[style*="green"] {
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.15), rgba(0, 168, 67, 0.25));
  border-color: rgba(0, 200, 83, 0.4);
  color: #00ff88 !important;
  box-shadow:
    0 0 20px rgba(0, 200, 83, 0.3),
    0 4px 15px rgba(0, 200, 83, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: messageSlideIn 0.5s ease-out, successPulse 2s ease-in-out infinite;
}

/* Error/Sell Trade Messages */
#tradeMessage.error,
#tradeMessage:contains("SELL"),
#tradeMessage[style*="red"] {
  background: linear-gradient(135deg, rgba(255, 61, 0, 0.15), rgba(230, 53, 0, 0.25));
  border-color: rgba(255, 61, 0, 0.4);
  color: #ff6b47 !important;
  box-shadow:
    0 0 20px rgba(255, 61, 0, 0.3),
    0 4px 15px rgba(255, 61, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: messageSlideIn 0.5s ease-out, errorPulse 2s ease-in-out infinite;
}

/* Auto-Trade Messages */
#tradeMessage:contains("AUTO"),
#tradeMessage[style*="AUTO"] {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.3));
  border-color: rgba(139, 92, 246, 0.6);
  color: #a78bfa !important;
  box-shadow:
    0 0 25px rgba(139, 92, 246, 0.4),
    0 4px 20px rgba(139, 92, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: messageSlideIn 0.5s ease-out, autoPulse 2s ease-in-out infinite;
  font-size: 1rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Win Messages */
#tradeMessage.win,
#tradeMessage:contains("WIN"),
#tradeMessage:contains("PROFIT") {
  background: linear-gradient(135deg, rgba(255, 214, 0, 0.15), rgba(255, 193, 7, 0.25));
  border-color: rgba(255, 214, 0, 0.5);
  color: #ffd700 !important;
  box-shadow:
    0 0 25px rgba(255, 214, 0, 0.4),
    0 4px 20px rgba(255, 214, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: messageSlideIn 0.5s ease-out, winCelebration 1.5s ease-in-out;
  font-size: 1.1rem;
  transform: scale(1.05);
}

/* Loss Messages */
#tradeMessage.loss,
#tradeMessage:contains("LOSS"),
#tradeMessage:contains("LOST") {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.25));
  border-color: rgba(239, 68, 68, 0.5);
  color: #ff4757 !important;
  box-shadow:
    0 0 20px rgba(239, 68, 68, 0.4),
    0 4px 15px rgba(239, 68, 68, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: messageSlideIn 0.5s ease-out, lossShake 0.6s ease-in-out;
}

/* Success Pulse Animation */
@keyframes successPulse {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(0, 200, 83, 0.3),
      0 4px 15px rgba(0, 200, 83, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow:
      0 0 30px rgba(0, 200, 83, 0.5),
      0 6px 20px rgba(0, 200, 83, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}

/* Error Pulse Animation */
@keyframes errorPulse {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(255, 61, 0, 0.3),
      0 4px 15px rgba(255, 61, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow:
      0 0 30px rgba(255, 61, 0, 0.5),
      0 6px 20px rgba(255, 61, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}

/* Win Celebration Animation */
@keyframes winCelebration {
  0% {
    transform: scale(1);
    box-shadow:
      0 0 25px rgba(255, 214, 0, 0.4),
      0 4px 20px rgba(255, 214, 0, 0.3);
  }
  25% {
    transform: scale(1.08);
    box-shadow:
      0 0 35px rgba(255, 214, 0, 0.6),
      0 6px 25px rgba(255, 214, 0, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow:
      0 0 40px rgba(255, 214, 0, 0.7),
      0 8px 30px rgba(255, 214, 0, 0.5);
  }
  75% {
    transform: scale(1.08);
    box-shadow:
      0 0 35px rgba(255, 214, 0, 0.6),
      0 6px 25px rgba(255, 214, 0, 0.4);
  }
  100% {
    transform: scale(1.05);
    box-shadow:
      0 0 25px rgba(255, 214, 0, 0.4),
      0 4px 20px rgba(255, 214, 0, 0.3);
  }
}

/* Loss Shake Animation */
@keyframes lossShake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-3px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(3px);
  }
}

/* Auto-Trade Pulse Animation */
@keyframes autoPulse {
  0%, 100% {
    box-shadow:
      0 0 25px rgba(139, 92, 246, 0.4),
      0 4px 20px rgba(139, 92, 246, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
  50% {
    box-shadow:
      0 0 35px rgba(139, 92, 246, 0.6),
      0 6px 25px rgba(139, 92, 246, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
}

/* Hover Effects for Trade Messages */
#tradeMessage:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.1);
}

/* Empty/Hidden State */
#tradeMessage:empty,
#tradeMessage.hidden {
  opacity: 0;
  transform: translateY(5px) scale(0.95);
  pointer-events: none;
}

/* Beautiful Trade Timer - Horizontal Layout */
#tradeTimer {
  background-color: var(--bg-body) !important;
  border: 2px solid #0891b2 !important;
  border-radius: 9999px !important;
  padding: 8px 12px !important;
  color: white !important;
  font-weight: 600 !important;
  box-shadow: 0 0 20px rgba(8, 145, 178, 0.3) !important;
  transition: all 0.3s ease !important;
  align-items: center !important;
  gap: 8px !important;
  animation: timerPulse 2s ease-in-out infinite;
}

/* Override default border for trade-specific styling */
#tradeTimer:not(.buy-trade):not(.sell-trade) {
  border-color: #0891b2 !important;
  box-shadow: 0 0 20px rgba(8, 145, 178, 0.3) !important;
}

/* Ensure timer shows when not hidden */
#tradeTimer:not(.hidden) {
  display: flex !important;
}

/* Ensure timer hides when hidden class is present */
#tradeTimer.hidden {
  display: none !important;
}

/* Default hover (fallback for when no trade type class is present) */
#tradeTimer:hover {
  box-shadow: 0 0 30px rgba(8, 145, 178, 0.5) !important;
  border-color: #06b6d4 !important;
  transform: translateY(-1px) !important;
}

/* BUY Trade Timer - Green Border (highest specificity) */
#tradeTimer#tradeTimer.buy-trade {
  border-color: #16a34a !important;
  box-shadow: 0 0 20px rgba(22, 163, 74, 0.3) !important;
}

#tradeTimer#tradeTimer.buy-trade:hover {
  box-shadow: 0 0 30px rgba(22, 163, 74, 0.5) !important;
  border-color: #15803d !important;
  transform: translateY(-1px) !important;
}

/* SELL Trade Timer - Yellow Border (highest specificity) */
#tradeTimer#tradeTimer.sell-trade {
  border-color: #ffd600 !important;
  box-shadow: 0 0 20px rgba(255, 214, 0, 0.3) !important;
}

#tradeTimer#tradeTimer.sell-trade:hover {
  box-shadow: 0 0 30px rgba(255, 214, 0, 0.5) !important;
  border-color: #e6c200 !important;
  transform: translateY(-1px) !important;
}

#tradeTimer.warning {
  border-color: #f59e0b !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3) !important;
  animation: timerPulse 1s ease-in-out infinite;
}

#tradeTimer.critical {
  border-color: #ef4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
  animation: timerCritical 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(8, 145, 178, 0.3) !important;
  }
  50% {
    box-shadow: 0 0 30px rgba(8, 145, 178, 0.5) !important;
  }
}

@keyframes timerCritical {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.8) !important;
  }
}

#timerDisplay {
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: #06b6d4 !important;
  min-width: 3rem;
  text-align: center;
}

#tradeType {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 2.5rem;
  text-align: center;
}

/* Active Trade label styling */
#tradeTimer span:first-child {
  font-size: 0.75rem !important;
  color: #64748b !important;
  font-weight: 500 !important;
}

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

th, td {
  padding: 0.75rem;
  text-align: left;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 2rem;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  z-index: 1000;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

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

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Form Elements in Modals */
.modal input[type="number"],
.modal input[type="text"],
.modal select {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.modal input:focus,
.modal select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal button {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.modal .btn-primary {
  background-color: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.modal .btn-primary:hover {
  background-color: #2563eb;
  border-color: #2563eb;
}

.modal .btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.modal .btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .max-w-7xl {
    max-width: 100%;
  }
  
  .p-4 {
    padding: 0.75rem;
  }
  
  .text-3xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  
  .grid-cols-1 {
    grid-template-columns: 1fr;
  }
  
  .flex-row {
    flex-direction: column;
    gap: 1rem;
  }
  
  .justify-between {
    justify-content: center;
  }
  
  footer {
    flex-wrap: nowrap; /* Prevent wrapping */
    justify-content: space-around; /* Distribute items evenly */
    gap: 0.5rem; /* Reduce gap between buttons */
  }
  
  footer button {
    min-width: unset; /* Unset min-width */
    padding: 0.5rem; /* Adjust padding for smaller screens */
    font-size: 0.75rem; /* Reduce font size */
  }
  
  #buy, #sell {
    width: 48px;
    height: 48px;
  }

  #wager {
    min-width: 60px;
    font-size: 1rem;
  }
  
  .modal-dialog {
    width: 95%;
    margin: 1rem;
    max-height: 90vh;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-footer button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .h-12 {
    height: 2rem;
  }
  
  .w-12 {
    width: 2rem;
  }
  
  .text-lg {
    font-size: 1rem;
  }
  
  .p-5 {
    padding: 1rem;
  }
  
  #chart {
    height: 350px !important; /* Increase chart height on mobile */
  }

  footer {
    gap: 0.25rem; /* Further reduce gap */
  }

  footer button {
    padding: 0.4rem;
    font-size: 0.65rem; /* Further reduce font size */
  }
  
  #buy, #sell {
    width: 40px;
    height: 40px;
  }

  #buy svg, #sell svg {
      width: 1.5rem;
      height: 1.5rem;
  }
  
  #wager {
    min-width: 50px;
    font-size: 0.9rem;
  }

  #duration {
      font-size: 0.7rem;
  }

  /* Target the top action button group */
  .trading-card .flex.justify-center.gap-4 {
    gap: 0.5rem; /* Reduce gap on small screens */
    flex-wrap: wrap; /* Allow buttons to wrap */
  }

  /* Target the buttons themselves */
  #autoTradingBtn, #marketAnalysisBtn, #quickAutoTradeBtn {
    padding: 0.5rem 0.75rem; /* Adjust padding */
    font-size: 0.75rem; /* Make font smaller */
    flex-shrink: 1; /* Allow buttons to shrink */
  }
  
  /* Hide keyboard shortcuts on smallest screens */
  #autoTradingBtn kbd, #marketAnalysisBtn kbd, #quickAutoTradeBtn kbd {
    display: none;
  }

  /* Target the chart header to allow wrapping */
  .trading-card > .flex.justify-between.items-center {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  /* Reduce size of timer and balance button */
  #tradeTimer, #balance {
    padding: 6px 10px !important;
  }

  #balance {
      font-size: 0.9rem !important;
  }
  
  #balance svg {
    width: 1.15rem !important;
    height: 1.15rem !important;
  }

  #timerDisplay {
    font-size: 0.9rem !important;
  }

  #tradeTimer span:not(#timerDisplay) {
      font-size: 0.7rem !important;
  }
}

/* WordPress Theme Compatibility */
.binary-simulator-page .wp-block-group,
.binary-simulator-page .wp-block-columns,
.binary-simulator-page .entry-content {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Ensure proper z-index stacking */
.binary-simulator-page {
  position: relative;
  z-index: 1;
}

/* Performance optimizations */
.trading-card,
.modal-dialog {
  will-change: transform;
}

/* Print styles */
@media print {
  .binary-simulator-page {
    background: white !important;
    color: black !important;
  }
  
  .trading-card {
    border: 1px solid #ccc !important;
    background: white !important;
  }
  
  button {
    display: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --bg-body: #000000;
    --bg-card: #1a1a1a;
    --text-primary: #ffffff;
    --border-color: #666666;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .transition,
  .trading-card {
    transition: none;
  }
  
  .modal-dialog {
    transform: none;
    top: 10%;
    left: 5%;
  }
}

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

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}