@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 142 70% 40%;
    --primary-foreground: 0 0% 98%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 142 70% 40%;
    --radius: 0.5rem;

    /* Custom colors */
    --brand-green: 142 70% 40%;
    --light-green: 142 70% 70%;
    --header-bg: 0 0% 100%;
  }
  .shadow-neon {
    box-shadow: 0 0 8px #00ff00, 0 0 16px #00ff00, 0 0 24px #00ff00;
    animation: neon-blink 1.5s infinite alternate;
  }

  @keyframes neon-blink {
    from {
      box-shadow: 0 0 8px #00ff00, 0 0 16px #00ff00;
    }
    to {
      box-shadow: 0 0 12px #00ff00, 0 0 20px #00ff00;
    }
  }

  .dark {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 142 70% 40%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 142 70% 40%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  html {
    /* Ensure smooth scrolling works on all browsers */
    scroll-behavior: smooth !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal overflow */
    overflow-x: hidden;
    /* Base font size for rem calculations */
    font-size: 16px;
  }

  body {
    @apply bg-background text-foreground antialiased;
    font-feature-settings: "rlig" 1, "calt" 1;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    width: 100%;
  }

  /* Fluid Typography using clamp for responsive text sizing */
  h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.2;
    @apply font-bold tracking-tight text-center;
  }

  h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.3;
    @apply font-bold tracking-tight text-center;
  }

  h3 {
    font-size: clamp(1.25rem, 3vw, 2rem);
    line-height: 1.4;
    @apply font-bold tracking-tight text-center;
  }

  h4,
  h5,
  h6 {
    font-size: clamp(1rem, 2vw, 1.5rem);
    line-height: 1.5;
    @apply font-bold tracking-tight text-center;
  }

  p {
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    @apply leading-relaxed text-zinc-700;
    line-height: 1.7;
  }

  /* Ensure content doesn't overlap with fixed header */
  main {
    padding-top: 5rem;
  }
}

@layer components {
  /* Animation for section reveals - optimized for performance */
  .animate-fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
    will-change: opacity, transform;
  }

  .animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
    will-change: opacity;
  }

  /* Improved focus styles */
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible {
    @apply outline-none ring-2 ring-offset-2 ring-offset-white ring-[#01c509]/20;
  }

  /* Button styles */
  .btn-primary {
    @apply bg-[#01c509] hover:bg-[#01c509]/90 text-white px-6 py-3 rounded-lg transition-all duration-300 font-medium shadow-sm hover:shadow-md;
  }

  .btn-secondary {
    @apply bg-white hover:bg-zinc-50 text-zinc-900 border border-zinc-200 px-6 py-3 rounded-lg transition-all duration-300 font-medium shadow-sm hover:shadow-md;
  }

  /* Card styles */
  .card-hover {
    @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1;
  }

  /* Icon wrapper */
  .icon-wrapper {
    @apply p-3 rounded-full flex items-center justify-center;
  }

  .icon-wrapper-primary {
    @apply bg-[#01c509]/10 text-[#01c509];
  }

  /* Animations for scroll reveal */
  .reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  }

  .reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* Improved button styles */
  .btn-icon {
    @apply inline-flex items-center justify-center rounded-full p-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50;
  }

  /* Improved section titles */
  .section-title {
    @apply relative inline-block;
  }

  .section-title::after {
    content: "";
    @apply absolute bottom-0 left-0 w-1/3 h-1 bg-[#01c509] rounded-full;
  }

  /* Improved card styles */
  .premium-card {
    @apply relative overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-sm transition-all duration-300;
  }

  .premium-card:hover {
    @apply shadow-md border-[#01c509]/20;
  }

  /* Typography utilities with fluid sizing */
  .heading-xl {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    @apply font-bold tracking-tight;
  }

  .heading-lg {
    font-size: clamp(2rem, 5vw, 3.5rem);
    @apply font-bold tracking-tight;
  }

  .heading-md {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    @apply font-bold tracking-tight;
  }

  .heading-sm {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    @apply font-bold tracking-tight;
  }

  .body-lg {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    @apply leading-relaxed;
  }

  .body-md {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    @apply leading-relaxed;
  }

  .body-sm {
    font-size: clamp(0.875rem, 1vw, 1rem);
    @apply leading-relaxed;
  }

  /* Consistent section title styling */
  .section-title-centered {
    @apply relative inline-block pb-2 text-center;
  }

  .section-title-centered::after {
    content: "";
    @apply absolute bottom-0 left-1/2 transform -translate-x-1/2 w-24 h-1 bg-[#01c509] rounded-full;
  }

  /* Ensure section titles are displayed properly */
  .section-title-nowrap {
    max-width: 100%;
    display: inline-block;
    margin: 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Allow wrapping on small screens */
    @media (max-width: 640px) {
      white-space: normal;
    }
    /* Keep nowrap on larger screens */
    @media (min-width: 641px) {
      white-space: nowrap;
    }
  }

  /* Pricing text */
  .pricing-text {
    font-size: clamp(2rem, 5vw, 3rem);
    @apply font-bold;
  }

  /* Improved pricing display */
  .pricing-amount {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
    color: #01c509;
  }

  /* Improved text readability */
  .content-text {
    font-size: clamp(0.95rem, 1.5vw, 1.05rem);
    line-height: 1.9;
    color: #374151;
    letter-spacing: 0.01em;
  }

  /* Consistent button styling */
  .button-primary {
    @apply bg-[#01c509] hover:bg-[#01c509]/90 text-white transition-all duration-300 shadow-sm hover:shadow-md flex items-center justify-center rounded-lg;
    height: 3.5rem;
    width: 100%;
    max-width: 100%;
    @media (min-width: 640px) {
      min-width: 260px;
      width: auto;
    }
  }

  .button-secondary {
    @apply bg-white border border-[#01c509] text-[#01c509] hover:bg-[#01c509]/5 transition-all duration-300 shadow-sm hover:shadow-md flex items-center justify-center rounded-lg;
    height: 3.5rem;
    width: 100%;
    max-width: 100%;
    @media (min-width: 640px) {
      min-width: 260px;
      width: auto;
    }
  }

  /* Center all headings */
  .heading-centered {
    @apply text-center relative inline-block pb-2;
  }

  .heading-centered::after {
    content: "";
    @apply absolute bottom-0 left-0 w-full h-1 bg-[#01c509] rounded-full;
  }

  /* Uniform card heights */
  .card-equal-height {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .card-body {
    flex: 1 1 auto;
  }

  .card-footer {
    margin-top: auto;
  }

  /* Improved contact links */
  .contact-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    background-color: white;
  }

  .contact-link:hover {
    border-color: rgba(1, 197, 9, 0.2);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }

  .contact-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background-color: rgba(1, 197, 9, 0.1);
    margin-right: 1rem;
    flex-shrink: 0;
  }

  .contact-link-text {
    flex: 1;
    text-align: center;
    font-weight: 500;
    font-size: 1.125rem;
    color: #1f2937;
  }

  /* Logo styles for responsive design */
  .logo-container {
    height: 2.5rem;
    display: flex;
    align-items: center;
  }

  .logo-svg {
    height: 100%;
    width: auto;
    max-width: 100%;
  }

  /* Responsive container padding */
  .container {
    @apply px-4 md:px-6 lg:px-8;
  }

  /* Responsive grid system */
  .responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1.5rem;
  }

  /* Responsive flex layouts */
  .responsive-flex {
    @apply flex flex-col sm:flex-row;
  }

  /* Responsive spacing */
  .section-spacing {
    @apply py-8 md:py-12 lg:py-16;
  }

  /* Responsive images */
  .responsive-img {
    max-width: 100%;
    height: auto;
  }

  /* Form elements */
  .form-input {
    @apply w-full px-4 py-3 bg-white border border-zinc-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#01c509]/50 focus:border-transparent transition-all duration-200;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Improved responsive text sizing */
  .responsive-text-xs {
    font-size: clamp(0.75rem, 1vw, 0.875rem);
  }

  .responsive-text-sm {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
  }

  .responsive-text-base {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
  }

  .responsive-text-lg {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
  }

  .responsive-text-xl {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  }

  .responsive-text-2xl {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
  }

  /* Improved responsive spacing */
  .responsive-p {
    padding: clamp(0.5rem, 2vw, 1.5rem);
  }

  .responsive-px {
    padding-left: clamp(0.5rem, 2vw, 1.5rem);
    padding-right: clamp(0.5rem, 2vw, 1.5rem);
  }

  .responsive-py {
    padding-top: clamp(0.5rem, 2vw, 1.5rem);
    padding-bottom: clamp(0.5rem, 2vw, 1.5rem);
  }

  .responsive-m {
    margin: clamp(0.5rem, 2vw, 1.5rem);
  }

  .responsive-mx {
    margin-left: clamp(0.5rem, 2vw, 1.5rem);
    margin-right: clamp(0.5rem, 2vw, 1.5rem);
  }

  .responsive-my {
    margin-top: clamp(0.5rem, 2vw, 1.5rem);
    margin-bottom: clamp(0.5rem, 2vw, 1.5rem);
  }

  /* Improved responsive grid */
  .responsive-grid-1-2-3 {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
  }

  @media (min-width: 640px) {
    .responsive-grid-1-2-3 {
      grid-template-columns: repeat(2, 1fr);
    }
  }

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

  /* Improved responsive flex */
  .responsive-flex-col-row {
    display: flex;
    flex-direction: column;
  }

  @media (min-width: 640px) {
    .responsive-flex-col-row {
      flex-direction: row;
    }
  }

  /* Improved section spacing */
  .section-spacing-responsive {
    padding-top: clamp(2rem, 5vw, 4rem);
    padding-bottom: clamp(2rem, 5vw, 4rem);
  }

  /* Improved card padding */
  .card-padding-responsive {
    padding: clamp(1rem, 3vw, 2rem);
  }

  /* Improved button sizing */
  .button-responsive {
    height: clamp(2.5rem, 4vw, 3.5rem);
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
    font-size: clamp(0.875rem, 1.2vw, 1rem);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .header-logo {
    order: -1;
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }

  .header-content {
    flex-direction: column;
    align-items: center;
  }

  .pricing-card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .pricing-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .pricing-card-footer {
    margin-top: auto;
  }

  .contact-button {
    width: 100%;
    min-width: 100%;
  }

  .logo-container {
    height: 2rem;
  }

  /* Improved contact links for mobile */
  .contact-link {
    flex-direction: column;
    padding: 1rem;
    text-align: center;
  }

  .contact-link-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  .contact-link-text {
    font-size: 0.875rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Ensure form elements are properly sized */
  input,
  textarea,
  select,
  button {
    font-size: 16px !important; /* Prevents zoom on iOS */
    max-width: 100%;
  }

  /* Adjust grid gaps */
  .grid {
    gap: 1rem;
  }

  /* Ensure buttons are properly sized */
  .button-primary,
  .button-secondary {
    width: 100%;
  }

  /* Reduce padding on mobile */
  .section-spacing {
    @apply py-6 md:py-12;
  }

  /* Adjust card padding */
  .card,
  .card-content {
    padding: 1rem;
  }
}

/* Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Improve focus styles for accessibility */
:focus-visible {
  outline: 2px solid #01c509;
  outline-offset: 2px;
}

/* Fix for iOS input zoom */
@supports (-webkit-touch-callout: none) {
  input,
  textarea,
  select,
  button {
    font-size: 16px !important;
  }
}

/* Prevent content overflow */
.overflow-fix {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Responsive table styles */
table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
  @media (min-width: 768px) {
    display: table;
  }
}

/* Ensure images don't overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Ensure SVGs scale properly */
svg {
  max-width: 100%;
}

/* Ensure iframes are responsive */
iframe {
  max-width: 100%;
  border: 0;
}

/* Ensure proper spacing between sections */
section + section {
  margin-top: 1rem;
  @media (min-width: 768px) {
    margin-top: 2rem;
  }
}

/* Ensure proper spacing at the bottom of the page */
body > main:last-child {
  margin-bottom: 2rem;
  @media (min-width: 768px) {
    margin-bottom: 4rem;
  }
}

