@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@700&family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
  --bg-canvas: #FAF7F0;
  --bg-card: #FFFFFF;
  --text-primary: #1E1810;
  --text-secondary: #7A6A57;
  
  /* Artistic accents */
  --color-coral: #E85D4A;
  --color-ochre: #D4922B;
  --color-sage: #6BAA8C;
  --color-cerulean: #4A90D9;
  --color-violet: #9B7FD4;
  --color-red: #C94040;
  --color-charcoal: #2C2416;
  
  /* UI variables */
  --shadow-sm: 0 2px 8px rgba(44, 36, 22, 0.05);
  --shadow-md: 0 4px 16px rgba(44, 36, 22, 0.08);
  --shadow-lg: 0 10px 30px rgba(44, 36, 22, 0.12);
  --border-color: #EDE8E0;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── BASE RESET ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Page container (scaled up cleanly on desktop, perfect fit on mobile) */
.page-container {
  width: 100%;
  max-width: 480px; /* Mobile focused portrait width */
  padding: 0 16px 80px;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.3px;
}

.artist-title {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 2.2rem;
  color: var(--text-primary);
  text-align: center;
}

/* ── HEADER & BANNER ── */
.header-banner {
  width: 100vw;
  max-width: 480px;
  height: 150px;
  position: relative;
  overflow: hidden;
  margin-top: 0;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
}
.header-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.header-banner::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--bg-canvas));
}

.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -45px;
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
  text-align: center;
}

.profile-logo {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 4px solid var(--bg-canvas);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  background: #FFF;
}
.profile-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 310px;
  margin: 6px auto 12px;
}

.badge-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-coral);
  background: #FFF0EA;
  border: 1px solid #F5D3C4;
  padding: 4px 14px;
  border-radius: 30px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── SECTION STYLING ── */
.section-wrapper {
  margin-bottom: 30px;
}

.section-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-color);
}

/* ── PREMIUM PRODUCT CARDS (MOBILE OPTIMIZED) ── */
.affiliate-card {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(44, 36, 22, 0.04);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.affiliate-card:active {
  transform: scale(0.98);
}

/* Left Accent Stripe */
.affiliate-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
}
.card-coral::before { background-color: var(--color-coral); }
.card-ochre::before { background-color: var(--color-ochre); }
.card-sage::before { background-color: var(--color-sage); }
.card-cerulean::before { background-color: var(--color-cerulean); }
.card-violet::before { background-color: var(--color-violet); }

/* Left Product Image Thumbnail */
.card-image-wrap {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  margin-right: 12px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-color);
}
.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-details {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.card-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-featured {
  background: #FFF0E8;
  color: var(--color-coral);
}
.badge-value {
  background: #EEF7F2;
  color: var(--color-sage);
}
.badge-seen {
  background: #EAF4FC;
  color: var(--color-cerulean);
}

.card-arrow {
  font-size: 1.25rem;
  color: var(--border-color);
  padding-left: 6px;
  transition: var(--transition);
}

.affiliate-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(44, 36, 22, 0.08);
}
.affiliate-card:hover .card-arrow {
  color: var(--text-secondary);
  transform: translateX(2px);
}

/* ── INTERACTIVE PAINT MIXER (MOBILE HERO) ── */
.paint-mixer-widget {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.widget-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mixing-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

/* Circular Paint Palette */
.mixer-palette-view {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFFFFF 0%, #EDE8E0 100%);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.1), var(--shadow-sm);
  border: 4px solid #FBF9F6;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: var(--transition);
}

/* Liquid mixing pool in center */
.mixing-pool {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: #E8DCC4;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.12);
  transition: background-color 0.4s ease;
  position: relative;
}

/* Palette wells (paint blobs) around the edge */
.tube-selection {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.paint-tube {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  border: 3.5px solid #FFF;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}
.paint-tube::after {
  content: '+';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  color: #FFF;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  opacity: 0.6;
}
.paint-tube:active {
  transform: scale(0.85);
}

.tube-red    { background-color: #D93838; }
.tube-blue   { background-color: #1E88E5; }
.tube-yellow { background-color: #FFD600; }
.tube-white  { background-color: #FFFFFF; border-color: #EDE8E0; }
.tube-white::after { color: #8A7A68; text-shadow: none; }
.tube-black  { background-color: #1E1810; }

.mixer-info {
  text-align: center;
  width: 100%;
}

.recipe-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  min-height: 18px;
  margin-bottom: 6px;
}

.mixer-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-mixer {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-mixer-reset {
  background-color: var(--bg-canvas);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-mixer-reset:hover { background-color: #EDE8E0; }
.btn-mixer-apply {
  background-color: var(--color-coral);
  color: #FFF;
}
.btn-mixer-apply:hover { background-color: #D44A38; }

/* ── FREE TOOL CALL TO ACTION ── */
.promo-card {
  background: linear-gradient(135deg, var(--color-charcoal) 0%, #3D3220 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #FFF;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.promo-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,93,74,0.4) 0%, transparent 70%);
}

.promo-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #FFF;
}
.promo-desc {
  font-size: 0.85rem;
  color: #E8E0D5;
  margin-bottom: 16px;
  line-height: 1.4;
}

.promo-cta {
  display: inline-block;
  background-color: var(--color-coral);
  color: #FFF;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(232,93,74,0.3);
  transition: var(--transition);
}
.promo-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(232,93,74,0.4);
}

.promo-tag {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 8px;
  background-color: rgba(255,255,255,0.15);
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── PRESET TEMPLATE ROW ── */
.presets-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.presets-gallery::-webkit-scrollbar { display: none; }

.preset-item {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  background-color: #FFF;
}
.preset-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preset-item:hover, .preset-item.active {
  border-color: var(--color-coral);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ── GUMROAD UPSELL MODAL ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(44, 36, 22, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end; /* Slides up from bottom on mobile */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-card);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px 20px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-artwork-preview {
  width: 120px;
  height: 150px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  object-fit: cover;
  border: 3px solid #FFF;
  transform: rotate(-3deg);
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 20px;
  max-width: 320px;
}

.modal-button-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.btn-modal {
  width: 100%;
  padding: 12px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.btn-modal-primary {
  background-color: var(--color-coral);
  color: #FFF;
  box-shadow: 0 4px 12px rgba(232,93,74,0.3);
}
.btn-modal-primary:hover {
  background-color: #D44A38;
}
.btn-modal-secondary {
  background-color: var(--bg-canvas);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-modal-secondary:hover {
  background-color: #EDE8E0;
}

/* ── QUICK LINKS (LINKTREE STYLE) ── */
.quick-links-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 24px;
}

.quick-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid transparent;
}

.quick-link-btn:active {
  transform: scale(0.97);
}

.quick-link-btn.btn-primary {
  background-color: var(--color-coral);
  color: #FFFFFF;
}

.quick-link-btn.btn-primary:hover {
  background-color: #d64d3a;
  box-shadow: 0 4px 12px rgba(232, 93, 74, 0.25);
}

.quick-link-btn.btn-secondary {
  background-color: var(--color-charcoal);
  color: #FFFFFF;
}

.quick-link-btn.btn-secondary:hover {
  background-color: #3d321f;
  box-shadow: 0 4px 12px rgba(44, 36, 22, 0.2);
}

.quick-link-btn.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.quick-link-btn.btn-outline:hover {
  background-color: #EDE8E0;
}

/* ── MOBILE APP LAYOUT FOR AI-STUDIO ── */
@media (max-width: 767px) {
  /* Hide sidebar on mobile in favor of bottom-tabs / slide drawer */
  .app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  
  .sidebar {
    display: none; /* We toggle sidebar panel with active tabs */
  }

  .main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
  }

  /* Sticky App Header */
  .mobile-app-header {
    background-color: #FFF;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
  }
  .mobile-app-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
  }

  .canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: var(--bg-canvas);
    overflow: hidden;
  }

  canvas {
    max-width: 100%;
    max-height: 70%; /* Reserve space for tools and controls */
    object-fit: contain;
  }

  /* Float manual coloring toolbar at bottom above tabbar */
  .canvas-toolbar {
    background: #FFF;
    border-top: 1px solid var(--border-color);
    padding: 10px;
    display: flex;
    overflow-x: auto;
    gap: 8px;
    width: 100%;
    scrollbar-width: none;
  }
  .canvas-toolbar::-webkit-scrollbar { display: none; }

  /* Mobile bottom tabs navigation */
  .mobile-nav-tabs {
    display: flex;
    background-color: #FFF;
    border-top: 1.5px solid var(--border-color);
    height: 60px;
    z-index: 10;
  }
  
  .nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    gap: 4px;
    transition: var(--transition);
  }
  .nav-tab-icon {
    font-size: 1.1rem;
    line-height: 1;
  }
  .nav-tab.active {
    color: var(--color-coral);
    font-weight: 600;
  }

  /* Overlay panels for settings (Draw, Style, Export) */
  .mobile-panel {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    background: #FFF;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    padding: 16px;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 20;
    display: none;
  }
  .mobile-panel.active {
    display: block;
  }
  
  .mobile-panel .section {
    padding: 0;
    border-bottom: none;
    margin-bottom: 12px;
  }
}

@media (min-width: 768px) {
  .mobile-nav-tabs, .mobile-app-header, .mobile-panel {
    display: none !important;
  }
  
  .modal-overlay {
    align-items: center;
  }
  
  .modal-content {
    border-radius: 24px;
    padding: 30px;
  }
}
