/* ==========================================================================
   NailVision Studio — Premium Design System
   ========================================================================== */

:root {
  /* Brand palette */
  --nv-white: #faf9f7;
  --nv-white-soft: #f5f3f0;
  --nv-blush: #f4d4d8;
  --nv-blush-light: #fce8ec;
  --nv-blush-deep: #e8b4bc;
  --nv-rose-gold: #b76e79;
  --nv-rose-gold-light: #d4a5a5;
  --nv-rose-gold-dark: #8b4a52;
  --nv-black: #1a1a1a;
  --nv-black-soft: #2d2d2d;
  --nv-gray-100: #f0eeeb;
  --nv-gray-200: #e0ddd8;
  --nv-gray-300: #c4c0b8;
  --nv-gray-500: #8a8580;
  --nv-gray-700: #5c5854;

  /* Semantic */
  --nv-primary: var(--nv-rose-gold);
  --nv-primary-hover: var(--nv-rose-gold-dark);
  --nv-accent: var(--nv-blush);
  --nv-bg: var(--nv-white);
  --nv-surface: rgba(255, 255, 255, 0.72);
  --nv-text: var(--nv-black);
  --nv-text-muted: var(--nv-gray-500);
  --nv-border: rgba(183, 110, 121, 0.18);
  --nv-success: #4a9b6e;
  --nv-warning: #d4a03c;
  --nv-error: #c45c5c;
  --nv-info: #6b8cae;

  /* Glassmorphism */
  --nv-glass-bg: rgba(250, 249, 247, 0.65);
  --nv-glass-border: rgba(255, 255, 255, 0.45);
  --nv-glass-shadow: 0 8px 32px rgba(26, 26, 26, 0.08);
  --nv-glass-blur: 16px;

  /* Typography */
  --nv-font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --nv-font-display: 'Playfair Display', Georgia, serif;
  --nv-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --nv-text-xs: 0.75rem;
  --nv-text-sm: 0.875rem;
  --nv-text-base: 1rem;
  --nv-text-lg: 1.125rem;
  --nv-text-xl: 1.25rem;
  --nv-text-2xl: 1.5rem;
  --nv-text-3xl: 2rem;
  --nv-text-4xl: 2.5rem;
  --nv-leading-tight: 1.25;
  --nv-leading-normal: 1.5;
  --nv-leading-relaxed: 1.75;

  /* Spacing */
  --nv-space-1: 0.25rem;
  --nv-space-2: 0.5rem;
  --nv-space-3: 0.75rem;
  --nv-space-4: 1rem;
  --nv-space-5: 1.25rem;
  --nv-space-6: 1.5rem;
  --nv-space-8: 2rem;
  --nv-space-10: 2.5rem;
  --nv-space-12: 3rem;
  --nv-space-16: 4rem;

  /* Layout */
  --nv-radius-sm: 6px;
  --nv-radius: 12px;
  --nv-radius-lg: 20px;
  --nv-radius-xl: 28px;
  --nv-radius-full: 9999px;
  --nv-container: 1200px;
  --nv-header-height: 72px;

  /* Motion */
  --nv-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --nv-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --nv-duration-fast: 150ms;
  --nv-duration: 250ms;
  --nv-duration-slow: 400ms;

  /* Shadows */
  --nv-shadow-sm: 0 1px 3px rgba(26, 26, 26, 0.06);
  --nv-shadow: 0 4px 16px rgba(26, 26, 26, 0.08);
  --nv-shadow-lg: 0 12px 40px rgba(26, 26, 26, 0.12);
  --nv-shadow-glow: 0 0 24px rgba(183, 110, 121, 0.25);

  /* Z-index */
  --nv-z-dropdown: 100;
  --nv-z-sticky: 200;
  --nv-z-header: 300;
  --nv-z-modal: 400;
  --nv-z-toast: 500;
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--nv-font-sans);
  font-size: var(--nv-text-base);
  line-height: var(--nv-leading-normal);
  color: var(--nv-text);
  background: var(--nv-bg);
  min-height: 100vh;
}

img, video, canvas { max-width: 100%; height: auto; display: block; }

a {
  color: var(--nv-primary);
  text-decoration: none;
  transition: color var(--nv-duration-fast) var(--nv-ease);
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--nv-font-display);
  font-weight: 600;
  line-height: var(--nv-leading-tight);
  margin: 0 0 var(--nv-space-4);
}

/* Glassmorphism */
.nv-glass {
  background: var(--nv-glass-bg);
  backdrop-filter: blur(var(--nv-glass-blur));
  -webkit-backdrop-filter: blur(var(--nv-glass-blur));
  border: 1px solid var(--nv-glass-border);
  box-shadow: var(--nv-glass-shadow);
}

.nv-glass-dark {
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(var(--nv-glass-blur));
  -webkit-backdrop-filter: blur(var(--nv-glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--nv-white);
}

/* Container */
.nv-container {
  width: 100%;
  max-width: var(--nv-container);
  margin-inline: auto;
  padding-inline: var(--nv-space-4);
}

@media (min-width: 768px) {
  .nv-container { padding-inline: var(--nv-space-6); }
}

/* Buttons */
.nv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--nv-space-2);
  padding: var(--nv-space-3) var(--nv-space-6);
  font-family: inherit;
  font-size: var(--nv-text-sm);
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--nv-radius-full);
  cursor: pointer;
  transition: all var(--nv-duration) var(--nv-ease);
  text-decoration: none;
}

.nv-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nv-btn-primary {
  background: linear-gradient(135deg, var(--nv-rose-gold), var(--nv-rose-gold-dark));
  color: var(--nv-white);
  box-shadow: var(--nv-shadow-sm);
}

.nv-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--nv-shadow-glow);
}

.nv-btn-secondary {
  background: var(--nv-blush-light);
  color: var(--nv-rose-gold-dark);
}

.nv-btn-secondary:hover:not(:disabled) {
  background: var(--nv-blush);
}

.nv-btn-ghost {
  background: transparent;
  color: var(--nv-text);
  border: 1px solid var(--nv-border);
}

.nv-btn-ghost:hover:not(:disabled) {
  background: var(--nv-blush-light);
  border-color: var(--nv-rose-gold-light);
}

.nv-btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--nv-radius);
}

.nv-btn-sm {
  padding: var(--nv-space-2) var(--nv-space-4);
  font-size: var(--nv-text-xs);
}

.nv-btn-lg {
  padding: var(--nv-space-4) var(--nv-space-8);
  font-size: var(--nv-text-lg);
}

/* Cards */
.nv-card {
  background: var(--nv-white);
  border-radius: var(--nv-radius-lg);
  border: 1px solid var(--nv-border);
  overflow: hidden;
  transition: transform var(--nv-duration) var(--nv-ease), box-shadow var(--nv-duration) var(--nv-ease);
}

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

.nv-card-body { padding: var(--nv-space-6); }

.nv-card-glass {
  background: var(--nv-glass-bg);
  backdrop-filter: blur(var(--nv-glass-blur));
  -webkit-backdrop-filter: blur(var(--nv-glass-blur));
  border: 1px solid var(--nv-glass-border);
  border-radius: var(--nv-radius-lg);
}

/* Forms */
.nv-input,
.nv-select,
.nv-textarea {
  width: 100%;
  padding: var(--nv-space-3) var(--nv-space-4);
  font-family: inherit;
  font-size: var(--nv-text-base);
  color: var(--nv-text);
  background: var(--nv-white);
  border: 1px solid var(--nv-gray-200);
  border-radius: var(--nv-radius);
  transition: border-color var(--nv-duration-fast) var(--nv-ease), box-shadow var(--nv-duration-fast) var(--nv-ease);
}

.nv-input:focus,
.nv-select:focus,
.nv-textarea:focus {
  outline: none;
  border-color: var(--nv-rose-gold-light);
  box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.15);
}

.nv-label {
  display: block;
  font-size: var(--nv-text-sm);
  font-weight: 600;
  margin-bottom: var(--nv-space-2);
  color: var(--nv-text);
}

.nv-form-group { margin-bottom: var(--nv-space-4); }

/* Flash messages */
.nv-flash {
  padding: var(--nv-space-4) var(--nv-space-6);
  border-radius: var(--nv-radius);
  margin-bottom: var(--nv-space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nv-space-4);
  animation: nv-slide-down var(--nv-duration-slow) var(--nv-ease);
}

.nv-flash-success { background: rgba(74, 155, 110, 0.12); color: var(--nv-success); border: 1px solid rgba(74, 155, 110, 0.3); }
.nv-flash-error { background: rgba(196, 92, 92, 0.12); color: var(--nv-error); border: 1px solid rgba(196, 92, 92, 0.3); }
.nv-flash-warning { background: rgba(212, 160, 60, 0.12); color: var(--nv-warning); border: 1px solid rgba(212, 160, 60, 0.3); }
.nv-flash-info { background: rgba(107, 140, 174, 0.12); color: var(--nv-info); border: 1px solid rgba(107, 140, 174, 0.3); }

.nv-flash-dismiss {
  background: none;
  border: none;
  font-size: var(--nv-text-xl);
  cursor: pointer;
  opacity: 0.6;
  line-height: 1;
  padding: 0;
  color: inherit;
}

.nv-flash-dismiss:hover { opacity: 1; }

/* Skeleton loading */
.nv-skeleton {
  background: linear-gradient(
    90deg,
    var(--nv-gray-100) 25%,
    var(--nv-gray-200) 50%,
    var(--nv-gray-100) 75%
  );
  background-size: 200% 100%;
  animation: nv-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--nv-radius-sm);
}

.nv-skeleton-text {
  height: 1em;
  margin-bottom: var(--nv-space-2);
}

.nv-skeleton-text:last-child { width: 70%; }

.nv-skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--nv-radius-full);
}

.nv-skeleton-card {
  height: 200px;
  border-radius: var(--nv-radius-lg);
}

.nv-skeleton-circle {
  border-radius: var(--nv-radius-full);
}

/* Grid utilities */
.nv-grid {
  display: grid;
  gap: var(--nv-space-6);
}

.nv-grid-2 { grid-template-columns: repeat(2, 1fr); }
.nv-grid-3 { grid-template-columns: repeat(3, 1fr); }
.nv-grid-4 { grid-template-columns: repeat(4, 1fr); }

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

@media (max-width: 768px) {
  .nv-grid-3, .nv-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .nv-grid-2, .nv-grid-3, .nv-grid-4 { grid-template-columns: 1fr; }
}

/* Flex utilities */
.nv-flex { display: flex; }
.nv-flex-col { flex-direction: column; }
.nv-flex-wrap { flex-wrap: wrap; }
.nv-items-center { align-items: center; }
.nv-items-start { align-items: flex-start; }
.nv-items-end { align-items: flex-end; }
.nv-justify-center { justify-content: center; }
.nv-justify-between { justify-content: space-between; }
.nv-justify-end { justify-content: flex-end; }
.nv-gap-2 { gap: var(--nv-space-2); }
.nv-gap-4 { gap: var(--nv-space-4); }
.nv-gap-6 { gap: var(--nv-space-6); }

/* Spacing utilities */
.nv-mt-4 { margin-top: var(--nv-space-4); }
.nv-mt-8 { margin-top: var(--nv-space-8); }
.nv-mb-4 { margin-bottom: var(--nv-space-4); }
.nv-mb-8 { margin-bottom: var(--nv-space-8); }
.nv-p-4 { padding: var(--nv-space-4); }
.nv-p-6 { padding: var(--nv-space-6); }
.nv-py-8 { padding-block: var(--nv-space-8); }
.nv-px-4 { padding-inline: var(--nv-space-4); }

/* Text utilities */
.nv-text-center { text-align: center; }
.nv-text-muted { color: var(--nv-text-muted); }
.nv-text-sm { font-size: var(--nv-text-sm); }
.nv-text-lg { font-size: var(--nv-text-lg); }
.nv-text-xl { font-size: var(--nv-text-xl); }
.nv-text-2xl { font-size: var(--nv-text-2xl); }
.nv-text-3xl { font-size: var(--nv-text-3xl); }
.nv-font-display { font-family: var(--nv-font-display); }
.nv-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Visibility */
.nv-hidden { display: none !important; }
.nv-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 767px) {
  .nv-hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
  .nv-hide-desktop { display: none !important; }
}

/* Parallax */
.nv-parallax {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Search dropdown */
.nv-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--nv-space-2);
  background: var(--nv-white);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius);
  box-shadow: var(--nv-shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: var(--nv-z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--nv-duration) var(--nv-ease);
}

.nv-search-results.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nv-search-item {
  display: flex;
  align-items: center;
  gap: var(--nv-space-3);
  padding: var(--nv-space-3) var(--nv-space-4);
  cursor: pointer;
  transition: background var(--nv-duration-fast) var(--nv-ease);
}

.nv-search-item:hover,
.nv-search-item.is-active {
  background: var(--nv-blush-light);
}

.nv-search-item img {
  width: 40px;
  height: 40px;
  border-radius: var(--nv-radius-sm);
  object-fit: cover;
}

/* Badge */
.nv-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--nv-space-2);
  font-size: var(--nv-text-xs);
  font-weight: 700;
  background: var(--nv-rose-gold);
  color: var(--nv-white);
  border-radius: var(--nv-radius-full);
}

/* AR viewport */
.nv-ar-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--nv-black);
  border-radius: var(--nv-radius-lg);
  overflow: hidden;
}

.nv-ar-canvas,
.nv-ar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nv-ar-controls {
  position: absolute;
  bottom: var(--nv-space-4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--nv-space-3);
  padding: var(--nv-space-3);
  border-radius: var(--nv-radius-full);
  z-index: 10;
}

.nv-ar-compare {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  pointer-events: none;
}

.nv-ar-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--nv-white);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

/* Customizer panel */
.nv-customizer {
  display: grid;
  gap: var(--nv-space-4);
}

.nv-swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-2);
}

.nv-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--nv-radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--nv-duration-fast) var(--nv-ease), border-color var(--nv-duration-fast) var(--nv-ease);
}

.nv-swatch:hover { transform: scale(1.1); }

.nv-swatch.is-active {
  border-color: var(--nv-rose-gold);
  box-shadow: var(--nv-shadow-glow);
}

/* Booking calendar */
.nv-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--nv-space-1);
}

.nv-calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--nv-text-sm);
  border-radius: var(--nv-radius);
  cursor: pointer;
  transition: all var(--nv-duration-fast) var(--nv-ease);
  border: 1px solid transparent;
}

.nv-calendar-day:hover:not(.is-disabled) {
  background: var(--nv-blush-light);
}

.nv-calendar-day.is-selected {
  background: var(--nv-rose-gold);
  color: var(--nv-white);
}

.nv-calendar-day.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nv-calendar-day.is-today {
  border-color: var(--nv-rose-gold-light);
}

.nv-time-slots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-2);
}

.nv-time-slot {
  padding: var(--nv-space-2) var(--nv-space-4);
  font-size: var(--nv-text-sm);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius-full);
  cursor: pointer;
  transition: all var(--nv-duration-fast) var(--nv-ease);
  background: var(--nv-white);
}

.nv-time-slot:hover:not(.is-disabled) {
  border-color: var(--nv-rose-gold);
  background: var(--nv-blush-light);
}

.nv-time-slot.is-selected {
  background: var(--nv-rose-gold);
  color: var(--nv-white);
  border-color: var(--nv-rose-gold);
}

.nv-time-slot.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Animations */
@keyframes nv-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes nv-slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nv-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes nv-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nv-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes nv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

.nv-animate-fade-in { animation: nv-fade-in var(--nv-duration-slow) var(--nv-ease) forwards; }
.nv-animate-slide-up { animation: nv-slide-up var(--nv-duration-slow) var(--nv-ease) forwards; }
.nv-animate-scale-in { animation: nv-scale-in var(--nv-duration-slow) var(--nv-ease-spring) forwards; }

.nv-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--nv-blush);
  border-top-color: var(--nv-rose-gold);
  border-radius: 50%;
  animation: nv-spin 0.8s linear infinite;
}

/* Lazy load */
img[data-src] {
  opacity: 0;
  transition: opacity var(--nv-duration-slow) var(--nv-ease);
}

img[data-src].is-loaded {
  opacity: 1;
}

/* RTL support */
[dir="rtl"] .nv-flash { flex-direction: row-reverse; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print */
@media print {
  .nv-hide-print { display: none !important; }
  body { background: white; color: black; }
}

/* Responsive utilities */
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nv-header-height) + 1rem);
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, video, svg {
  max-width: 100%;
  height: auto;
}

@media (max-width: 639px) {
  :root {
    --nv-header-height: 64px;
  }

  .font-display.text-4xl,
  h2.font-display.text-4xl {
    font-size: 1.875rem;
    line-height: 1.2;
  }

  section {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  :root {
    --nv-header-height: 72px;
  }
}
