/* ============================================================
   GLOBAL RESET & FONTS
   ============================================================ */
@font-face {
  font-family: "Sunny Spells Basic";
  src: url("fonts/Sunny Spells Basic.ttf") format("truetype");
  font-display: swap;
}

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

html, body {
  height: 100%;
  margin: 0;
  /*overflow: hidden;*/
  overflow-x: hidden;
  overflow-y: auto;
}

html {
  -webkit-text-size-adjust: 100%;
}


:root {
  --ui-font: 'Segoe UI', system-ui, sans-serif;
  --brand-font: 'Sunny Spells Basic', cursive;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
body {
  font-family: var(--ui-font);
  background-color: var(--app-bg, #e8edf3);
  color: var(--text-color, #333);
}


h1 {
  text-align: center;
  margin: 12px;
  font-weight: 500;
  font-family: var(--brand-font);
  color: #000;
  letter-spacing: 2px;
}

/* ============================================================
   MAIN APP LAYOUT (#app)
   ============================================================ */
#canvasContainer {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
}

#floorCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

canvas {
  background: rgba(255, 255, 255, 0.8);
  border: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#page {
  /* height: 100dvh;*/
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

#appHeader {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#app {
  min-height: 0;     
  display: flex;
  overflow: hidden;   
}


#appFooter {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;

  font-family: "Sunny Spells Basic", cursive;
  font-size: 14px;
  letter-spacing: 0.8px;
  opacity: 0.85;
}





/* ============================================================
   SIDEBARS
   ============================================================ */
#sidebar {
  display: flex;
  flex-direction: column;
  width: clamp(44px, 8vw, 60px);
  background: #ffffff;
  border-right: 2px solid #ccc;
  position: relative;
  overflow: visible;
  transition: width 0.2s ease;
}

#sidebar.expanded {
  width: clamp(160px, 40vw, 240px);
}

#rightSidebar {
  display: flex;
  flex-direction: column;
  width: clamp(44px, 8vw, 60px);
  background: #ffffff;
  border-left: 2px solid #ccc;
  position: relative;
  overflow: visible;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================================
   TOOL UI (buttons, grids, icons)
   ============================================================ */
#categoryIcons {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 10px;
  flex-grow: 1;
}

.category-icon {
  width: min(40px, 10vw);
  height: min(40px, 10vw);
  padding: 6px;
  border-radius: 6px;
  background: #f2f2f2;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: background 0.2s ease;
}


.category-icon:hover {
  background: #d8e4f5;
}

.category-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#categoryPanel {
  position: absolute;
  left: 60px;
  top: 0;
  width: 180px;
  height: 100%;
  background: #f9fbfd;
  border-left: 1px solid #ccc;
  padding: 10px;
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  overflow-y: auto;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 20;
}

#categoryPanel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

#categoryPanel h3 {
  margin-top: 0;
  font-size: 22px;
  color: #003366;
  font-family: "Sunny Spells Basic", sans-serif;
  letter-spacing: 3px; /* optional: helps readability */
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tool-button {
  width: min(48px, 12vw);
  height: min(48px, 12vw);

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid transparent;
  border-radius: 10px;
  background-color: #f9f9f9;

  cursor: pointer;
  transition: all 0.15s ease-in-out;
}


/* Tool icons (inside category panel) */
.tool-button img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.tool-button:hover {
  background-color: #eef3f7;
  transform: scale(1.05);
}

.tool-button.selected {
  border: 2px solid #00A65C;
  background-color: #e8f8ef;
  box-shadow: 0 0 6px rgba(0, 166, 92, 0.4);
  transform: scale(1.08);
}



#utilitiesBar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Utility icons (right sidebar) */

.utility-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.utility-btn:hover {
  background: #e6e6e6;
}

.utility-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

#colorSwatchWrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
  flex-shrink: 0;
}

#activeColorSwatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #333;
  background-color: #00A65C;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#activeColorSwatch:hover {
  transform: scale(1.1);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

button.primary {
  margin-top: 16px;
  padding: 10px 20px;
  background-color: #0078d7; /* pick one */
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}
.title-icon {
  height: 32px;        /* controls size */
  width: auto;         /* keeps correct proportions */
  margin-right: 6px;
  vertical-align: middle;
}

#colorInput {
  width: 28px;
  height: 28px;
  margin: 6px auto;
  padding: 0;

  border-radius: 50%;
  border: 2px solid #333;
  cursor: pointer;

  background: none;

  /* REQUIRED for iOS */
  appearance: none;
  -webkit-appearance: none;
}

/* iOS internal swatch cleanup */
#colorInput::-webkit-color-swatch-wrapper {
  padding: 0;
}

#colorInput::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}
/* ============================================================
   TOOL GROUP HEADERS
   ============================================================ */

.tool-group-header {
  margin: 14px 0 6px;
  padding-left: 4px;

  font-size: 18px;
  font-weight: 600;
  font-family: "Sunny Spells Basic", sans-serif;
  text-transform: uppercase;
  letter-spacing: 2px;

  color: #666;
  opacity: 0.90;
}

/* Tighten spacing when header is first */
.tool-group-header:first-child {
  margin-top: 4px;
}
.annotation-button {
  grid-column: 1 / -1;   /* full row */

  width: 100%;
  height: auto;

  font-family: "Sunny Spells Basic", cursive;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;

  padding: 12px 14px;
  border-radius: 14px;

  background: #f6f6f6;
  color: #1f3a5f;

  text-align: center;
  line-height: 1.25;
  text-transform: uppercase;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;
}


/* ============================================================
   MODALS & TUTORIALS
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 26px 32px;
  border-radius: 12px;
  width: 420px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  animation: popin 0.25s ease-out;
}

@keyframes popin {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Sunny Spells for Tutorial Modals --- */
.modal-content h2,
.modal-content p,
.modal-content label,
.modal-content button {
  font-family: "Sunny Spells Basic", sans-serif;
  letter-spacing: 1px;
}

.modal-content h2 {
  font-size: 24px;
}

.modal-content p {
  font-size: 16px;
  line-height: 1.35;
}

.modal-buttons button {
  font-family: "Sunny Spells Basic", sans-serif;
  font-size: 18px;
  letter-spacing: 1px;
}
/* Make all tutorial modal text ALL CAPS — works beautifully with Sunny Spells */
#tutorialModal .modal-content,
#tutorialCompleteModal .modal-content {
  text-transform: uppercase;
  letter-spacing: 2px; /* optional but looks great with Sunny Spells */
}

/* Optional: scale headers slightly bigger */
#tutorialModal .modal-content h2,
#tutorialCompleteModal .modal-content h2 {
  font-size: 26px;
}

.tutorial-highlight {
  outline: 3px solid #00bcd4;
  border-radius: 8px;
  animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(0,188,212,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(0,188,212,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,188,212,0); }
}


/* Make tutorial tooltips more readable */
.tippy-box[data-theme~='light-border'] {
  max-width: 320px !important;
  white-space: normal;
  font-size: 14px;
  line-height: 1.4;
}
.tutorial-pulse {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 188, 212, 0.85);   /* BLUE */
  box-shadow: 0 0 12px rgba(0, 188, 212, 0.7);
  animation: pulseAnim 1.2s infinite ease-out;
  pointer-events: none;
  z-index: 9999;
}


@keyframes pulseAnim {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ============================================================
   OVERLAYS / FLOATING UI
   ============================================================ */
#toolbar {
  position: absolute;
  bottom: 10px;
  left: 80px;
  display: flex;
  gap: 8px;
}

#toolbar button {
  background: #003366;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#toolbar button:hover {
  background: #00509e;
}

#helpButton {
  margin-top: auto; 
  margin-bottom: 20px;
  align-self: center; 
  

  background: #333;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.25);
  z-index: 10; /* smaller than modals but above icons */
}

#helpButton:hover {
  background: #005fa3;
}

#taNotification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);

  background: #333;
  color: #fff;
  padding: 14px 24px;

  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);

  font-family: "Sunny Spells Basic", sans-serif;
  letter-spacing: 1px;
  font-size: 18px;

  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;

  z-index: 99999;
}

#taNotification.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
/* ============================================================
   THEME / BACKGROUNDS
   ============================================================ */
svg {
  color: var(--activeColor);
}

.blueprint-bg {
  background-color: #f7f7f7;
  background-image:
    linear-gradient(#e0e0e0 1px, transparent 1px),
    linear-gradient(90deg, #e0e0e0 1px, transparent 1px),
    linear-gradient(#f0f0f0 1px, transparent 1px),
    linear-gradient(90deg, #f0f0f0 1px, transparent 1px);
  background-size:
    40px 40px,
    40px 40px,
    10px 10px,
    10px 10px;
}

#appHeader,
#appFooter {
  background: none;
}

/* Blueprint variant for header & footer */
#appHeader.blueprint-bg,
#appFooter.blueprint-bg {
  background-image:
    linear-gradient(#d0d6dd 1px, transparent 1px),
    linear-gradient(90deg, #d0d6dd 1px, transparent 1px),
    linear-gradient(#e6ebf1 1px, transparent 1px),
    linear-gradient(90deg, #e6ebf1 1px, transparent 1px);
}

/* Keep header title clean */
#appHeader h1 {
  background: transparent;
}

/* ============================================================
   FEATURE UI — RECENT PROJECTS
   ============================================================ */

.recent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 4px;
}

.recent-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.recent-card:hover {
  transform: scale(1.04);
}

.recent-thumb-wrapper {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 8px;
  background: #e8edf3; /* soft canvas-ish */
}

.recent-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-date {
  text-align: center;
  font-size: 14px;
  margin-top: 6px;
  opacity: 0.7;
  font-family: "Sunny Spells Basic", sans-serif;
  letter-spacing: 1px;
}

.recent-empty {
  font-size: 16px;
  opacity: 0.6;
  padding: 20px 0;
  text-align: center;
}
/* ============================================================
   HOME PAGE (index.html only)
   ============================================================ */

body.home {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: "Sunny Spells Basic", sans-serif;

  /* Blueprint background */
  background-color: #f7f7f7;
  background-image:
    linear-gradient(#e0e0e0 1px, transparent 1px),
    linear-gradient(90deg, #e0e0e0 1px, transparent 1px),
    linear-gradient(#f0f0f0 1px, transparent 1px),
    linear-gradient(90deg, #f0f0f0 1px, transparent 1px);
  background-size:
    40px 40px,
    40px 40px,
    10px 10px,
    10px 10px;
}

/* ---------- Home Card ---------- */
.home-container {
  width: 85%;
  max-width: 1500px;
  margin-top: 60px;

  background: white;
  border-radius: 28px;
  padding: 60px 70px;

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;

  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* ---------- Left Side ---------- */
.home-left {
  display: flex;
  flex-direction: column;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-logo {
  width: 100px;
}

.home-title {
  font-size: 40px;        /* smaller */
  margin: 0;
  color: #000;
  letter-spacing: 1.5px; /* tighter */
  line-height: 1.1;
  font-weight: normal;
  white-space: nowrap;   /* stays on one line */
}


.home-description {
  font-size: 22px;
  line-height: 1.6;
  color: #333;
  margin: 30px 0 40px;
  max-width: 600px;
}

.home-primary-btn {
  background: #000;
  color: #fff;
  border: none;
  padding: 18px 40px;
  font-size: 24px;
  border-radius: 14px;
  cursor: pointer;
  font-family: "Sunny Spells Basic", sans-serif;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.home-primary-btn:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

/* ---------- Right Side ---------- */
.home-right {
  display: flex;
  flex-direction: column;
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.recent-title {
  font-size: 20px;        /* down from 36px */
  font-weight: 500;       /* not bold-bold */
  letter-spacing: 1px;
  color: #333;
  margin: 0;
}
.see-all-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #444;
  font-family: "Sunny Spells Basic", sans-serif;
  transition: transform 0.2s ease, color 0.2s ease;
}

.see-all-btn:hover {
  color: #000;
  transform: translateX(4px);
}
@media (max-width: 900px) {
  .home-container {
    grid-template-columns: 1fr;
    padding: 40px 30px;
    gap: 40px;
  }

  .brand-row {
    justify-content: center;
  }

  .home-title {
    font-size: 28px;
    white-space: normal;
    text-align: center;
  }

  .home-description {
    text-align: center;
  }

  .home-primary-btn {
    width: 100%;
  }
}

/* ============================================================
   ALL PROJECTS PAGE (all-projects.html only)
   ============================================================ */

body.all-projects {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: "Sunny Spells Basic", sans-serif;

  /* Blueprint background (shared visual language) */
  background-color: #f7f7f7;
  background-image:
    linear-gradient(#e0e0e0 1px, transparent 1px),
    linear-gradient(90deg, #e0e0e0 1px, transparent 1px),
    linear-gradient(#f0f0f0 1px, transparent 1px),
    linear-gradient(90deg, #f0f0f0 1px, transparent 1px);
  background-size:
    40px 40px,
    40px 40px,
    10px 10px,
    10px 10px;
}

/* ---------- All Projects Card ---------- */
.all-container {
  width: 90%;
  max-width: 1400px;
  margin: 60px auto;

  background: white;
  border-radius: 28px;
  padding: 50px 60px;

  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.all-title {
  font-size: 32px;
  letter-spacing: 1.5px;
  font-weight: normal;
}

.all-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

#allProjectsGrid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 25px;
}

.all-empty {
  text-align: center;
  font-size: 18px;
  opacity: 0.6;
  margin-top: 60px;
}

/* ---------- Project Cards ---------- */
.proj-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.proj-card:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}

.proj-thumb-wrapper {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e8edf3;
  border-radius: 10px;
  overflow: hidden;
}

.proj-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.proj-date {
  text-align: center;
  margin-top: 6px;
  opacity: 0.7;
  font-size: 14px;
}

/* ---------- Navigation ---------- */
.back-btn {
  display: inline-block;
  margin-top: 20px;
  font-size: 18px;
  cursor: pointer;
  color: #000;
  text-decoration: none;
}

.back-btn:hover {
  text-decoration: underline;
}
@media (max-width: 768px) {
  .all-container {
    padding: 40px 24px;
  }

  .all-header {
    flex-direction: column;
    gap: 12px;
  }

  .back-btn {
    font-size: 16px;
  }
}

/* ---------- Autosave ---------- */

.floor-toggle {
  margin: 10px 0;
  text-align: center;
}

.floor-label {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
  opacity: 0.7;
}

.floor-btn {
  width: 32px;
  height: 32px;
  margin: 4px auto;
  border-radius: 8px;
  border: 2px solid #aaa;
  background: white;
  font-weight: bold;
}

.floor-btn.active {
  background: #333;
  color: white;
  border-color: #333;
}
