/* ========================================
   Vision Web - Custom CSS
   ======================================== */

/* CSS Variables */
:root {
  /* Brand Colors */
  --emerald: #10B981;
  --blue: #3B82F6;
  --violet: #8B5CF6;
  --gradient: linear-gradient(135deg, #10B981, #3B82F6, #8B5CF6);

  /* Light Mode (default) */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F1F5F9;
  --bg-tertiary: #E2E8F0;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --border-color: #E2E8F0;
  --card-bg: rgba(255, 255, 255, 0.8);
  --header-bg: rgba(255, 255, 255, 0.9);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-tertiary: #334155;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --border-color: #334155;
  --card-bg: rgba(30, 41, 59, 0.8);
  --header-bg: rgba(15, 23, 42, 0.9);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

/* RTL Support */
[dir="rtl"] body {
  font-family: 'Cairo', sans-serif;
}

/* Gradient Text */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glassmorphism Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .glass-card:hover {
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

/* Header Styles */
.header {
  background: transparent;
  transition: all 0.3s ease;
}

.header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Navigation */
.nav-link {
  position: relative;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 80%;
}

/* Buttons */
.btn-primary {
  background: var(--gradient);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  border: 2px solid var(--border-color);
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* Theme Toggle */
.theme-toggle,
.lang-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-size: 1rem;
}

.theme-toggle:hover,
.lang-toggle:hover {
  background: var(--bg-tertiary);
}

/* Theme Icons */
.theme-icon {
  transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(15deg);
}

/* Particles Container */
#tsparticles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Hero Section */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Section Styles */
.section {
  padding: 5rem 0;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Service Card */
.service-icon {
  width: 60px;
  height: 60px;
  background: var(--gradient);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Portfolio Card */
.portfolio-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
}

.portfolio-card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.portfolio-card:hover img {
  transform: scale(1.1);
}

.portfolio-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
}

.portfolio-card:hover .portfolio-overlay {
  opacity: 1;
}

/* Stats */
.stat-item {
  text-align: center;
  padding: 2rem;
}

.stat-number {
  font-size: 3rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: var(--gradient);
}

[dir="rtl"] .timeline::before {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 1rem 2rem;
}

.timeline-item:nth-child(odd) {
  margin-left: auto;
  text-align: left;
  padding-left: 3rem;
}

.timeline-item:nth-child(even) {
  text-align: right;
  padding-right: 3rem;
}

[dir="rtl"] .timeline-item:nth-child(odd) {
  margin-left: 0;
  margin-right: auto;
  text-align: right;
  padding-left: 2rem;
  padding-right: 3rem;
}

[dir="rtl"] .timeline-item:nth-child(even) {
  text-align: left;
  padding-right: 2rem;
  padding-left: 3rem;
}

.timeline-dot {
  position: absolute;
  top: 1.5rem;
  width: 20px;
  height: 20px;
  background: var(--gradient);
  border-radius: 50%;
  border: 4px solid var(--bg-primary);
}

.timeline-item:nth-child(odd) .timeline-dot {
  left: -10px;
}

.timeline-item:nth-child(even) .timeline-dot {
  right: -10px;
}

[dir="rtl"] .timeline-item:nth-child(odd) .timeline-dot {
  left: auto;
  right: -10px;
}

[dir="rtl"] .timeline-item:nth-child(even) .timeline-dot {
  right: auto;
  left: -10px;
}

/* CTA Section */
.cta-section {
  background: var(--gradient);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  padding: 3rem 0 1.5rem;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-link:hover {
  background: var(--gradient);
  color: white;
  transform: translateY(-3px);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 999;
  padding: 2rem;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-primary);
}

[dir="rtl"] .mobile-menu-close {
  right: auto;
  left: 1rem;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Logo */
.logo {
  text-decoration: none;
}

.logo .logo-text {
  font-family: 'Inter', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  display: inline-block;
}

.logo .logo-vision {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo .logo-web {
  color: var(--text-primary);
  font-weight: 400;
}

/* ========================================
   Enhanced Buttons
   ======================================== */
.btn-primary {
  background: var(--gradient);
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

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

/* ========================================
   Enhanced Hamburger Animation
   ======================================== */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

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

/* ========================================
   Responsive Improvements
   ======================================== */

/* Large screens (1280px+) */
@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
  }

  .section {
    padding: 6rem 0;
  }

  .section-title {
    font-size: 3rem;
  }
}

/* Tablet (1024px) */
@media (max-width: 1024px) {
  .timeline::before {
    left: 20px;
  }

  [dir="rtl"] .timeline::before {
    left: auto;
    right: 20px;
  }

  .timeline-item {
    width: 100%;
    padding-left: 50px !important;
    padding-right: 1rem !important;
    text-align: left !important;
    margin-left: 0 !important;
  }

  [dir="rtl"] .timeline-item {
    padding-left: 1rem !important;
    padding-right: 50px !important;
    text-align: right !important;
    margin-right: 0 !important;
  }

  .timeline-dot {
    left: 10px !important;
    right: auto !important;
  }

  [dir="rtl"] .timeline-dot {
    left: auto !important;
    right: 10px !important;
  }

  .portfolio-card img {
    height: 220px;
  }
}

/* Mobile (768px) */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-desktop {
    display: none;
  }

  .section-title {
    font-size: 1.875rem;
  }

  .section-subtitle {
    font-size: 1rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .hero-section {
    min-height: auto;
    padding: 7rem 0 3rem;
  }

  .hero-section h1 {
    font-size: 2rem;
  }

  .hero-section p {
    font-size: 1rem;
  }

  /* Ensure touch targets are at least 44px */
  .btn-primary,
  .btn-secondary,
  .nav-link,
  .social-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile menu improvements */
  .mobile-menu {
    padding: 4rem 2rem 2rem;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .mobile-menu .nav-link {
    font-size: 1.5rem;
    padding: 1rem;
  }

  .mobile-menu .btn-primary {
    width: 100%;
    max-width: 280px;
    padding: 1rem 2rem;
  }

  /* Portfolio improvements */
  .portfolio-card img {
    height: 200px;
  }

  /* Contact card on mobile */
  .contact-whatsapp-card {
    padding: 1.5rem;
  }

  .whatsapp-icon-container {
    width: 64px;
    height: 64px;
  }

  .whatsapp-icon-container svg {
    width: 36px;
    height: 36px;
  }

  .whatsapp-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    width: 100%;
    max-width: 280px;
  }
}

/* Small screens (480px) */
@media (max-width: 480px) {
  .section {
    padding: 2.5rem 0;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .hero-section h1 {
    font-size: 1.75rem;
  }

  /* Full width buttons on small screens */
  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }

  /* Smaller stats */
  .stat-number {
    font-size: 1.75rem;
  }

  .stat-item {
    padding: 1.25rem;
  }

  /* Service cards */
  .service-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  /* CTA section */
  .cta-section h2 {
    font-size: 1.5rem;
  }

  .cta-section p {
    font-size: 1rem;
  }

  /* Footer */
  .footer {
    padding: 2rem 0 1rem;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--gradient);
  border-radius: 4px;
}

/* Selection */
::selection {
  background: var(--blue);
  color: white;
}

/* Animations */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* ========================================
   Scroll Progress Indicator
   ======================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient);
  z-index: 9999;
  transition: width 0.1s ease-out;
}

/* ========================================
   WhatsApp FAB (Floating Action Button)
   ======================================== */
.whatsapp-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background-color: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  z-index: 1000;
  transition: all 0.3s ease;
  animation: pulse-fab 2s infinite;
}

[dir="rtl"] .whatsapp-fab {
  right: auto;
  left: 24px;
}

.whatsapp-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-fab svg {
  transition: transform 0.3s ease;
}

.whatsapp-fab:hover svg {
  transform: rotate(-10deg);
}

.whatsapp-tooltip {
  position: absolute;
  right: 70px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
}

[dir="rtl"] .whatsapp-tooltip {
  right: auto;
  left: 70px;
}

.whatsapp-fab:hover .whatsapp-tooltip {
  opacity: 1;
  visibility: visible;
}

@keyframes pulse-fab {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(37, 211, 102, 0.6), 0 0 0 10px rgba(37, 211, 102, 0.1);
  }
}

/* Mobile FAB */
@media (max-width: 768px) {
  .whatsapp-fab {
    width: 52px;
    height: 52px;
    bottom: 20px;
    right: 20px;
  }

  [dir="rtl"] .whatsapp-fab {
    right: auto;
    left: 20px;
  }

  .whatsapp-fab svg {
    width: 24px;
    height: 24px;
  }

  .whatsapp-tooltip {
    display: none;
  }
}

/* ========================================
   Contact WhatsApp Card
   ======================================== */
.contact-whatsapp-card {
  border-top: 4px solid #25D366;
}

.whatsapp-icon-container {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: white;
  animation: float 3s ease-in-out infinite;
}

.whatsapp-btn {
  display: inline-block;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  padding: 1rem 2.5rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.whatsapp-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
}

.response-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #25D366;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

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

/* Loading Animation */
.loading {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
