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

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

@layer base {
  :root {
    /* Color Palette */
    --bg-primary: #1a1a1a;
    --bg-secondary: #262626;
    --bg-tertiary: #2d2d2d;
    --bg-card: #374151;
    
    --text-primary: #ffffff;
    --text-secondary: #dddddd;
    --text-muted: #dddddd;
    
    --accent-blue: #3b82f6;
    --accent-purple: #6366f1;
    --accent-teal: #14b8a6;
    
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  }

  html {
    scroll-behavior: smooth;
  }
  
  body {
    background: #d3d3d3 !important;
    color: #000000 !important;
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.7;
    font-weight: 400;
    min-height: 100vh;
    margin: 0 !important;
  }
  
  /* Enhanced Typography Hierarchy */
  h1 {
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: #000000 !important;
  }

  h2 {
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    color: #000000 !important;
  }

  h3 {
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: #000000 !important;
  }
  
  p {
    line-height: 1.7;
    color: #000000 !important;
  }
  
  .text-primary {
    color: var(--text-primary);
  }
  
  .text-secondary {
    color: var(--text-secondary);
  }
  
  .text-muted {
    color: var(--text-muted);
  }
}

@layer components {
  /* Enhanced Scroll Animations */
  .section-fade {
    opacity: 1;
    transform: translateY(0);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .section-fade.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  .fade-in-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  .fade-in-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
  }
  
  .fade-in-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
  }
  
  /* Staggered animations */
  .stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .stagger-item:nth-child(1) { transition-delay: 0.1s; }
  .stagger-item:nth-child(2) { transition-delay: 0.2s; }
  .stagger-item:nth-child(3) { transition-delay: 0.3s; }
  .stagger-item:nth-child(4) { transition-delay: 0.4s; }
  .stagger-item:nth-child(5) { transition-delay: 0.5s; }
  
  .stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  .gradient-text {
    color: #000000 !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
  }
  
  /* Modern Button Styles */
  .btn-primary {
    background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
    color: var(--text-primary);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    padding: 0.875rem 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.3);
  }
  
  .btn-primary:hover {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    box-shadow: 0 8px 25px 0 rgba(0, 0, 0, 0.4);
    transform: translateY(-3px);
  }
  
  .btn-secondary {
    background: transparent;
    color: #000000 !important;
    border: 2px solid #6b7280;
    border-radius: 10px;
    font-weight: 600;
    padding: 0.875rem 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .btn-secondary:hover {
    border-color: #9ca3af;
    color: #000000 !important;
    background: rgba(107, 114, 128, 0.15);
    transform: translateY(-2px);
  }
  
  .btn-accent {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    padding: 0.875rem 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.4);
  }
  
  .btn-accent:hover {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    box-shadow: 0 8px 25px 0 rgba(59, 130, 246, 0.5);
    transform: translateY(-3px);
  }
  
  /* Enhanced Spacing System - 8px Grid */
  .section-spacing {
    padding-top: 8rem;
    padding-bottom: 8rem;
  }
  
  /* Section spacing improvements */
  section {
    margin-bottom: 4rem;
  }

  .hero-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .contact-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
    margin-bottom: 4rem;
  }

  .case-studies-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .content-spacing {
    margin-bottom: 3rem;
  }
  
  .element-spacing {
    margin-bottom: 1.5rem;
  }
  
  /* Professional 8px Grid System */
  .spacing-xs { margin: 0.5rem; }    /* 8px */
  .spacing-sm { margin: 1rem; }      /* 16px */
  .spacing-md { margin: 1.5rem; }    /* 24px */
  .spacing-lg { margin: 2rem; }      /* 32px */
  .spacing-xl { margin: 3rem; }      /* 48px */
  .spacing-2xl { margin: 4rem; }     /* 64px */
  
  /* Consistent Content Container */
  .content-container {
    max-width: 1000px;
    margin: 0 auto;
    padding-left: 3rem;
    padding-right: 3rem;
  }
  
  /* Consistent gap system */
  .gap-professional { gap: 1.5rem; }
  .gap-sections { gap: 2rem; }
  .button-group-spacing { gap: 1.5rem; }
  
  /* Modern Section Dividers */
  .section-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--border-subtle) 50%, transparent 100%);
    margin: 4rem 0;
  }
  
  /* Enhanced Section Backgrounds */
  .section-gradient-1 {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1f1f1f 50%, var(--bg-secondary) 100%);
  }
  
  .section-gradient-2 {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #222222 50%, var(--bg-tertiary) 100%);
  }
  
  .section-gradient-3 {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, #242424 50%, var(--bg-primary) 100%);
  }
  
  /* Subtle background patterns */
  .pattern-dots::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
  }
  
  /* Modern Card Design */
  .card-hover {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
      0 4px 6px -1px rgba(0, 0, 0, 0.1),
      0 2px 4px -1px rgba(0, 0, 0, 0.06),
      0 0 0 1px rgba(255, 255, 255, 0.05);
    color: #dddddd;
  }
  
  .card-hover h3 {
    color: var(--text-primary);
  }
  
  .card-hover p {
    color: #dddddd;
  }
  
  .card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
      0 25px 50px -12px rgba(0, 0, 0, 0.4),
      0 10px 20px -5px rgba(0, 0, 0, 0.2),
      0 0 0 1px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  .contact-card {
    background: #f0f0f0 !important;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow:
      0 4px 8px -2px rgba(0, 0, 0, 0.1),
      0 2px 4px -1px rgba(0, 0, 0, 0.05);
    color: #000000 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 250px !important;
    height: 250px !important;
    margin: 0 auto;
  }
  
  .contact-card h3 {
    color: var(--text-primary);
  }
  
  .contact-card p {
    color: #dddddd;
  }
  
  .contact-card:hover {
    transform: translateY(-6px);
    box-shadow: 
      0 25px 50px -12px rgba(0, 0, 0, 0.4),
      0 12px 24px -6px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
  }
  
  .icon-container {
    background: linear-gradient(135deg, #888888 0%, #666666 100%);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .icon-container:hover {
    /* No hover animations */
  }
  
  /* Enhanced Navigation Design */
  .nav-enhanced {
    background: rgba(26, 26, 26, 0.95) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .nav-content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .nav-links-container {
    display: flex !important;
    gap: 2rem !important;
    align-items: center !important;
  }

  .nav-link {
    position: relative;
    color: #d1d5db !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500 !important;
    text-decoration: none !important;
  }

  .nav-link:hover {
    color: #ffffff !important;
    transform: translateY(-1px);
  }

  .nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px;
  }

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

  .nav-logo {
    position: relative;
    font-weight: 600 !important;
    color: #ffffff !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.25rem !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
  }

  .nav-logo img {
    width: 2rem !important;
    height: 2rem !important;
    flex-shrink: 0 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-logo:hover {
    transform: translateY(-1px) scale(1.05);
    color: #ffffff !important;
  }

  .nav-logo:hover img {
    transform: scale(1.1);
  }

  .nav-logo::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px;
  }

  .nav-logo:hover::after {
    width: 100%;
  }
  
  /* Mobile menu enhanced */
  .mobile-menu-btn {
    display: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #ffffff;
  }

  .mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  /* Mobile-specific navigation styles */
  @media (max-width: 999px) {
    /* Hide name text on mobile */
    .nav-logo-text {
      display: none;
    }

    /* Show hamburger button on mobile */
    .mobile-menu-btn {
      display: block;
    }

    /* Hide navigation links by default on mobile */
    .nav-links-container {
      position: fixed;
      top: 4rem;
      right: 0;
      background: rgba(26, 26, 26, 0.98);
      backdrop-filter: blur(20px);
      border-left: 1px solid rgba(255, 255, 255, 0.1);
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      padding: 1.5rem;
      flex-direction: column;
      gap: 1rem !important;
      box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.3);
      transform: translateX(100%);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      min-width: 200px;
      z-index: 100;
    }

    /* Show mobile menu when open */
    .nav-links-container.mobile-menu-open {
      transform: translateX(0);
    }

    /* Style links in mobile menu */
    .nav-links-container .nav-link {
      padding: 0.5rem 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links-container .nav-link:last-child {
      border-bottom: none;
    }
  }

  /* Desktop navigation - show everything */
  @media (min-width: 1000px) {
    .nav-logo-text {
      display: inline;
    }

    .mobile-menu-btn {
      display: none;
    }

    .nav-links-container {
      display: flex !important;
      position: static;
      background: transparent;
      border: none;
      padding: 0;
      transform: none;
      box-shadow: none;
    }
  }
  
  /* Performance-Optimized Animations */
  .float-animation {
    animation: float 6s ease-in-out infinite;
  }
  
  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
  }
  
  .pulse-subtle {
    animation: pulse-subtle 4s ease-in-out infinite;
  }
  
  @keyframes pulse-subtle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
  }
  
  .glow-on-hover {
    position: relative;
    overflow: hidden;
  }
  
  .glow-on-hover::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple), var(--accent-teal));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
    filter: blur(8px);
  }
  
  .glow-on-hover:hover::before {
    opacity: 0.3;
  }
  
  /* Accessibility and Performance */
  @media (prefers-reduced-motion: reduce) {
    .section-fade,
    .fade-in-up,
    .fade-in-left,
    .fade-in-right,
    .stagger-item {
      opacity: 1 !important;
      transform: none !important;
      transition: none !important;
    }
    
    .float-animation,
    .pulse-subtle {
      animation: none;
    }
  }
  
  /* Force hardware acceleration for smooth animations */
  .card-hover,
  .btn-primary,
  .btn-secondary,
  .btn-accent,
  .nav-link,
  .icon-container {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
  }
  
  /* Override any colored backgrounds */
  .bg-blue-600, .bg-blue-700, .bg-purple-600, .bg-purple-700,
  .bg-green-600, .bg-teal-600, .bg-pink-600 {
    background-color: #374151 !important;
  }
  
  .bg-blue-600:hover, .bg-blue-700:hover, .bg-purple-600:hover, .bg-purple-700:hover,
  .bg-green-600:hover, .bg-teal-600:hover, .bg-pink-600:hover {
    background-color: #4b5563 !important;
  }
  
  /* Override gradient backgrounds */
  .bg-gradient-to-br, .bg-gradient-to-r {
    background: #262626 !important;
  }
  
  /* Override text colors */
  .text-blue-100, .text-purple-100, .text-green-100, 
  .text-teal-100, .text-pink-100, .text-cyan-100,
  .text-yellow-100, .text-orange-100, .text-red-100,
  .text-lg, .text-xl, .text-2xl {
    color: #dddddd !important;
  }
  
  /* Ensure hero section text is properly colored */
  .hero-section p {
    color: #dddddd !important;
  }
  
  /* Ensure proper SVG sizing */
  svg {
    flex-shrink: 0;
  }
  
  /* Override any text color issues globally */
  p[style*="color: #9ca3af;"] {
    color: #9ca3af !important;
  }

  p[style*="color: #d1d5db;"] {
    color: #d1d5db !important;
  }

  h3[style*="color: #f9fafb;"] {
    color: #f9fafb !important;
  }

  h2[style*="color: #f9fafb;"] {
    color: #f9fafb !important;
  }

  h1[style*="color: #f9fafb;"] {
    color: #f9fafb !important;
  }

  [style*="color: #f9fafb;"] {
    color: #f9fafb !important;
  }

  /* Force list item colors */
  #privacy-policy ul li,
  ul[style*="color: #9ca3af;"] li {
    color: #9ca3af !important;
  }

  /* Force strong tag colors */
  strong {
    color: #000000 !important;
  }

  /* Override section backgrounds for light theme */
  .bg-gray-800, .bg-gray-900, section[class*="bg-gray"] {
    background-color: #e8e8e8 !important;
  }

  /* Override card backgrounds */
  .contact-card, .card-hover {
    background: #f0f0f0 !important;
    color: #000000 !important;
    padding: 30px !important;
    margin: 15px !important;
  }

  .contact-card h3, .card-hover h3 {
    color: #000000 !important;
  }

  .contact-card p, .card-hover p {
    color: #333333 !important;
  }

  /* Consistent button text size for contact cards */
  .contact-card .btn-primary,
  .contact-card .btn-secondary,
  .contact-card .btn-accent {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
  }

  /* Ensure contact grid works properly */
  .contact-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    justify-items: center !important;
  }

  @media (min-width: 768px) {
    .contact-grid {
      grid-template-columns: repeat(3, 1fr) !important;
    }
  }
  
  /* Project Card Responsive Layout */
  .project-card {
    display: flex;
    padding: 0 !important;
  }

  .project-card-content {
    flex: 2;
    padding: 30px;
  }

  .project-card-image {
    flex: 1;
    background-color: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
  }

  /* Mobile layout for screens < 1000px */
  @media (max-width: 999px) {
    .project-card {
      flex-direction: column;
    }

    .project-card-image {
      width: 100%;
      height: 12rem;
      border-top-right-radius: 0;
      border-bottom-left-radius: 0.5rem;
      border-bottom-right-radius: 0.5rem;
    }
  }

  /* Desktop layout for screens >= 1000px */
  @media (min-width: 1000px) {
    .project-card {
      flex-direction: row;
    }

    .project-card-image {
      width: auto;
      height: auto;
    }
  }

  /* Responsive spacing improvements */
  @media (max-width: 640px) {
    [style*="padding-left: 2rem"] {
      padding-left: 1rem !important;
      padding-right: 1rem !important;
    }
    [style*="padding-left: 3rem"] {
      padding-left: 1.5rem !important;
      padding-right: 1.5rem !important;
    }
  }
  
  @media (min-width: 1280px) {
    [style*="padding-left: 2rem"] {
      padding-left: 3rem !important;
      padding-right: 3rem !important;
    }
    [style*="padding-left: 3rem"] {
      padding-left: 4rem !important;
      padding-right: 4rem !important;
    }
  }
  
  /* Ensure all content containers are properly centered with generous margins */
  [style*="max-width"][style*="margin: 0 auto"] {
    margin-left: auto !important;
    margin-right: auto !important;
  }
  
  /* Force proper SVG sizing */
  svg[style*="width: 32px"] {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    flex-shrink: 0 !important;
  }
  
  /* Override any Tailwind SVG sizing classes */
  .w-4.h-4, .w-6.h-6, .w-8.h-8, .w-16.h-16 {
    flex-shrink: 0 !important;
  }
  
  .w-4 { width: 1rem !important; }
  .h-4 { height: 1rem !important; }
  .w-6 { width: 1.5rem !important; }
  .h-6 { height: 1.5rem !important; }
  .w-8 { width: 2rem !important; }
  .h-8 { height: 2rem !important; }
  .w-16 { width: 4rem !important; }
  .h-16 { height: 4rem !important; }
}

/* Smooth scrolling for anchor links */
[id] {
  scroll-margin-top: 2rem;
}