/* Modern Design System Variables */
:root {
  /* Cyberpunk Color Palette */
  --primary-bg: #020204;       /* Pitch Black */
  --secondary-bg: #0a0a0a;     /* Dark Grey */
  --tertiary-bg: #141414;
  --card-bg: #121212;
  --surface-bg: rgba(18, 18, 18, 0.95);
  --glass-bg: rgba(5, 5, 5, 0.95);
  
  /* Brand Colors - Cyberpunk Neon */
  --highlight: #FCEE0A;        /* Neon Yellow */
  --highlight-hover: #E6D805;
  --highlight-light: rgba(252, 238, 10, 0.1);
  --highlight-border: rgba(252, 238, 10, 0.5);
  
  /* Text Colors */
  --text-primary: #F0F0F0;
  --text-secondary: #A0A0A0;
  --text-muted: #606060;
  --text-inverse: #000000;
  
  /* Status Colors - Neon Variants */
  --success: #00FF9F;          /* Neon Green */
  --warning: #FFB800;
  --danger: #FF0055;           /* Neon Red/Pink */
  --info: #00F0FF;             /* Neon Cyan */
  
  /* Border & Divider */
  --border-color: #333333;
  --border-light: rgba(252, 238, 10, 0.2);
  --divider: rgba(255, 255, 255, 0.1);
  
  /* Typography */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-headings: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-base: 14px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);
  
  /* Layout */
  --header-height: 72px;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;
  --container-max-width: 1400px;
  
  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1010;
  --z-fixed: 1020;
  --z-modal-backdrop: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-colors: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

/* Cyberpunk Layout Utilities */
.cp-container {
  position: relative;
  background-color: var(--primary-bg);
  background-image: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
}

.cp-card {
  background: var(--card-bg);
  border: 1px solid var(--highlight);
  box-shadow: 0 0 10px var(--highlight-light);
  clip-path: polygon(
    0 0, 
    100% 0, 
    100% calc(100% - 20px), 
    calc(100% - 20px) 100%, 
    0 100%
  );
  padding: 2rem;
  position: relative;
}

.cp-card::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 20px;
  background: var(--highlight);
  color: #000;
  font-size: 0.6rem;
  padding: 2px 5px;
  font-weight: bold;
  letter-spacing: 1px;
  z-index: 1;
  display: none;
}

.cp-btn {
  background: transparent;
  color: var(--highlight);
  border: 1px solid var(--highlight);
  padding: 10px 30px;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 2px;
  position: relative;
  transition: all 0.3s;
  clip-path: polygon(
    10px 0, 
    100% 0, 
    100% calc(100% - 10px), 
    calc(100% - 10px) 100%, 
    0 100%, 
    0 10px
  );
  text-decoration: none;
  display: inline-block;
}

.cp-btn:hover {
  background: var(--highlight);
  color: #000;
  box-shadow: 0 0 20px var(--highlight);
  text-decoration: none;
}

.cp-title {
  font-family: 'Courier New', Courier, monospace;
  text-transform: uppercase;
  letter-spacing: 4px;
  border-left: 5px solid var(--highlight);
  padding-left: 15px;
  margin-bottom: 20px;
  color: #fff;
  text-shadow: 2px 2px 0px var(--danger), -2px -2px 0px var(--info);
}

.cp-input {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--text-secondary);
  border-left: 3px solid var(--text-secondary);
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
}

.cp-input:focus {
  border-color: var(--highlight);
  box-shadow: 0 0 5px var(--highlight);
  outline: none;
}

.cp-glitch {
  position: relative;
}

.cp-glitch::before,
.cp-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.cp-glitch::before {
  left: 2px;
  text-shadow: -1px 0 var(--danger);
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim 5s infinite linear alternate-reverse;
}

.cp-glitch::after {
  left: -2px;
  text-shadow: -1px 0 var(--info);
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(30px, 9999px, 10px, 0); }
  20% { clip: rect(85px, 9999px, 95px, 0); }
  40% { clip: rect(10px, 9999px, 65px, 0); }
  60% { clip: rect(60px, 9999px, 20px, 0); }
  80% { clip: rect(25px, 9999px, 55px, 0); }
  100% { clip: rect(90px, 9999px, 5px, 0); }
}

@keyframes glitch-anim2 {
  0% { clip: rect(15px, 9999px, 85px, 0); }
  20% { clip: rect(65px, 9999px, 35px, 0); }
  40% { clip: rect(40px, 9999px, 10px, 0); }
  60% { clip: rect(95px, 9999px, 55px, 0); }
  80% { clip: rect(10px, 9999px, 75px, 0); }
  100% { clip: rect(55px, 9999px, 25px, 0); }
}

/* Modern Global Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--primary-bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-headings);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  margin: 0;
  color: var(--text-primary);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition-colors);
}

a:hover {
  color: var(--highlight);
}

a:focus {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Form Elements */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  transition: var(--transition-colors);
}

/* Focus Management */
*:focus {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

button:focus,
.btn:focus,
[role="button"]:focus {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

/* Layout Containers */
.app-container {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar-safe-wrapper {
  width: 100%;
  position: relative;
  margin-left: 0;
  transition: margin-left var(--transition-base);
}

.app-content {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: var(--space-md);
  min-height: calc(100vh - var(--header-height));
  overflow-x: hidden;
}

/* Modern Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-colors);
  position: relative;
  overflow: hidden;
  min-height: 44px;
}

.btn:focus {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--highlight) 0%, var(--highlight-hover) 100%);
  border-color: var(--highlight);
  color: #000;
  box-shadow: var(--shadow-md);
  font-weight: 700;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--highlight-hover) 0%, var(--highlight) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface-bg);
  border-color: var(--border-light);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--secondary-bg);
  border-color: var(--highlight-border);
  color: var(--highlight);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Button Sizes */
.btn-sm {
  padding: calc(var(--space-sm) * 0.75) var(--space-md);
  font-size: 13px;
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 16px;
  min-height: 52px;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Modern Form Elements */
input, select, textarea {
  background: var(--glass-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  line-height: 1.5;
  transition: var(--transition-colors);
  box-shadow: var(--shadow-sm);
  min-height: 44px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--highlight);
  background: var(--secondary-bg);
  box-shadow: 0 0 0 3px var(--highlight-light), var(--shadow-md);
}

input::placeholder {
  color: var(--text-muted);
}

/* Modern Dropdown System */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg) var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: var(--transition-colors);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-toggle:hover {
  border-color: var(--highlight-border);
  background: var(--secondary-bg);
  color: var(--highlight);
}

.dropdown-toggle:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px var(--highlight-light), var(--shadow-md);
}

.dropdown-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.dropdown-menu.show {
  display: block;
  animation: dropdownFadeIn 0.2s ease-out;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--z-dropdown);
  display: none;
  min-width: 200px;
  max-width: 320px;
  margin: var(--space-xs) 0 0;
  background: var(--glass-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-xs) 0;
}

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

.dropdown-menu-right {
  right: 0;
  left: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  transition: var(--transition-colors);
  font-size: var(--font-size-base);
  white-space: nowrap;
  gap: var(--space-sm);
}

.dropdown-item:hover {
  background: var(--highlight-light);
  color: var(--highlight);
  text-decoration: none;
}

.dropdown-item:focus {
  outline: none;
  background: var(--highlight-light);
  color: var(--highlight);
}

.dropdown-item.active {
  background: var(--highlight-light);
  color: var(--highlight);
  font-weight: var(--font-weight-medium);
}

/* Fix for currency dropdown items */
.currency-btn .dropdown-item {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin: 0 var(--space-xs);
  font-weight: var(--font-weight-medium);
}

/* Ensure proper stacking order */
.dropdown {
  position: relative;
}

.app-header .dropdown {
  z-index: var(--z-dropdown);
}

.app-header .dropdown-menu {
  z-index: calc(var(--z-dropdown) + 10);
}

/* Dropdown Scrollbar */
.dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
  background: var(--secondary-bg);
  border-radius: var(--radius-sm);
}

.dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: var(--highlight);
}

/* Google Translate Integration */
.goog-te-banner-frame.skiptranslate {
  display: none !important;
}

body {
  top: 0 !important;
}

.goog-te-gadget-simple {
  background: var(--glass-bg) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-family-base) !important;
  font-size: var(--font-size-base) !important;
}

.goog-te-gadget-simple:hover {
  border-color: var(--highlight-border) !important;
  background: var(--secondary-bg) !important;
}

.goog-te-gadget-simple .goog-te-menu-value {
  color: var(--text-primary) !important;
}

.goog-te-gadget-simple .goog-te-menu-value:hover {
  color: var(--highlight) !important;
}

/* Mobile Responsive Fixes */
@media (max-width: 768px) {
  .dropdown-menu {
    position: fixed !important;
    top: auto !important;
    left: var(--space-sm) !important;
    right: var(--space-sm) !important;
    width: calc(100vw - 2 * var(--space-sm)) !important;
    max-width: none !important;
    border-radius: var(--radius-lg) !important;
    margin: 0 !important;
    z-index: calc(var(--z-dropdown) + 100) !important;
  }
  
  .dropdown-menu-right {
    left: var(--space-sm) !important;
    right: var(--space-sm) !important;
  }
}

.app-header .goog-te-gadget-simple::after {
  display: none !important;
}

/* Ensure dropdowns work on all devices with proper event handling */
.dropdown-toggle {
  position: relative;
  cursor: pointer;
  user-select: none;
  background: var(--glass-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg) var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  transition: var(--transition-colors);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-toggle:hover {
  border-color: var(--highlight-border);
  background: var(--secondary-bg);
  color: var(--highlight);
}

.dropdown-toggle:focus {
  outline: 2px solid var(--highlight);
  outline-offset: 2px;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px var(--highlight-light), var(--shadow-md);
}

.dropdown-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* Fix for nested dropdown items */
.dropdown-menu li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dropdown-menu li a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition-colors);
  border-radius: var(--radius-sm);
  margin: 0 var(--space-xs);
}

.dropdown-menu li a:hover {
  background: var(--highlight-light);
  color: var(--highlight);
  text-decoration: none;
}

/* Enhanced click areas for mobile */
@media (max-width: 768px) {
  .dropdown-toggle {
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .dropdown-item,
  .dropdown-menu li a {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --highlight: #0066CC;
    --highlight-hover: #004499;
    --border-light: #666666;
  }
  
  .btn, .dropdown-toggle {
    border-width: 2px;
  }
}

/* Print Styles */
@media print {
  .app-sidebar,
  .app-header,
  .dropdown-menu,
  .btn {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }
}

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--highlight);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: var(--z-tooltip);
}

.skip-link:focus {
  top: 6px;
}
