/* ============================================
   HiWayGo - Design System & Global Styles
   ============================================ */

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

/* CSS Custom Properties - Design Tokens */
:root {
  /* Color Palette - Vibrant & Modern */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);

  --primary-color: #667eea;
  --primary-dark: #5568d3;
  --secondary-color: #f5576c;
  --accent-color: #00f2fe;
  --success-color: #43e97b;
  --warning-color: #ffa726;
  --danger-color: #ef5350;

  /* Neutral Colors */
  --bg-primary: #0a0e27;
  --bg-secondary: #151932;
  --bg-tertiary: #1e2139;
  --bg-card: rgba(30, 33, 57, 0.6);
  --bg-glass: rgba(255, 255, 255, 0.05);

  --text-primary: #ffffff;
  --text-secondary: #b8b9d4;
  --text-muted: #6b6d8f;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(102, 126, 234, 0.5);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);
  --glow-primary: 0 0 20px rgba(102, 126, 234, 0.3);
  --glow-accent: 0 0 20px rgba(0, 242, 254, 0.3);

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(245, 87, 108, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(0, 242, 254, 0.05) 0%, transparent 50%);
  z-index: -1;
  animation: backgroundPulse 15s ease-in-out infinite;
}

@keyframes backgroundPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ============================================
   Typography
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: var(--font-size-4xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
}

p {
  margin-bottom: var(--spacing-md);
}

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

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

/* ============================================
   Layout
   ============================================ */

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: auto;
  background: transparent;
  border-right: none;
  display: flex;
  flex-direction: row;
  z-index: var(--z-sticky);
  pointer-events: none;
}

.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ============================================
   Header
   ============================================ */

.header {
  padding: var(--spacing-sm) var(--spacing-xl);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;

}

.logo-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xl);
  box-shadow: var(--glow-primary);
}

.logo-text h1 {
  font-size: var(--font-size-2xl);
  margin: 0;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================
   Search & Controls
   ============================================ */

.search-section {
  width: 300px;
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: var(--spacing-md);
  pointer-events: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.search-bar {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.search-input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 3rem;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--glow-primary);
}

.search-icon {
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--font-size-lg);
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

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

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-value {
  color: var(--accent-color);
  font-weight: 700;
}

/* Radius Slider */
.radius-slider {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
  position: relative;
  overflow: hidden;
}

.radius-slider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--slider-value, 50%);
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

.radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--glow-accent);
  position: relative;
  z-index: 2;
  transition: transform var(--transition-fast);
}

.radius-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.radius-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--glow-accent);
  transition: transform var(--transition-fast);
}

.radius-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.toggle-container:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-base);
}

.toggle-switch.active {
  background: var(--primary-gradient);
  box-shadow: var(--glow-primary);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-base);
}

.toggle-switch.active::after {
  transform: translateX(24px);
}

/* ============================================
   Pump List
   ============================================ */

.pump-list-container {
  width: 320px;
  height: calc(100vh - 40px);
  margin: 20px 0 20px 10px;
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.pump-list-header {
  padding: var(--spacing-md);
  margin-bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pump-count {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.pump-list {
  padding: var(--spacing-md);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* ============================================
   Map Container
   ============================================ */

#map {
  width: 100%;
  height: 100%;
  z-index: var(--z-base);
}

/* Map Controls */
.map-controls {
  position: absolute;
  top: var(--spacing-xl);
  right: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  z-index: var(--z-dropdown);
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
  display: none !important;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

.text-center {
  text-align: center;
}

.mt-auto {
  margin-top: auto;
}

/* ============================================
   Mobile Menu Toggle
   ============================================ */

.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: var(--spacing-md);
  left: var(--spacing-md);
  z-index: var(--z-modal);
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 0;
}

.mobile-menu-toggle:hover {

  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

.mobile-menu-toggle.active {
  right: var(--spacing-md);
  left: unset;
}

.hamburger-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  margin: 0 auto;
  transition: all var(--transition-base);
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  left: 0px;
  background: var(--text-primary);
  transition: all var(--transition-base);
}

.hamburger-icon::before {
  top: -8px;
}

.hamburger-icon::after {
  bottom: -8px;
}

.mobile-menu-toggle.active .hamburger-icon {
  background: transparent;
}

.mobile-menu-toggle.active .hamburger-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-icon::after {
  bottom: 0;
  transform: rotate(-45deg);
}

/* Enhanced responsive design */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-container {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: var(--bg-secondary);
    flex-direction: column;
    pointer-events: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-xl);
    border-right: 1px solid var(--border-color);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .search-section {
    width: 100%;
    height: auto;
    border-right: none;
    background: transparent;
    padding: var(--spacing-md);
    flex-shrink: 1;
  }

  .pump-list-container {
    width: 100%;
    height: auto;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    flex: 1;
    overflow-y: auto;
  }

  .main-content {
    width: 100%;
    height: 100vh;
  }

  /* Touch-friendly controls */
  .btn {
    min-height: 44px;
  }

  .btn-icon {
    width: 52px;
    height: 52px;
    font-size: var(--font-size-2xl);
  }

  .search-input {
    min-height: 44px;
    font-size: 16px;
  }

  .radius-slider {
    height: 12px;
  }

  .radius-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  .radius-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  .toggle-switch {
    width: 56px;
    height: 32px;
  }

  .toggle-switch::after {
    width: 26px;
    height: 26px;
  }

  .toggle-switch.active::after {
    transform: translateX(24px);
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 90%;
  }

  .pump-card {
    padding: var(--spacing-md);
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .sidebar {
    width: 50%;
    max-width: 350px;
  }
}