/**
 * LocalFind - Core Styles & Design System
 * 
 * @author Mohammad Faiz
 * @repository https://github.com/Mohammad-Faiz-Cloud-Engineer/LocalFind
 * @license MIT
 * @version 4.3.3
 * @updated 2026-03-31
 * 
 * Professional design system with comprehensive styling
 */

/* ============================================
   TEXT SELECTION - THEME MATCHING
   ============================================ */

::selection {
  background: rgba(255, 138, 0, 0.3);
  color: #FFFFFF;
  text-shadow: none;
}

::-moz-selection {
  background: rgba(255, 138, 0, 0.3);
  color: #FFFFFF;
  text-shadow: none;
}

/* Enhanced selection for code blocks */
code::selection,
pre::selection {
  background: rgba(255, 138, 0, 0.4);
  color: #FFFFFF;
}

code::-moz-selection,
pre::-moz-selection {
  background: rgba(255, 138, 0, 0.4);
  color: #FFFFFF;
}

/* Selection in input fields */
input::selection,
textarea::selection {
  background: rgba(255, 138, 0, 0.35);
  color: #FFFFFF;
}

input::-moz-selection,
textarea::-moz-selection {
  background: rgba(255, 138, 0, 0.35);
  color: #FFFFFF;
}

:root {
  /* Color System - Professional Grade */
  --bg-primary: #0A0E17;
  --bg-surface: #131824;
  --bg-elevated: #1A2332;
  --bg-card: #1E2736;

  /* Accent Colors - Refined Premium */
  --accent-primary: #FF8A00;
  --accent-primary-hover: #FFB366;
  --accent-secondary: #E52E71;
  --accent-danger: #FF3B30;
  --accent-success: #34C759;
  --accent-info: #007AFF;

  /* Text Colors - Better Contrast */
  --text-primary: #FFFFFF;
  --text-secondary: #F0F3F7;
  --text-muted: #B8BFC8;
  --text-disabled: #8B92A0;

  /* Border & Dividers */
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-hover: rgba(255, 255, 255, 0.12);
  --divider-color: rgba(255, 255, 255, 0.04);

  /* Shadows - Professional Depth (Premium) */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 32px 64px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(255, 138, 0, 0.2);
  --shadow-glow-hover: 0 0 45px rgba(255, 138, 0, 0.35);

  /* Border Radius - Consistent System */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Spacing System */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* 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);

  /* Typography */
  --font-sans: 'Inter', 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Syne', 'Inter', sans-serif;

  /* Z-index System */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Disable pull-to-refresh in PWA */
  overscroll-behavior-y: contain;
}

body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-secondary);
  overflow-x: hidden;

  /* PWA-specific enhancements */
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;

  /* Disable text selection globally */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Disable text selection for all elements */
* {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

/* Only allow text selection in input fields */
input,
textarea,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

/* ============================================
   MODERN SCROLLBAR STYLES
   ============================================ */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background: rgba(255, 138, 0, 0.5);
  background-clip: padding-box;
}

/* Scrollbar corner */
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Add an ambient premium background glow */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120vh;
  background: radial-gradient(circle at 15% 5%, rgba(255, 138, 0, 0.08), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(229, 46, 113, 0.06), transparent 40%);
  z-index: -1;
  pointer-events: none;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 0 0 var(--space-md);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
}

h4 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 600;
}

p {
  color: var(--text-muted);
  margin: 0 0 var(--space-md);
  line-height: 1.7;
}

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

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

/* ============================================
   LAYOUT
   ============================================ */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-md);
  }
}

/* ============================================
   BUTTONS - Professional Grade
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font-sans);
}

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

.btn:active {
  transform: translateY(0);
}

.btn-cta {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  border: none;
  color: #0A0E17;
  font-weight: 700;
  padding: 14px 32px;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.btn-cta:hover {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-hover);
  filter: brightness(1.1);
  border-color: transparent;
  color: #0A0E17;
}

/* Ensure button content (text + child elements) is above the gradient */
.btn-cta {
  z-index: 1;
}

.btn-cta>* {
  position: relative;
  z-index: 2;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* ============================================
   SECTIONS
   ============================================ */

section {
  padding: var(--space-3xl) 0;
}

section h2 {
  text-align: center;
  margin-bottom: var(--space-2xl);
  position: relative;
}

section h2::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-full);
}

/* ============================================
   CTA BANNER
   ============================================ */

.cta-banner {
  background: linear-gradient(135deg,
      rgba(255, 138, 0, 0.08) 0%,
      rgba(229, 46, 113, 0.04) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-2xl);
  padding: var(--space-3xl) var(--space-2xl);
  text-align: center;
  margin: var(--space-3xl) 0;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.cta-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 138, 0, 0.08) 0%, transparent 70%);
  animation: pulse 8s ease-in-out infinite;
}

.cta-banner h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.cta-banner h2::after {
  display: none;
}

.cta-banner .btn-cta {
  font-size: 17px;
  padding: 16px 40px;
  position: relative;
  z-index: 1;
}

/* ============================================
   STATS SECTION
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.stat-card {
  background: rgba(30, 39, 54, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 138, 0, 0.3);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  background: rgba(30, 39, 54, 0.5);
}

.stat-card .num {
  font-size: 56px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-display);
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.stat-card .label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ============================================
   MAP PREVIEW
   ============================================ */

.map-wrap {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  height: 500px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
}

.map-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.map-overlay {
  position: absolute;
  bottom: var(--space-lg);
  left: var(--space-lg);
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(20px);
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
}

.map-overlay h3 {
  margin: 0 0 var(--space-sm);
  font-size: 22px;
  color: var(--text-primary);
}

.map-overlay p {
  margin: 0 0 var(--space-md);
  font-size: 15px;
  color: var(--text-muted);
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden {
  display: none !important;
}

.scroll-down {
  display: inline-block;
  margin-top: var(--space-lg);
  color: var(--accent-secondary);
  font-size: 32px;
  animation: float 3s ease-in-out infinite;
  cursor: pointer;
}

.view-all {
  text-align: center;
  margin-top: var(--space-2xl);
}

/* ============================================
   PWA ENHANCEMENTS
   ============================================ */

/* PWA-specific styles when running in standalone mode */
.pwa-mode {
  /* Disable pull-to-refresh */
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Safe area support for notched devices */
@supports (padding: env(safe-area-inset-top)) {
  .pwa-mode {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .pwa-mode .navbar {
    padding-top: calc(var(--space-md) + env(safe-area-inset-top));
  }
}

/* Disable text selection for app-like feel (except in inputs) */
.pwa-mode * {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.pwa-mode input,
.pwa-mode textarea,
.pwa-mode [contenteditable] {
  -webkit-touch-callout: default;
}

/* Hide install button when in PWA mode */
.pwa-mode .pwa-install-button {
  display: none !important;
}

/* Smooth scrolling for PWA */
.pwa-mode {
  scroll-behavior: smooth;
}

/* Prevent zoom on double tap */
.pwa-mode * {
  touch-action: manipulation;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .stat-card {
    padding: 20px 16px;
  }

  .stat-card .num {
    font-size: 42px;
    margin-bottom: 6px;
  }

  .stat-card .label {
    font-size: 12px;
    letter-spacing: 1.2px;
  }
}

@media (max-width: 640px) {
  section {
    padding: var(--space-2xl) 0;
  }

  .cta-banner {
    padding: var(--space-2xl) var(--space-lg);
    margin: var(--space-2xl) 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 18px 14px;
  }

  .stat-card .num {
    font-size: 38px;
    margin-bottom: 5px;
  }

  .stat-card .label {
    font-size: 11px;
    letter-spacing: 1px;
  }

  .map-wrap {
    height: 500px;
  }

  .map-overlay {
    left: var(--space-xs);
    right: var(--space-xs);
    bottom: var(--space-xs);
    padding: 10px 14px;
    min-width: auto;
    max-width: 100%;
  }

  .map-overlay h3 {
    font-size: 16px;
    margin: 0 0 4px;
    line-height: 1.2;
  }

  .map-overlay p {
    font-size: 12px;
    margin: 0 0 3px;
    line-height: 1.3;
  }

  .map-overlay .map-info {
    margin-bottom: 8px;
  }

  .map-overlay .btn {
    padding: 6px 12px;
    font-size: 12px;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 16px 12px;
  }

  .stat-card .num {
    font-size: 34px;
    margin-bottom: 4px;
  }

  .stat-card .label {
    font-size: 10px;
    letter-spacing: 0.8px;
  }
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children delays */
.reveal-stagger>.reveal:nth-child(1) {
  transition-delay: 0.05s;
}

.reveal-stagger>.reveal:nth-child(2) {
  transition-delay: 0.1s;
}

.reveal-stagger>.reveal:nth-child(3) {
  transition-delay: 0.15s;
}

.reveal-stagger>.reveal:nth-child(4) {
  transition-delay: 0.2s;
}

.reveal-stagger>.reveal:nth-child(5) {
  transition-delay: 0.25s;
}

.reveal-stagger>.reveal:nth-child(6) {
  transition-delay: 0.3s;
}

/* Page-load fade-in */
@keyframes pageIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

body {
  animation: pageIn 0.4s ease-out;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
