/* General Styles */
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f7f7fa;
  color: #222;
}
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: linear-gradient(90deg, #6dd5ed, #f7797d);
  color: #fff;
}
.app-header h1 {
  font-size: 2rem;
  margin: 0;
  letter-spacing: 2px;
}
.app-main {
  display: flex;
  flex: 1;
  min-height: 0;
}
.tools-panel, .palette-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: #f0f4f8;
  min-width: 60px;
  align-items: center;
}
.tools-panel button {
  background: #fff;
  border: 2px solid #6dd5ed;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
  margin-bottom: 0.5rem;
}
.tools-panel button:active, .tools-panel button:focus {
  background: #6dd5ed;
  color: #fff;
  outline: none;
}
.canvas-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eaf6fb;
  position: relative;
}
#canvas-container {
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  border-radius: 12px;
  background: #fff;
  overflow: auto;
  max-width: 100vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#coloring-canvas {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  touch-action: none;
}
.palette-panel {
  min-width: 120px;
  background: #f0f4f8;
  align-items: stretch;
}
.color-swatches, .color-gradients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.color-swatches div, .color-gradients div {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: border 0.2s;
}
.color-swatches div.selected, .color-gradients div.selected {
  border: 2px solid #f7797d;
}
.custom-color-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}
.custom-color-picker label {
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.custom-color-picker input[type=range] {
  width: 100%;
}
#custom-color-preview {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #6dd5ed;
  margin: 0.5rem auto 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tools-panel #brush-tool.selected {
  background: #f7797d;
  color: #fff;
  border-color: #f7797d;
}
#brush-size-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: #fff;
  border: 1.5px solid #6dd5ed;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.5rem;
  font-size: 0.95em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
#brush-size-group label {
  display: flex;
  align-items: center;
  gap: 0.3em;
  cursor: pointer;
}
#brush-size-group input[type=radio] {
  accent-color: #6dd5ed;
}
.toggle-tools-btn {
  position: fixed;
  left: 0;
  top: 120px;
  z-index: 9999 !important;
  pointer-events: auto !important;
  background: #6dd5ed !important;
  color: #fff !important;
  border: none;
  border-radius: 0 16px 16px 0;
  width: 32px;
  height: 40px;
  font-size: 1.3em;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: background 0.2s;
}
.toggle-tools-btn:active, .toggle-tools-btn:focus {
  background: #f7797d;
  outline: none;
}
.toggle-palette-btn {
  position: fixed;
  right: 0;
  top: 120px;
  z-index: 9999 !important;
  pointer-events: auto !important;
  background: #f7797d !important;
  color: #fff !important;
  border: none;
  border-radius: 16px 0 0 16px;
  width: 32px;
  height: 40px;
  font-size: 1.3em;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: background 0.2s;
}
.toggle-palette-btn:active, .toggle-palette-btn:focus {
  background: #6dd5ed;
  outline: none;
}
.tools-panel {
  position: relative;
  transition: transform 0.3s cubic-bezier(.4,2,.6,1), opacity 0.3s;
}
.tools-panel.hidden {
  transform: translateX(-120%);
  opacity: 0.1;
  pointer-events: none;
}
.app-main.tools-hidden .canvas-section {
  margin-left: 0 !important;
}
.palette-panel {
  position: relative;
  transition: transform 0.3s cubic-bezier(.4,2,.6,1), opacity 0.3s;
}
.palette-panel.hidden {
  transform: translateX(120%);
  opacity: 0.1;
  pointer-events: none;
}
.app-main.palette-hidden .canvas-section {
  margin-right: 0 !important;
}
.palette-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.custom-color-btn, .custom-gradient-btn {
  background: #fff;
  border: 2px solid #6dd5ed;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.3em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border 0.2s;
}
.custom-color-btn:hover, .custom-gradient-btn:hover,
.custom-color-btn:focus, .custom-gradient-btn:focus {
  background: #6dd5ed;
  color: #fff;
  border-color: #f7797d;
  outline: none;
}
.custom-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.25);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  min-width: 280px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  position: relative;
  text-align: center;
}
.close-modal {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 2em;
  color: #f44336;
  cursor: pointer;
  font-weight: bold;
  z-index: 10;
}
.close-modal:hover, .close-modal:focus {
  color: #2196f3;
  outline: none;
}
@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
  }
  .tools-panel, .palette-panel {
    flex-direction: row;
    min-width: 0;
    min-height: 60px;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
  }
  .palette-panel {
    flex-wrap: wrap;
  }
  .canvas-section {
    min-height: 300px;
  }
  #brush-size-group {
    flex-direction: row;
    padding: 0.3rem 0.5rem;
    font-size: 0.9em;
  }
  .tools-panel {
    flex-direction: row;
    min-width: 0;
    min-height: 60px;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    padding: 0.5rem;
    position: fixed;
    left: 0;
    bottom: 0;
    right: 0;
    top: auto;
    z-index: 20;
    border-radius: 0;
    background: #f0f4f8ee;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.10);
    transition: transform 0.3s, opacity 0.3s;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  .tools-panel button {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.5em;
    margin: 0 0.3em 0 0;
    flex-shrink: 0;
  }
  .palette-row.always-visible {
    display: flex !important;
    flex-direction: row;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
  }
  .custom-color-btn, .custom-gradient-btn {
    display: flex !important;
  }
  .toggle-tools-btn {
    left: 12px;
    top: auto;
    bottom: 120px;
    border-radius: 16px 16px 0 0;
    width: 40px;
    height: 32px;
    font-size: 1.3em;
  }
  .palette-panel {
    flex-direction: row;
    min-width: 0;
    min-height: 60px;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    position: fixed;
    left: 0;
    bottom: 60px;
    right: 0;
    top: auto;
    z-index: 19;
    border-radius: 0;
    background: #f0f4f8ee;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.10);
    transition: transform 0.3s, opacity 0.3s;
  }
  .palette-panel.hidden {
    transform: translateY(100%);
    opacity: 0.1;
  }
  .toggle-palette-btn {
    right: 12px;
    top: auto;
    bottom: 120px;
    border-radius: 16px 16px 0 0;
    width: 40px;
    height: 32px;
    font-size: 1.3em;
  }
}
@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
  }
  .app-container {
    border-radius: 0;
    box-shadow: none;
  }
  #canvas-container {
    max-width: 100vw;
    max-height: 50vh;
  }
  #coloring-canvas {
    max-height: 40vh;
  }
  .custom-modal-content {
    padding: 1rem 0.5rem 0.5rem 0.5rem;
    min-width: 180px;
  }
}
/* Hide UI for print/download */
@media print {
  .app-header, .tools-panel, .palette-panel {
    display: none !important;
  }
  .canvas-section, #canvas-container, #coloring-canvas {
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #fff !important;
  }
} 