/* ==========================================================================
   ZAHIQ AI - Visual-First Base Styles
   Vercel-Inspired Minimal Design
   ========================================================================== */

/* ==========================================================================
   Reset & Foundation
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--background);
  overflow-x: hidden;
  position: relative;
  width: 100%;
  max-width: 100vw;
}

/* Prevent horizontal scroll on all elements */
* {
  max-width: 100%;
}

/* Allow specific elements to exceed */
.full-width,
section,
.container,
[class*="container"] {
  max-width: none;
}

/* ==========================================================================
   Typography - Minimal Text
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-5xl); font-weight: var(--font-extrabold); }
h2 { font-size: var(--text-4xl); font-weight: var(--font-bold); }
h3 { font-size: var(--text-3xl); font-weight: var(--font-bold); }
h4 { font-size: var(--text-2xl); font-weight: var(--font-semibold); }
h5 { font-size: var(--text-xl); font-weight: var(--font-semibold); }
h6 { font-size: var(--text-lg); font-weight: var(--font-medium); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

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

a:hover {
  opacity: 0.8;
}

/* ==========================================================================
   Gradient Text
   ========================================================================== */

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.gradient-text-animated {
  background: var(--gradient-animated);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

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

/* ==========================================================================
   Visual Containers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
  box-sizing: border-box;
}

/* Ensure sections don't cause horizontal scroll */
section {
  width: 100%;
  overflow-x: hidden;
  position: relative;
}

.container-sm {
  max-width: var(--container-sm);
}

.container-md {
  max-width: var(--container-md);
}

.container-lg {
  max-width: var(--container-lg);
}

/* ==========================================================================
   Cards - Visual Focus
   ========================================================================== */

.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  transition: var(--transition-all);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-large);
}

.card-interactive {
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.card-interactive:hover {
  transform: rotateY(5deg) rotateX(5deg) translateZ(10px);
}

/* Glass Card */
.card-glass {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Gradient Border Card */
.card-gradient-border {
  background: var(--white);
  position: relative;
  padding: 2px;
}

.card-gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  border-radius: inherit;
  z-index: -1;
}

.card-gradient-border-content {
  background: var(--background);
  border-radius: calc(var(--card-radius) - 2px);
  padding: var(--card-padding);
  height: 100%;
}

/* ==========================================================================
   Buttons - Visual Priority
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--button-height);
  padding: var(--button-padding);
  font-size: var(--button-font-size);
  font-weight: var(--button-font-weight);
  border-radius: var(--button-radius);
  border: none;
  cursor: pointer;
  transition: var(--transition-all);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-decoration: none;
}

/* Primary - Gradient */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--background);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-blue);
}

/* Secondary - Outline */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-primary);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface);
}

/* Icon Button */
.btn-icon {
  width: var(--button-height);
  padding: 0;
  border-radius: var(--radius-full);
}

/* Magnetic Button Effect */
.btn-magnetic {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Pills & Badges - Visual Elements
   ========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--pill-height);
  padding: var(--pill-padding);
  font-size: var(--pill-font-size);
  font-weight: var(--font-medium);
  border-radius: var(--pill-radius);
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.pill-gradient {
  background: var(--gradient-primary);
  color: var(--background);
  border: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: var(--font-semibold);
  border-radius: var(--radius-sm);
  background: var(--gradient-accent);
  color: var(--background);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ==========================================================================
   Metric Pills - Visual Data
   ========================================================================== */

.metric-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition-all);
}

.metric-pill:hover {
  background: var(--background);
  box-shadow: var(--shadow-medium);
  transform: translateY(-2px);
}

.metric-number {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ==========================================================================
   Visual Elements - Charts & Graphs
   ========================================================================== */

.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.chart-canvas {
  width: 100%;
  height: 100%;
}

/* Progress Bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: inherit;
  transition: width 1s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
  0% { transform: translateX(-100px); }
  100% { transform: translateX(100px); }
}

/* ==========================================================================
   Loading States & Skeletons
   ========================================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   Interactive Elements
   ========================================================================== */

/* Custom Cursor */
.custom-cursor {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: var(--z-max);
  transition: transform 0.2s ease;
  mix-blend-mode: difference;
}

.custom-cursor.active {
  transform: scale(1.5);
  background: var(--primary);
}

/* Hover Reveal */
.hover-reveal {
  position: relative;
  overflow: hidden;
}

.hover-reveal-content {
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  color: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-opacity);
}

.hover-reveal:hover .hover-reveal-content {
  opacity: 1;
}

/* Tilt on Hover */
.tilt-hover {
  transform-style: preserve-3d;
  transform: perspective(1000px);
  transition: transform 0.3s;
}

/* Magnetic Effect */
.magnetic {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Fade In */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slide Up */
@keyframes slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Scale In */
@keyframes scale-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* Pulse */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Spin */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Animation Classes */
.animate-fade-in { animation: fade-in 0.5s ease; }
.animate-slide-up { animation: slide-up 0.5s ease; }
.animate-scale-in { animation: scale-in 0.5s ease; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin { animation: spin 2s linear infinite; }

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

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flexbox */
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Spacing */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: var(--font-bold); }
.font-medium { font-weight: var(--font-medium); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

/* Colors */
.text-gray { color: var(--text-secondary); }
.text-black { color: var(--text-primary); }
.bg-white { background: var(--background); }
.bg-gray { background: var(--surface); }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Border Radius */
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* ==========================================================================
   Media - Images & Videos
   ========================================================================== */

/* Responsive Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Video Containers */
.video-container,
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-container iframe,
.video-container video,
.video-container embed,
.video-wrapper iframe,
.video-wrapper video,
.video-wrapper embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Responsive Embeds */
embed,
iframe,
object,
video {
  max-width: 100%;
}

/* Video Placeholder */
.video-placeholder {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 0;
}

.video-placeholder iframe,
.video-placeholder video,
.video-placeholder embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Image Gallery */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
  width: 100%;
}

.image-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

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

@media (max-width: 1024px) {
  .image-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
  }
}

@media (max-width: 768px) {
  .md\:hidden { display: none !important; }
  .container { padding: 0 var(--space-4); }

  .image-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-2);
  }

  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }

  /* Prevent text overflow */
  p, span, div, li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* Ensure all containers respect viewport width */
  [class*="container"],
  [class*="-section"] {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

@media (max-width: 640px) {
  .image-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .sm\:hidden { display: none !important; }
  .container { padding: 0 var(--space-3); }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  /* Extra small screen overflow protection */
  body {
    min-width: 320px;
  }

  [class*="container"] {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}