/* CSS Variables for Design System */
:root {
  /* Light Theme Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-accent: #2d3748;
  
  --border-color: #e2e8f0;
  --border-focus: #3182ce;
  --border-error: #e53e3e;
  
  --accent-primary: #3182ce;
  --accent-primary-rgb: 49, 130, 206;
  --accent-secondary: #2c5aa0;
  --accent-hover: #2a69ac;
  
  --success: #38a169;
  --success-bg: #f0fff4;
  --error: #e53e3e;
  --error-bg: #fed7d7;
  --warning: #d69e2e;
  --warning-bg: #fefcbf;
  
  --profit-color: #38a169;
  --loss-color: #e53e3e;
  --breakeven-color: #d69e2e;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  --font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Colors */
[data-theme="dark"] {
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --bg-tertiary: #4a5568;
  --bg-card: #2d3748;
  --bg-input: #4a5568;
  
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #a0aec0;
  --text-accent: #cbd5e0;
  
  --border-color: #4a5568;
  --border-focus: #63b3ed;
  --border-error: #fc8181;
  
  --accent-primary: #63b3ed;
  --accent-primary-rgb: 99, 179, 237;
  --accent-secondary: #4299e1;
  --accent-hover: #3182ce;
  
  --success: #68d391;
  --success-bg: #22543d;
  --error: #fc8181;
  --error-bg: #742a2a;
  --warning: #fbd38d;
  --warning-bg: #744210;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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

/* Ensure all elements respect container width */
*, *::before, *::after {
  max-width: 100%;
}

/* Special exceptions for elements that need to overflow for functionality */
.magic-values-dropdown,
.user-dropdown,
.auth-modal-overlay,
.loading-overlay,
.table-container {
  max-width: none;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
  direction: rtl;
  text-align: right;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  width: 100%;
  max-width: 100vw;
}

/* Prevent scrolling when modal is open */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

/* Utility text colors */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* Layout */
.app-container {
  min-height: 100vh;
  /* background: linear-gradient(90deg, var(--bg-primary) 0%, var(--bg-secondary) 100%); */
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Footer */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: auto; /* Push footer to bottom when content is short */
}

.disclaimer {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.disclaimer-text {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
}

/* Footer Links */
.footer-links {
  border-top: 1px solid var(--border-color);
  padding-top: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--font-size-sm);
  margin: 0 var(--spacing-md);
  transition: var(--transition);
  position: relative;
}

.footer-link:hover {
  color: var(--accent-primary);
  text-decoration: none;
  transform: translateY(-1px);
}

.footer-link:hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-primary);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    width: 0;
    left: 50%;
  }
  to {
    width: 100%;
    left: 0;
  }
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 80px var(--spacing-md) 0 var(--spacing-md); /* Add top padding for fixed header */
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.app-header {
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

/* Transparent header when at top */
.app-header.transparent {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
}

/* Dark theme translucent header */
[data-theme="dark"] .app-header {
  background: rgba(45, 55, 72, 0.60);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 
    0 1px 3px 0 rgba(0, 0, 0, 0.3),
    0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Dark theme transparent header when at top */
[data-theme="dark"] .app-header.transparent {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
}

.header-content {
  /* max-width: 1200px; */
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-lg);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

/* Desktop header grid layout for perfect centering */
@media (min-width: 769px) {
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    min-height: 80px;
    gap: var(--spacing-lg);
  }

  /* Logo and navigation grouped together on the left */
  .brand-nav-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    flex: 0 0 auto;
  }

  .brand {
    margin: 0;
    flex-shrink: 0;
  }

  .main-nav {
    flex-shrink: 0;
  }

  /* Header actions on the right */
  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 0 0 auto;
  }
}

.brand {
  color: var(--accent-primary);
  font-weight: 700;
  margin: 0;
}


.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.theme-icon {
  font-size: 1.2rem;
  transition: var(--transition);
}

/* Strategy actions inline in builder header */
.strategy-actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-end: var(--spacing-md);
  direction: ltr; /* Changed from rtl to ltr for proper left positioning */
  justify-content: flex-start; /* Ensure left alignment */
  position: relative; /* Required for absolute positioned dropdown */
}

.icon-btn {
  background: var(--accent-primary);
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 2px 8px 0 rgba(49,130,206,0.08);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
  margin: 0 2px;
  min-width: 40px;
  min-height: 40px;
}
.icon-btn:hover, .icon-btn:focus {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 4px 12px 0 rgba(49,130,206,0.13);
  transform: translateY(-2px) scale(1.04);
}
.icon-btn svg {
  display: block;
  width: 1.3em;
  height: 1.3em;
  pointer-events: none;
  fill: currentColor;
}

.strategy-actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-end: var(--spacing-md);
  direction: rtl;
}

.icon-btn {
  background: var(--accent-primary);
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 2px 8px 0 rgba(49,130,206,0.08);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
  margin: 0 2px;
  min-width: 40px;
  min-height: 40px;
}
.icon-btn:hover, .icon-btn:focus {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 4px 12px 0 rgba(49,130,206,0.13);
  transform: translateY(-2px) scale(1.04);
}
.icon-btn svg {
  display: block;
  width: 1.3em;
  height: 1.3em;
  pointer-events: none;
  fill: currentColor;
}

.strategy-actions-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-end: var(--spacing-md);
  direction: rtl;
}

.icon-btn {
  background: var(--accent-primary);
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 2px 8px 0 rgba(49,130,206,0.08);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
  margin: 0 2px;
  min-width: 40px;
  min-height: 40px;
}
.icon-btn:hover, .icon-btn:focus {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 4px 12px 0 rgba(49,130,206,0.13);
  transform: translateY(-2px) scale(1.04);
}
.icon-btn svg {
  display: block;
  width: 1.3em;
  height: 1.3em;
  pointer-events: none;
  fill: currentColor;
}

.animated-field {
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s, transform 0.25s;
  margin-inline-end: 4px;
}
.animated-field.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.strategy-actions-inline .strategy-input,
.strategy-actions-inline .strategy-select {
  min-width: 120px;
  min-height: 40px;
  font-size: var(--font-size-sm);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.strategy-actions-inline .strategy-input:focus,
.strategy-actions-inline .strategy-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.strategy-actions-inline .strategy-input:hover,
.strategy-actions-inline .strategy-select:hover {
  border-color: var(--accent-primary);
}

#saveStrategyBtn {
  font-size: 1.2em;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  margin-inline-end: 4px;
  border: 2px solid rgba(16, 185, 129, 0.3);
  box-shadow: 
    0 4px 12px rgba(16, 185, 129, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Save strategy button animation when showing */
#saveStrategyBtn.show-animation {
  animation: saveButtonSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#saveStrategyBtn.show-animation svg {
  animation: checkmarkAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

@keyframes checkmarkAppear {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-45deg);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes saveButtonSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-20px) scale(0.8);
  }
  50% {
    opacity: 0.8;
    transform: translateX(5px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

#saveStrategyBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.2) 50%, 
    transparent 100%);
  transition: left 0.5s ease;
}

#saveStrategyBtn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 
    0 6px 20px rgba(16, 185, 129, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 3px rgba(16, 185, 129, 0.1);
  transform: translateY(-1px) scale(1.02);
}

#saveStrategyBtn:hover svg {
  transform: scale(1.1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

#saveStrategyBtn svg {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 20px;
  height: 20px;
  display: block;
}

#saveStrategyBtn:hover::before {
  left: 100%;
}

#saveStrategyBtn:hover svg {
  transform: scale(1.1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

#saveStrategyBtn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 
    0 2px 8px rgba(16, 185, 129, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#saveStrategyBtn:active svg {
  transform: scale(0.9);
}

#saveStrategyBtn:focus {
  outline: none;
  box-shadow: 
    0 6px 20px rgba(16, 185, 129, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 4px rgba(16, 185, 129, 0.15);
}

[dir="rtl"] .icon-btn {
  margin-left: 0;
  margin-right: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* User Menu Styles - Dynamic width based on content */
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative; /* Anchor dropdown to menu */
  max-width: 100%;
  min-width: 44px; /* Minimum width for avatar only */
}

.user-menu:hover {
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-sm);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0; /* Allow text truncation */
  flex: 1;
}

.user-text {
  display: flex;
  flex-direction: column;
  min-width: 0; /* Allow text truncation */
  flex: 1;
  transition: var(--transition);
}

.user-name {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.user-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.user-btn {
  width: 28px;
  height: 32px;
  border: none;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.user-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* User Avatar Cursor */
.user-avatar {
  cursor: pointer;
  position: relative;
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* User Dropdown Menu */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 280px;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
}

.user-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--border-color);
}

.user-dropdown::after {
  content: '';
  position: absolute;
  top: -7px;
  left: 21px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid var(--bg-card);
}

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

.user-dropdown-content {
  padding: 0;
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border-color);
}

.user-dropdown-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: var(--font-size-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.user-dropdown-info {
  flex: 1;
  min-width: 0;
}

.user-dropdown-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-email {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.user-dropdown-menu {
  padding: var(--spacing-sm) 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: right;
  direction: rtl;
  border-radius: var(--radius-md);
  margin: 0 var(--spacing-sm);
  width: calc(100% - var(--spacing-md));
}

.user-dropdown-item:hover {
  background: var(--bg-secondary);
  color: var(--accent-primary);
}

.user-dropdown-item.logout-item:hover {
  background: var(--error-bg);
  color: var(--error);
}

.dropdown-icon {
  font-size: var(--font-size-base);
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive adjustments for dropdown */
@media (max-width: 768px) {
  .user-dropdown {
    min-width: 260px;
    left: 0;
    right: auto;
    transform: none;
  }

  .user-dropdown::before {
    left: 24px;
    right: auto;
    transform: none;
  }

  .user-dropdown::after {
    left: 25px;
    right: auto;
    transform: none;
  }
}

/* Login Button */
.login-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.login-btn:hover {
  background: var(--accent-hover);
}

/* Authentication Required Section */
.auth-required {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.auth-required-content {
  max-width: 400px;
  padding: var(--spacing-xl);
}

.auth-icon {
  font-size: 64px;
  margin-bottom: var(--spacing-lg);
}

.auth-required h2 {
  font-size: var(--font-size-2xl);
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
}

.auth-required p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
  line-height: 1.6;
}

.auth-cta-btn {
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.auth-cta-btn:hover {
  background: var(--accent-hover);
}

/* Authentication Modal */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.auth-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

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

.auth-modal-header h2 {
  font-size: var(--font-size-xl);
  color: var(--text-primary);
  margin: 0;
}

.auth-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

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

/* Authentication Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.auth-tab {
  flex: 1;
  padding: var(--spacing-md);
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  border-bottom: 2px solid transparent;
}

.auth-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.auth-tab:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* Authentication Forms */
.auth-form {
  padding: var(--spacing-lg);
}

.auth-form .input-group {
  margin-bottom: var(--spacing-md);
}

.auth-form label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.auth-form input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: var(--transition);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.auth-submit-btn {
  width: 100%;
  padding: var(--spacing-md);
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: var(--spacing-sm);
}

.auth-submit-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Authentication Links */
.auth-links {
  margin-top: var(--spacing-md);
  text-align: center;
}

.auth-links a {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.auth-links a:hover {
  text-decoration: underline;
}

.terms-text {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.terms-text a {
  color: var(--accent-primary);
}

/* Authentication Messages */
.auth-message {
  margin: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  text-align: center;
}

.auth-message.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.auth-message.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}

.auth-message.info {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

/* Authentication Loading */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* Responsive Design for Auth */
@media (max-width: 768px) {
  .auth-modal {
    width: 95%;
    margin: var(--spacing-md);
  }
  
  .header-content {
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  .user-menu {
    gap: var(--spacing-sm);
  }
  
  .auth-tabs {
    flex-direction: column;
  }
  
  .auth-tab {
    text-align: center;
  }
}

/* User menu dynamic sizing - fallback for JavaScript */
@media (max-width: 480px) {
  .header-content {
    gap: var(--spacing-sm);
  }
  
  /* Fallback: Force avatar-only mode on very small screens if JS hasn't run */
  .user-menu:not(.avatar-only):not([style*="maxWidth"]) {
    max-width: 44px;
    padding: var(--spacing-xs);
    border-radius: 100%;
    margin-top: 8px;
    margin-bottom: 8px;
  }
  
  .user-menu:not(.avatar-only):not([style*="maxWidth"]) .user-text {
    display: none;
  }
  
  .user-menu:not(.avatar-only):not([style*="maxWidth"]) .user-info {
    gap: 0;
  }
}

/* Container query-like behavior using CSS - for mid-range screens */
@media (max-width: 600px) and (min-width: 481px) {
  .user-menu:not([style*="maxWidth"]) {
    max-width: min(200px, calc(100vw - 200px)); /* Dynamic width based on viewport */
  }
  
  .user-name:not([style*="maxWidth"]),
  .user-email:not([style*="maxWidth"]) {
    max-width: min(150px, calc(100vw - 250px));
  }
}

/* Strategy section header responsive layout */
.strategy-section .section-header {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.strategy-section .section-header h2 {
  margin: 0;
}

/* Strategy actions layout - inline by default */
.responsive-strategy-actions {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  align-self: flex-start;
}

.responsive-strategy-actions .strategy-actions-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

.responsive-strategy-actions .strategy-actions-fields {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Large screens - actions inline with title */
@media (min-width: 400px) {
  .strategy-section .section-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .responsive-strategy-actions {
    margin-top: 0;
  }
}

/* Medium and small screens - actions below title */
@media (max-width: 600px) {
  .strategy-section .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .responsive-strategy-actions {
    align-self: stretch;
    justify-content: flex-start;
  }
}

/* Very small screens - stack everything vertically */
@media (max-width: 400px) {
  .responsive-strategy-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .responsive-strategy-actions .strategy-actions-btns,
  .responsive-strategy-actions .strategy-actions-fields {
    width: 100%;
    justify-content: flex-start;
  }
  .responsive-strategy-actions .strategy-actions-fields {
    margin-top: 0;
  }
}

/* Fix for strategy actions button positioning - Override to ensure left alignment in RTL */
.strategy-actions-inline.responsive-strategy-actions {
  direction: ltr !important; /* Override RTL direction for proper button positioning */
  justify-content: flex-start !important; /* Force left alignment */
}

.responsive-strategy-actions .strategy-actions-btns {
  order: 1 !important; /* Ensure buttons come first */
}

.responsive-strategy-actions .strategy-actions-fields {
  order: 2 !important; /* Fields come after buttons */
}

/* Modern look enhancements */
.auth-modal {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  padding: var(--spacing-lg);
}

.auth-form input {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.auth-form input:focus {
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.3);
}

.auth-submit-btn,
.login-btn {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.auth-submit-btn:hover:not(:disabled),
.login-btn:hover {
  transform: translateY(-2px);
}

.user-menu {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.user-text {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  flex-shrink: 0; /* Prevent avatar from shrinking */
}

.user-avatar:hover {
  box-shadow: var(--shadow-md);
}

/* Avatar-only mode styles */
.user-menu.avatar-only {
  width: 44px;
  height: 44px;
  padding: var(--spacing-xs);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  justify-content: center;
  align-items: center;
}

.user-menu.avatar-only .user-text {
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease-out;
  display: none;
}

.user-menu.avatar-only .user-info {
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.user-menu.avatar-only:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.user-menu.avatar-only:hover .user-avatar {
  background: white;
  color: var(--accent-primary);
}

/* Smooth transitions for responsive changes */
.user-menu {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-text {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tooltip for avatar-only mode */
.user-menu.avatar-only::after {
  content: attr(data-user-name);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-out;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  z-index: 1000;
  pointer-events: none;
}

.user-menu.avatar-only:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

.user-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.user-btn:hover {
  transform: translateY(-2px);
}


/* Strategy section - dynamic height */
.strategy-section {
  flex: 0 0 auto;
  max-height: none; /* Remove height constraint for dynamic sizing */
  overflow: visible; /* Allow content to determine size */
  /* margin-top: var(--spacing-sm); */
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.strategy-section:hover {
  box-shadow: var(--shadow-md);
}

.strategy-section .table-container {
  /* flex: none; */
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
  max-height: 50vh; /* If table gets too big, it will scroll instead of expanding further */
}

/* Sections - general styles */
section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  /* margin-bottom: var(--spacing-sm); Reduced from --spacing-md for better fit */
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

section:hover {
  box-shadow: var(--shadow-md);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--spacing-md); /* Reduced from --spacing-lg */
}

.section-header h2 {
  margin: 0;
  color: var(--text-primary);
}

/* Market Inputs */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-sm); /* Reduced from --spacing-md */
  margin-bottom: var(--spacing-sm); /* Reduced from --spacing-md */
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.input-group label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  transition: var(--transition);
  appearance: none; /* Remove default arrow */
}

/* Modern dropdown arrow for select */
.input-wrapper select {
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23a0aec0" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 12px;
  padding-left: 40px;
  cursor: pointer;
}

[data-theme="dark"] .input-wrapper select {
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23e2e8f0" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
}

.input-wrapper input:focus,
.input-wrapper select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.currency,
.percentage {
  position: absolute;
  left: var(--spacing-md);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  pointer-events: none;
}

.api-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.market-inputs .api-status {
  padding: 0;
  background: transparent;
  border: none;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
.status-indicator.text-warning::before {
  background: var(--warning);
}

.status-indicator.live-indicator::before {
  background: #22c55e;
  animation: live-pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes live-pulse {
  0% { 
    opacity: 1; 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  50% { 
    opacity: 0.8;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
  }
  100% { 
    opacity: 1; 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Buttons */
.add-leg-btn,
.chart-btn,
.empty-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.add-leg-btn {
  min-width: 120px;
  max-width: 120px;
  min-height: 40px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

@media (max-width: 500px) {
  .add-leg-btn {
    min-width: 90px;
    max-width: 100px;
    font-size: 0.95em;
    padding-left: 0.5em;
    padding-right: 0.5em;
  }
}

.add-leg-btn:hover,
.chart-btn:hover,
.empty-add-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-icon {
  font-size: var(--font-size-base);
  font-weight: bold;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  cursor: pointer;
}

.refresh-btn .btn-icon {
  font-size: var(--font-size-2xl);
}

.refresh-btn:hover .btn-icon {
  transform: rotate(90deg);
}

.chart-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xs);
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 100%;
}

.legs-table {
  width: 100%;
  min-width: 800px; /* Ensure table has minimum width but can scroll horizontally if needed */
  border-collapse: collapse;
  background: var(--bg-card);
}

.legs-table th,
.legs-table td {
  padding: var(--spacing-md);
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

.legs-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leg-input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-sm);
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  min-width: 80px;
}

.leg-input:focus {
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  outline: none;
}

.leg-select {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-sm);
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.action-buy {
  background: var(--success-bg);
  color: var(--success);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  transition: var(--transition);
}

.action-sell {
  background: var(--error-bg);
  color: var(--error);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  transition: var(--transition);
}

.action-clickable {
  cursor: pointer;
  user-select: none;
}

.action-clickable:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.remove-leg-btn {
  background: var(--error);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--spacing-xs);
  cursor: pointer;
  font-size: var(--font-size-xs);
  transition: var(--transition);
}

.remove-leg-btn:hover {
  background: #c53030;
  transform: scale(1.1);
}

/* Modern close button for legs */
.close-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Visibility toggle button */
.visibility-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.visibility-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Dark mode styling for visibility button images */
[data-theme="dark"] .visibility-btn img {
  filter: invert(1) brightness(1);
}

/* Actions column */
.leg-actions {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
  justify-content: center;
}

/* Sortable row styles */
.legs-table tr {
  cursor: grab;
  transition: var(--transition);
}

.legs-table tr:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legs-table tr:active {
  cursor: grabbing;
}

/* Sortable states */
.sortable-ghost {
  opacity: 0.4;
  background: var(--bg-tertiary) !important;
}

.sortable-chosen {
  cursor: grabbing !important;
}

.sortable-drag {
  transform: rotate(2deg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

/* Prevent dragging on interactive elements */
.legs-table tr input,
.legs-table tr select,
.legs-table tr button {
  cursor: auto;
}

/* Hidden leg row */
.hidden-leg {
  opacity: 0.5;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-lg);
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
}

.empty-state p {
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-lg);
}

/* Summary */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-sm); /* Reduced from --spacing-md */
  margin-bottom: var(--spacing-md); /* Reduced from --spacing-lg */
}

.summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  text-align: center;
  transition: var(--transition);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
}

.summary-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.summary-value.positive {
  color: var(--success);
}

.summary-value.negative {
  color: var(--error);
}

.breakeven-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md); /* Reduced from --spacing-xl */
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  min-height: 80px; /* Reduced from 120px */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.breakeven-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    var(--warning) 0%, 
    var(--accent-primary) 50%, 
    var(--warning) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.breakeven-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(255, 193, 7, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 80% 80%, rgba(49, 130, 206, 0.03) 1px, transparent 1px);
  background-size: 30px 30px, 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.breakeven-section h4 {
  margin-bottom: var(--spacing-md); /* Reduced from --spacing-lg */
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--font-size-base); /* Reduced from --font-size-lg for better fit */
  text-align: center;
  position: relative;
  z-index: 1;
}

.breakeven-section h4::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--warning);
  border-radius: 1px;
}

.breakeven-list {
  list-style: none;
  display: flex;
  gap: var(--spacing-sm); /* Reduced from --spacing-md */
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  min-height: 40px; /* Reduced from 60px */
  position: relative;
  z-index: 1;
}

.breakeven-point {
  background: linear-gradient(135deg, var(--warning-bg) 0%, rgba(255, 193, 7, 0.1) 100%);
  color: var(--warning);
  padding: var(--spacing-sm) var(--spacing-md); /* Reduced padding for better fit */
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 15px; /* Reduced from --font-size-base */
  border: 2px solid var(--warning);
  box-shadow: 
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-width: 100px; /* Reduced from 120px */
  text-align: center;
}

.breakeven-point::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.2) 50%, 
    transparent 100%);
  transition: left 0.5s ease;
}

.breakeven-point:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 
    0 8px 25px rgba(255, 193, 7, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: var(--accent-primary);
}

.breakeven-point:hover::before {
  left: 100%;
}

.no-breakeven {
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--font-size-base);
  font-weight: 500;
  text-align: center;
  padding: var(--spacing-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-color);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.no-breakeven::before {
  content: '⚖️';
  font-size: var(--font-size-lg);
  opacity: 0.6;
}

/* Animation for breakeven points */
.animate-in {
  animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.breakeven-value {
  position: relative;
}

/* Pulse effect for breakeven point values */
.breakeven-point:hover .breakeven-value::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 193, 7, 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  border-radius: inherit;
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }
}

/* Responsive breakeven section */
@media (max-width: 768px) {
  .breakeven-section {
    padding: var(--spacing-lg);
    min-height: 100px;
  }
  
  .breakeven-section h4 {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-md);
  }
  
  .breakeven-point {
    min-width: 100px;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
  }
  
  .breakeven-list {
    gap: var(--spacing-sm);
  }
  
  .no-breakeven {
    padding: var(--spacing-md);
    font-size: var(--font-size-sm);
  }
}

@media (max-width: 480px) {
  .breakeven-list {
    flex-direction: column;
    align-items: stretch;
  }
  
  .breakeven-point {
    min-width: auto;
    width: 100%;
  }
}

/* Chart */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.chart-controls {
  display: flex;
  gap: var(--spacing-sm);
}

.chart-container {
  position: relative;
  height: 400px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Responsive chart sizing for better mobile experience */
@media (max-width: 768px) {
  .chart-container {
    height: 500px;
    padding: var(--spacing-sm);
  }
}

/* Main content chart section */
.main-content .chart-section {
  flex: 3;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: 50vw;;
}

.main-content .chart-container {
  flex: 1;
  min-height: 300px;
  height: 100%;
  width: 100%;
  max-width: 100%;
}

.main-content .chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--spacing-md);
}

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

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-overlay.active {
  display: flex;
}

.loading-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--border-color);
  border-top: 6px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--spacing-lg);
}

/* Smart Strike Price Input Styles - Modern Blueprint Design */
.smart-strike-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 160px;
}

.smart-strike-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-lg);
  padding-right: 40px;
  padding-left: 28px; /* Make room for arrow buttons */
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: 'Heebo', monospace;
  font-size: var(--font-size-base);
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  text-align: center;
  letter-spacing: 0.5px;
}

.smart-strike-input:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.15);
}

.smart-strike-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.1), 0 4px 12px rgba(49, 130, 206, 0.15);
  transform: translateY(-1px);
}

/* Strike Price Arrow Buttons */
.strike-arrows {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 1;
}

.strike-arrow-btn {
  width: 16px;
  height: 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  user-select: none;
}

.strike-arrow-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.1);
}

.strike-arrow-btn:active {
  transform: scale(0.95);
}

.smart-strike-wrapper:hover .strike-arrows {
  opacity: 1;
}

.strike-arrows {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

/* Magic Expression Styling - Removed special styling to make it look regular */

.smart-strike-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--font-size-sm);
  font-weight: 400;
}

.smart-indicator {
  display: none; /* Hide the magic indicator completely */
}

@keyframes smart-glow {
  0%, 100% { 
    opacity: 0.7; 
    transform: scale(1);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
  }
}

/* Dropdown Arrow for Strike Input */
.smart-strike-input:not(.smart-strike)::after {
  content: '▼';
  position: absolute;
  right: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  pointer-events: none;
}

/* Dark theme adjustments */
[data-theme="dark"] .smart-strike-input {
  background: var(--bg-input);
  border-color: var(--border-color);
}

/* Dark theme - removed special styling for smart strikes */

/* Tooltip enhancement for smart strikes */
.smart-strike-input[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm);
  font-size: var(--font-size-xs);
  white-space: pre-line;
  max-width: 250px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  pointer-events: none;
}

/* Magic Values Dropdown Styles - Blueprint Design */
.magic-values-dropdown {
  background: linear-gradient(145deg, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(248, 250, 252, 0.98) 100%);
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(59, 130, 246, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  max-height: 420px;
  overflow: hidden;
  font-family: var(--font-family);
  direction: rtl;
  text-align: right;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
}

.magic-values-dropdown::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(59, 130, 246, 0.6) 20%, 
    rgba(16, 185, 129, 0.6) 50%, 
    rgba(59, 130, 246, 0.6) 80%, 
    transparent 100%);
  border-radius: 16px 16px 0 0;
}

.magic-dropdown-content {
  padding: 0;
  overflow-y: auto;
  max-height: 420px;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.magic-dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.magic-dropdown-content::-webkit-scrollbar-track {
  background: transparent;
}

.magic-dropdown-content::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 3px;
}

.magic-dropdown-content::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

.magic-dropdown-header {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.25) 0%, 
    rgba(248, 250, 252, 0.15) 50%,
    rgba(59, 130, 246, 0.1) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  position: sticky;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.05);
  top: 0;
  z-index: 1;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.magic-dropdown-option {
  padding: 16px 20px;
  margin: 0 8px 8px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(59, 130, 246, 0.08);
  position: relative;
  overflow: hidden;
}

.magic-dropdown-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(59, 130, 246, 0.1) 50%, 
    transparent 100%);
  transition: left 0.5s ease;
}

.magic-dropdown-option:hover {
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.12) 0%, 
    rgba(16, 185, 129, 0.08) 100%);
  border-color: rgba(59, 130, 246, 0.25);
  transform: translateY(-1px);
  box-shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(59, 130, 246, 0.1);
}

.magic-dropdown-option:hover::before {
  left: 100%;
}

.magic-dropdown-option:active {
  transform: translateY(0);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
          0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.magic-dropdown-option:first-of-type {
  margin-top: 16px;
}

.magic-dropdown-option:last-of-type {
  margin-bottom: 8px;
}

.magic-option-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.magic-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.magic-value {
  font-weight: 700;
  color: #3b82f6;
  font-size: 15px;
  background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.magic-description {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
  font-weight: 500;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.03);
}

.magic-expression {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: #6b7280;
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.05) 0%, 
    rgba(16, 185, 129, 0.05) 100%);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.15);
  position: relative;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.magic-expression::before {
  content: '⚡';
  font-size: 10px;
  margin-left: 6px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.magic-dropdown-option:hover .magic-expression::before {
  opacity: 1;
}

.magic-custom-section {
  border-top: 2px solid rgba(59, 130, 246, 0.15);
  background: linear-gradient(135deg, 
    rgba(99, 102, 241, 0.03) 0%, 
    rgba(59, 130, 246, 0.05) 100%);
  margin: 8px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.magic-custom-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(99, 102, 241, 0.3) 50%, 
    transparent 100%);
}

.magic-custom-section .magic-dropdown-header {
  background: linear-gradient(135deg, 
    rgba(99, 102, 241, 0.08) 0%, 
    rgba(59, 130, 246, 0.06) 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.12);
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #4f46e5;
}

.magic-custom-input {
  width: calc(100% - 32px);
  margin: 16px;
  padding: 14px 16px;
  border: 2px solid rgba(59, 130, 246, 0.15);
  border-radius: 10px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.9) 0%, 
    rgba(248, 250, 252, 0.95) 100%);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 14px;
  font-weight: 500;
  direction: ltr;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.5px;
}

.magic-custom-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.98) 0%, 
    rgba(239, 246, 255, 0.95) 100%);
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.1),
    0 10px 15px -3px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.magic-custom-input::placeholder {
  color: #9ca3af;
  font-style: italic;
  font-weight: 400;
}

/* Dark theme adjustments for magic dropdown */
[data-theme="dark"] .magic-values-dropdown {
  background: linear-gradient(145deg, 
    rgba(30, 41, 59, 0.95) 0%, 
    rgba(15, 23, 42, 0.98) 100%);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.4),
    0 10px 10px -5px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(59, 130, 246, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .magic-values-dropdown::after {
  background: linear-gradient(45deg, 
    rgba(59, 130, 246, 0.2) 0%,
    rgba(16, 185, 129, 0.2) 25%,
    rgba(168, 85, 247, 0.2) 50%,
    rgba(239, 68, 68, 0.2) 75%,
    rgba(59, 130, 246, 0.2) 100%);
}

[data-theme="dark"] .magic-dropdown-header {
  background: linear-gradient(135deg, 
    rgba(30, 41, 59, 0.4) 0%, 
    rgba(15, 23, 42, 0.3) 50%,
    rgba(59, 130, 246, 0.15) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.2);
  border-bottom-color: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .magic-dropdown-option {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .magic-dropdown-option:hover {
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.2) 0%, 
    rgba(16, 185, 129, 0.15) 100%);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.3),
    0 4px 6px -2px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .magic-expression {
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.1) 0%, 
    rgba(16, 185, 129, 0.08) 100%);
  border-color: rgba(59, 130, 246, 0.25);
  color: #94a3b8;
}

[data-theme="dark"] .magic-custom-section {
  background: linear-gradient(135deg, 
    rgba(99, 102, 241, 0.08) 0%, 
    rgba(59, 130, 246, 0.1) 100%);
  border-top-color: rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .magic-custom-section .magic-dropdown-header {
  background: linear-gradient(135deg, 
    rgba(99, 102, 241, 0.15) 0%, 
    rgba(59, 130, 246, 0.12) 100%);
  border-bottom-color: rgba(59, 130, 246, 0.2);
  color: #a78bfa;
}

[data-theme="dark"] .magic-custom-input {
  background: linear-gradient(135deg, 
    rgba(30, 41, 59, 0.9) 0%, 
    rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(59, 130, 246, 0.25);
  color: #e2e8f0;
}

[data-theme="dark"] .magic-custom-input:focus {
  background: linear-gradient(135deg, 
    rgba(30, 41, 59, 0.98) 0%, 
    rgba(30, 58, 138, 0.1) 100%);
  border-color: #3b82f6;
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.2),
    0 10px 15px -3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .magic-custom-input::placeholder {
  color: #64748b;
}

/* Additional visual enhancements for magic dropdown */
.magic-values-dropdown::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    rgba(59, 130, 246, 0.1) 0%,
    rgba(16, 185, 129, 0.1) 25%,
    rgba(168, 85, 247, 0.1) 50%,
    rgba(239, 68, 68, 0.1) 75%,
    rgba(59, 130, 246, 0.1) 100%);
  background-size: 400% 400%;
  animation: borderGlow 8s ease-in-out infinite;
  border-radius: 18px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.magic-values-dropdown:hover::after {
  opacity: 1;
}

@keyframes borderGlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Micro-interactions for option selection */
.magic-dropdown-option {
  will-change: transform, box-shadow;
}

.magic-dropdown-option:active {
  transform: translateY(1px) scale(0.98);
  transition: transform 0.1s ease;
}

/* Enhanced scrollbar for better UX */
.magic-dropdown-content::-webkit-scrollbar-corner {
  background: transparent;
}

/* Focus ring for accessibility */
.magic-dropdown-option:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: -2px;
}

/* Improved custom input styling */
.magic-custom-input {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.magic-custom-input:focus {
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.1),
    0 10px 15px -3px rgba(59, 130, 246, 0.1),
    inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Dark theme enhancements */
[data-theme="dark"] .magic-values-dropdown::after {
  background: linear-gradient(45deg, 
    rgba(59, 130, 246, 0.2) 0%,
    rgba(16, 185, 129, 0.2) 25%,
    rgba(168, 85, 247, 0.2) 50%,
    rgba(239, 68, 68, 0.2) 75%,
    rgba(59,  130, 246, 0.2) 100%);
}

[data-theme="dark"] .magic-label {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .magic-description {
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .magic-custom-input {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .magic-custom-input:focus {
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.2),
    0 10px 15px -3px rgba(59, 130, 246, 0.2),
    inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Breakeven Section Icon */
.breakeven-icon {
  margin-left: var(--spacing-sm);
  font-size: var(--font-size-xl);
  opacity: 0.8;
  display: inline-block;
  animation: gentle-bounce 2s ease-in-out infinite;
}

@keyframes gentle-bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-3px);
  }
  60% {
    transform: translateY(-1px);
  }
}

/* Navigation Menu Styles */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.nav-toggle:hover {
  background: var(--bg-secondary);
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 3px 0;
  transition: var(--transition);
  transform-origin: center;
}

.nav-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--font-size-base);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: var(--transition);
  display: block;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-primary);
  background: rgba(49, 130, 206, 0.1);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.4rem;
    min-height: 60px;
    position: relative;
  }

  /* Navigation (hamburger) on the left */
  .main-nav {
    flex: 0 0 auto;
    z-index: 1;
  }

  .nav-toggle {
    display: flex;
    margin: 0;
  }

  /* Logo centered - positioned absolutely to ensure perfect centering */
  .brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    z-index: 0;
  }

  /* Header actions on the right */
  .header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1;
  }

  /* Hide desktop theme toggle on mobile */
  .theme-toggle {
    display: none;
  }

  /* Mobile user menu - show only avatar */
  .user-menu .user-info {
    display: block; /* Change to block to stack elements */
  }

  .user-menu .user-text {
    display: none !important; /* Hide name and email on mobile */
  }

  .user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    margin: 2px; /* Remove any margin */
    border: none !important; /* Remove border on mobile */
    box-shadow: none !important; /* Remove shadow on mobile */
  }

  /* Remove padding from user menu on mobile */
  .user-menu {
    padding: 0;
    border: none !important; /* Remove border from user menu */
    box-shadow: none !important; /* Remove shadow from user menu */
  }

  /* Login button stays visible */
  .login-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    gap: 0;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-top: 8px;
    margin-left: 20px;
    margin-right: 20px;
    z-index: 1000;
  }
  
  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-item {
    width: 100%;
  }
  
  .nav-link {
    padding: var(--spacing-md);
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
  }
  
  /* Mobile theme toggle styling */
  .mobile-theme-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: var(--transition);
    text-align: right;
    direction: rtl;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
  
  .mobile-theme-toggle:hover {
    color: var(--accent-primary);
    background: rgba(49, 130, 206, 0.1);
  }
  
  .mobile-theme-toggle .theme-icon {
    font-size: 1.2rem;
    margin-left: auto;
  }
  
  .mobile-theme-toggle .theme-label {
    flex: 1;
  }
  
  /* Show mobile-only items only on mobile */
  .nav-item.mobile-only {
    display: block !important;
  }
  
  .nav-item:last-child .nav-link,
  .nav-item:last-child .mobile-theme-toggle {
    border-bottom: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
  
  .nav-item:first-child .nav-link {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
}

/* Hide mobile-only items on desktop */
.nav-item.mobile-only {
  display: none;
}

/* Page Content Management */
.page-content {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: visible; /* Allow overflow for sticky header to work */
}

.page-content.active-page {
  display: flex;
  flex-direction: column;
}

/* Blog Styles */
.blog-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-xl) 0;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.blog-header h2 {
  margin-bottom: var(--spacing-md);
  color: var(--accent-primary);
  font-size: var(--font-size-3xl);
}

.blog-description {
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.blog-posts {
  margin-top: var(--spacing-xl);
}

.blog-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
  .blog-posts-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
}

/* Blog Post Card */
.blog-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.blog-post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--accent-primary);
}

.blog-post-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-2xl);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.blog-post-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="60" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.blog-post-content {
  padding: var(--spacing-lg);
}

.blog-post-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
  line-height: 1.4;
}

.blog-post-excerpt {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  line-height: 1.6;
  margin-bottom: var(--spacing-md);
}

.blog-post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

.blog-post-date {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.blog-post-read-time {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Individual Blog Post Article */
.blog-post-article {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.blog-post-header {
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border-color);
}

.blog-post-article h1 {
  font-size: var(--font-size-3xl);
  color: var(--accent-primary);
  margin-bottom: var(--spacing-md);
  line-height: 1.3;
}

.blog-post-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.blog-post-body {
  padding: var(--spacing-xl);
  line-height: 1.8;
}

.blog-post-body h2 {
  color: var(--accent-primary);
  margin: var(--spacing-xl) 0 var(--spacing-md) 0;
  font-size: var(--font-size-2xl);
}

.blog-post-body h3 {
  color: var(--text-primary);
  margin: var(--spacing-lg) 0 var(--spacing-md) 0;
  font-size: var(--font-size-xl);
}

.blog-post-body p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

.blog-post-body ul,
.blog-post-body ol {
  margin: var(--spacing-md) 0;
  padding-right: var(--spacing-lg);
}

.blog-post-body li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
}

.blog-post-body blockquote {
  border-right: 4px solid var(--accent-primary);
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  border-radius: var(--radius-md);
  font-style: italic;
  color: var(--text-secondary);
}

.blog-post-body code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--accent-primary);
}

.blog-post-body pre {
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--spacing-lg) 0;
  border: 1px solid var(--border-color);
}

.blog-post-body pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

/* Blog Post Navigation */
.blog-post-navigation {
  margin-top: var(--spacing-xl);
  text-align: center;
}

.back-to-blog-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.back-to-blog-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Loading State for Blog */
.blog-loading {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

.blog-error {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  margin: var(--spacing-lg) 0;
}

/* Responsive adjustments for blog */
@media (max-width: 768px) {
  .blog-header {
    padding: var(--spacing-lg) var(--spacing-md);
  }
  
  .blog-header h2 {
    font-size: var(--font-size-2xl);
  }
  
  .blog-description {
    font-size: var(--font-size-base);
  }
  
  .blog-post-article {
    margin: 0 var(--spacing-md);
  }
  
  .blog-post-header,
  .blog-post-body {
    padding: var(--spacing-lg);
  }
  
  .blog-post-article h1 {
    font-size: var(--font-size-2xl);
  }
  
  .blog-post-info {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: stretch;
  }
}

/* Desktop App Layout for Calculator - Viewport Height Based */
.calculator-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-areas: "sidebar main";
  gap: var(--spacing-md);
  height: 100%;
  flex: 1;
  width: 100%;
  max-width: 100vw;
  overflow: visible; /* Allow scrolling for sticky header to work */
}

.left-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  min-width: 0;
  height: 100%;
  overflow-y: auto; /* Allow sidebar to scroll if content is too tall */
  overflow-x: hidden;
  padding-right: var(--spacing-xs); /* Space for scrollbar */
}

.main-content {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: visible; /* Allow overflow for sticky header to work */
  gap: var(--spacing-md);
}

/* Chart section takes remaining space after strategy section */
.main-content .chart-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 400px; /* Minimum height to ensure chart is usable */
  max-height: 50vh; /* Allow up to 60% of viewport height */
  overflow: hidden;
}

/* Strategy section grows dynamically based on content */
.main-content .strategy-section {
  flex: none; /* Don't use flex ratio, let content determine height */
  display: flex;
  flex-direction: column;
  min-height: auto;
  max-height: 60vh; /* Allow up to 60% of viewport height */
  overflow: visible; /* Allow content to determine height, but table can scroll if needed */
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}

.right-panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  min-width: 0; /* Allow shrinking */
}

/* Wide layout specific styles - add bottom margin to summary and strategy sections */
@media (min-width: 1025px) {
  .left-sidebar {
    margin-bottom: var(--spacing-lg);
  }
  
  .strategy-section {
    margin-bottom: var(--spacing-lg);
  }
}

/* Responsive breakpoints for desktop layout */
@media (max-width: 1024px) {
  .calculator-layout {
    grid-template-columns: 3fr 1fr;
    gap: var(--spacing-md);
  }
}

/* Mobile responsive - single column layout */
@media (max-width: 1024px) {
  /* Remove viewport height constraints to allow natural scrolling */
  .page-content {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  
  .page-content.active-page {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  
  .container {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  
  .calculator-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    height: auto; /* Allow natural height flow */
    overflow: visible; /* Allow scrolling on mobile */
    min-height: auto;
  }
  
  /* Mobile section ordering: 
     1. נתוני שוק (Market Data) - order 1
     2. בניית אסטרטגיה (Strategy Builder) - order 2
     3. סיכום אסטרטגיה (Strategy Summary) - order 3
     4. גרף (Chart) - order 4
  */
  
  .left-sidebar {
    display: contents; /* Remove container, allow children to participate in flex layout */
  }
  
  .main-content {
    display: contents; /* Remove container, allow children to participate in flex layout */
  }
  
  /* 1. Market Data - order 1 */
  .market-inputs {
    order: 1;
    flex: none;
    height: auto;
    overflow: visible;
    margin-bottom: var(--spacing-md);
  }
  
  /* 2. Strategy Builder - order 2 */
  .strategy-section {
    order: 2;
    flex: none;
    height: auto;
    max-height: none;
    overflow: visible;
    /* margin-bottom: var(--spacing-md); */
  }
  
  /* 3. Strategy Summary - order 3 */
  .summary-section {
    order: 3;
    flex: none;
    height: auto;
    overflow: visible;
    margin-bottom: var(--spacing-md);
  }
  
  /* 4. Chart - order 4 */
  .chart-section {
    order: 4;
    flex: none;
    height: auto;
    min-height: auto;
    overflow: visible;
    margin-bottom: var(--spacing-md);
  }
  
  .chart-container {
    height: 400px;
    min-height: 400px;
    max-height: none;
    position: relative;
  }
  
  .right-panel {
    display: none; /* Hide right panel on mobile */
  }
}

/* Tablet responsive - 2 column layout */
@media (min-width: 769px) and (max-width: 1024px) {
  .calculator-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    height: 100%;
    overflow: hidden;
  }
  
  .left-sidebar {
    order: 1;
    height: auto;
    flex: none;
  }
  
  .main-content {
    order: 2;
    flex: 1;
    overflow: hidden;
  }
  
  .main-content .chart-section {
    flex: 1;
  }
  
  .main-content .strategy-section {
    flex: none;
  }
  
  .main-content .chart-container {
    height: 400px;
    min-height: 400px;
    max-height: none;
  }
  
  .right-panel {
    order: 3;
    height: auto;
    flex: none;
  }
}

/* Tablet responsive - 2 column layout */
/* @media (min-width: 768px) and (max-width: 1023px) {
  .calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
      "sidebar main"
      "panel panel";
    gap: var(--spacing-md);
  } */
  
  /* .main-content .chart-container {
    height: 400px;
    min-height: 400px;
    max-height: none;
  }
} */

/* Sidebar specific styling */
.left-sidebar .market-inputs,
.left-sidebar .summary-section {
  margin-bottom: 0;
  padding: var(--spacing-sm); /* Reduced from --spacing-md */
  flex-shrink: 0;
}

.left-sidebar .inputs-grid {
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

.left-sidebar .summary-grid {
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm);
}

.left-sidebar .breakeven-section {
  padding: var(--spacing-sm); /* Reduced from --spacing-md */
  min-height: 60px; /* Reduced from 80px */
}

/* Greeks section styling */
.greeks-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-top: var(--spacing-md);
  transition: all 0.3s ease;
}

.greeks-section.hidden {
  display: none;
}

.greeks-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    var(--accent-primary) 0%, 
    var(--success) 50%, 
    var(--accent-primary) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.greeks-title {
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--font-size-base);
  text-align: center;
  position: relative;
  z-index: 1;
}

.greeks-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 1px;
}

.greeks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

.greek-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  text-align: center;
  transition: var(--transition);
  position: relative;
}

.greek-item:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.greek-label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
  position: relative;
}

.greek-info {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 12px;
  color: var(--accent-primary);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  z-index: 10;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.greek-info:hover {
  opacity: 1;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

/* Greek info popup */
.greek-info-popup {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: 200px;
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  line-height: 1.4;
}

.greek-info-popup.hidden {
  display: none;
}

.greek-info-content {
  text-align: right;
  direction: rtl;
}

.greek-info-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-right-color: var(--bg-card);
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
}

.greek-value {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.greek-value.positive {
  color: var(--success);
}

.greek-value.negative {
  color: var(--error);
}

/* Advanced section styling */
.advanced-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-top: var(--spacing-md);
  transition: all 0.3s ease;
}

.advanced-section.hidden {
  display: none;
}

.advanced-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    var(--warning) 0%, 
    var(--accent-primary) 50%, 
    var(--warning) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.advanced-title {
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--font-size-base);
  text-align: center;
  position: relative;
  z-index: 1;
}

.advanced-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--warning);
  border-radius: 1px;
}

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

/* Responsive Advanced section */
@media (max-width: 768px) {
  .advanced-grid {
    gap: var(--spacing-xs);
  }
}

/* Toggle buttons section - positioned at bottom of market inputs */
.toggle-buttons-section {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

.toggle-buttons-section .refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: var(--font-size-sm);
  font-weight: 500;
  min-width: 100px;
  box-shadow: var(--shadow-sm);
}

.toggle-buttons-section .refresh-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.toggle-buttons-section .refresh-btn .btn-text {
  font-weight: 500;
  white-space: nowrap;
}

/* Active state for toggle buttons when sections are open */
.toggle-buttons-section .refresh-btn.active {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 
    var(--shadow-md),
    0 0 0 2px rgba(49, 130, 206, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  position: relative;
}

.toggle-buttons-section .refresh-btn.active::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    rgba(49, 130, 206, 0.3) 0%,
    rgba(44, 90, 160, 0.3) 50%,
    rgba(49, 130, 206, 0.3) 100%);
  border-radius: inherit;
  z-index: -1;
  animation: activeGlow 2s ease-in-out infinite;
}

@keyframes activeGlow {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

.toggle-buttons-section .refresh-btn.active:hover {
  background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 6px 20px rgba(49, 130, 206, 0.3),
    0 0 0 2px rgba(49, 130, 206, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.toggle-buttons-section .refresh-btn.active .btn-text {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Strategy Dropdown Styles */
.strategies-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 320px;
  max-width: 400px;
  max-height: 400px;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
  direction: rtl;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.strategies-dropdown.show {
  opacity: 1;
  transform: translateY(0);
}

.strategies-dropdown-content {
  padding: 0;
}

.strategies-dropdown-header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.strategies-list {
  max-height: 320px;
  overflow-y: auto;
  padding: var(--spacing-sm) 0;
}

.strategy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  margin: 0 var(--spacing-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  position: relative;
}

.strategy-item:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
}

.strategy-item.current-strategy {
  background: linear-gradient(135deg, 
    rgba(var(--accent-primary-rgb), 0.1) 0%, 
    rgba(var(--accent-primary-rgb), 0.05) 100%);
  border-color: var(--accent-primary);
}

.strategy-item.current-strategy::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.strategy-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.strategy-name {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  margin-bottom: var(--spacing-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-date {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.strategy-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  margin-right: var(--spacing-sm);
}

.strategy-item:hover .strategy-delete-btn {
  opacity: 1;
  transform: scale(1);
}

.strategy-delete-btn:hover {
  background: var(--error-bg);
  color: var(--error);
  transform: scale(1.1);
}

.strategy-delete-btn svg {
  width: 16px;
  height: 16px;
}

.strategy-item.empty-state,
.strategy-item.loading-state,
.strategy-item.error-state {
  justify-content: center;
  cursor: default;
  font-style: italic;
  color: var(--text-muted);
}

.strategy-item.error-state {
  color: var(--error);
}

.strategy-item.loading-state::before {
  content: '';
  width: 16px;
  height: 16px;
  margin-left: var(--spacing-sm);
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Lock button for legs */
.lock-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.lock-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Dark mode styling for lock button images */
[data-theme="dark"] .lock-btn img {
  filter: invert(1) brightness(1);
}

.lock-btn.locked {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.1);
}

.lock-btn.locked:hover {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.lock-btn.unlocked {
  color: var(--text-muted);
}

.lock-btn.unlocked:hover {
  color: var(--accent-primary);
}
