/**
 * BILIKIDS COLORING STUDIO - BABIES (3-5 YEARS)
 * Tablet-style Interactive Coloring Experience
 */

:root {
  --primary-brand: #3b82f6;
  --tablet-bg: #111827;
  --tablet-bezel: #1f2937;
  --screen-bg: #ffffff;
  --sidebar-bg: #e0f2fe;
  --sidebar-border: #bae6fd;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Quicksand', 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 50%, #fef3c7 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  color: #1e293b;
}

/* TOP APP HEADER */
.studio-header {
  width: 100%;
  max-width: 1200px;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #0284c7;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
  border: 2px solid #bae6fd;
  transition: all 0.2s ease;
}

.back-btn:hover {
  transform: translateY(-2px);
  background: #f0f9ff;
  border-color: #38bdf8;
}

.studio-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-title {
  font-family: 'Fredoka One', 'Quicksand', cursive;
  font-size: 1.5rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-badge {
  background: #ec4899;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.header-action-btn:hover {
  transform: translateY(-2px);
  background: #f8fafc;
  border-color: #cbd5e1;
}

.header-action-btn.celebrate-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.header-action-btn.celebrate-btn:hover {
  transform: translateY(-2px) scale(1.03);
}

/* TABLET HARDWARE MOCKUP */
.tablet-container {
  width: 100%;
  max-width: 1040px;
  padding: 0 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.tablet-device {
  width: 100%;
  background: var(--tablet-bg);
  border: 12px solid #1f2937;
  border-radius: 40px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Tablet Camera Dot */
.tablet-device::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #374151;
  border-radius: 50%;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Tablet Screen Area */
.tablet-screen {
  width: 100%;
  height: 600px;
  background: var(--screen-bg);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* LEFT SIDEBAR */
.screen-sidebar {
  width: 124px;
  background: var(--sidebar-bg);
  border-right: 2px solid var(--sidebar-border);
  display: flex;
  padding: 12px 6px;
  gap: 6px;
  z-index: 5;
  box-shadow: 2px 0 8px rgba(2, 132, 199, 0.06);
}

/* Tools Column */
.tools-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.tool-btn:hover {
  transform: scale(1.08);
}

.tool-btn.active {
  border-color: #0284c7;
  background: #e0f2fe;
  transform: scale(1.12);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.tool-btn-divider {
  width: 80%;
  height: 2px;
  background: #cbd5e1;
  margin: 4px 0;
  border-radius: 2px;
}

/* Color Column */
.colors-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  overflow-y: auto;
  padding-right: 2px;
}

.colors-column::-webkit-scrollbar {
  width: 3px;
}

.colors-column::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.color-swatch-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  flex-shrink: 0;
}

.color-swatch-btn:hover {
  transform: scale(1.2);
}

.color-swatch-btn.active {
  transform: scale(1.28);
  box-shadow: 0 0 0 3px #0284c7, 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* CANVAS WORKSPACE */
.canvas-workspace {
  flex: 1;
  height: 100%;
  position: relative;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
}

.color-quest {
  position: absolute;
  z-index: 5;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 2px 8px rgba(15,23,42,.14);
  color: #1e3a8a;
  font-size: .8rem;
  font-weight: 800;
}
.color-quest button { border: 0; border-radius: 999px; padding: 5px 9px; background: #3b82f6; color: white; font: inherit; cursor: pointer; }

.canvas-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#paintCanvas {
  z-index: 1;
  background: #ffffff;
}

#outlineCanvas {
  z-index: 2;
  pointer-events: none;
}

/* COLOR TOAST ANNOUNCER */
.color-toast {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  padding: 8px 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  z-index: 20;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.color-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

/* PICTURE CAROUSEL (BOTTOM DRAWER) */
.gallery-drawer {
  width: 100%;
  max-width: 1040px;
  padding: 0 16px;
  margin-bottom: 30px;
}

.gallery-title-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.gallery-heading {
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-scroll-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px 16px 4px;
  scrollbar-width: thin;
}

.gallery-scroll-container::-webkit-scrollbar {
  height: 6px;
}

.gallery-scroll-container::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}

.gallery-card {
  flex: 0 0 110px;
  background: #ffffff;
  border: 3px solid #e2e8f0;
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: #38bdf8;
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.25);
}

.gallery-card.active {
  border-color: #0284c7;
  background: #f0f9ff;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.35);
}

.gallery-thumb-box {
  width: 86px;
  height: 70px;
  background: #f8fafc;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #f1f5f9;
}

.gallery-thumb-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.gallery-card-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  text-align: center;
  white-space: nowrap;
}

/* CELEBRATION OVERLAY */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.celebration-card {
  background: #ffffff;
  border-radius: 32px;
  padding: 36px 32px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.celebration-emoji {
  font-size: 4rem;
  margin-bottom: 12px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.celebration-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  color: #0f172a;
  margin-bottom: 8px;
}

.celebration-desc {
  font-size: 0.98rem;
  color: #64748b;
  margin-bottom: 24px;
}

.celebration-btn {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  font-family: 'Fredoka One', cursive;
  font-size: 1.15rem;
  padding: 12px 30px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.35);
  transition: all 0.2s ease;
}

.celebration-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

/* CONFETTI CANVAS */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 101;
}

/* RESPONSIVE DESIGN */
@media (max-width: 860px) {
  .tablet-screen {
    height: 480px;
  }
  .screen-sidebar {
    width: 105px;
  }
  .tool-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  .color-swatch-btn {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 600px) {
  .studio-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .tablet-device {
    padding: 8px;
    border-width: 8px;
    border-radius: 26px;
  }
  .tablet-screen {
    height: 380px;
  }
}
