/* style.css */

html, body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: 'Comic Sans MS', Arial, sans-serif;
  background: #F9FBE7;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* SIDEBAR */
#sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #FF8A80;
  padding: 15px;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 10px rgba(0,0,0,0.1);
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar h3, #sidebar label {
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
  margin-top: 15px;
  margin-bottom: 10px;
}

.app-title {
  font-size: 28px;
  text-align: center;
  margin-bottom: 20px;
  filter: drop-shadow(2px 2px 0px white);
  cursor: default;
  line-height: 1.2;
}

/* ΕΡΓΑΛΕΙΑ */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pencil-wrapper {
  position: relative;
  min-height: 70px;
}

.pencil-wrapper .tool-btn {
  width: 100%;
  height: 70px;
}

.tool-btn {
  height: 70px;
  border-radius: 15px;
  border: 3px solid #f0f0f0;
  box-shadow: 0 4px 0 #ddd;
  background: white;
  font-size: 32px;
  cursor: pointer;
  transition: 0.2s all;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.tool-btn:hover {
  background: #fff4d6;
  transform: scale(1.05);
}

.tool-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #ddd;
}

.tool-btn.active-tool {
  background: #ffffff;
  border-color: #FFEB3B;
  border-width: 4px;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255, 235, 59, 0.6);
}

/* PENCIL SUBMENU */
.pencil-submenu {
  position: absolute;
  left: 0; top: 0;
  background: white;
  border: 3px solid #FFEB3B;
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: auto;
}

.pencil-submenu.hidden {
  display: none;
}

.sub-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid #eee;
  background: white;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s all;
  padding: 0;
}

.sub-btn:hover {
  background: #fff4d6;
  transform: scale(1.1);
}

.sub-btn.active-sub {
  border-color: #FFEB3B;
  border-width: 3px;
  background: #fffde7;
}

/* ΧΡΩΜΑΤΑ */
.color-presets {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin: 10px 0;
  padding: 4px 3px;      /* χώρος για να "φουσκώνει" η κουκκίδα χωρίς να κόβεται */
  overflow: visible;
}

.color-dot {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

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

.stickers button {
  font-size: 28px;
  margin: 4px;
}

.size-slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.3);
  padding: 10px;
  border-radius: 12px;
  margin-top: 5px;
}

#sizePicker {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #d1e5ff, #1f6ed4);
  appearance: none;
}

/* CANVAS AREA */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #F9FBE7;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
}

/* Το περίγραμμα μπαίνει στο πλαίσιο που τυλίγει τον καμβά (όχι στον ίδιο τον καμβά),
   ώστε η γραμμή να εμφανίζεται ακριβώς κάτω από τον δείκτη. */
.canvas-container {
  background: white;
  border: 5px solid #7da6b8;
  border-radius: 15px;
  overflow: hidden;
  flex-shrink: 0;
  box-sizing: content-box;
}

/* BOTTOM BAR */
#bottom-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button-group button {
  padding: 8px 15px;
  border-radius: 10px;
  border: 2px solid #ccc;
  background: white;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

.button-group button:hover { background: #eee; }

.button-group button:disabled {
  opacity: 0.45;
  cursor: default;
  background: white;
}

.app-info {
  font-size: 12px;
  color: #666;
}

.app-info a {
  color: #FF5252;
  text-decoration: none;
}

/* EMOJI PICKER */
.emoji-picker {
  position: absolute;
  background: white;
  border: 3px solid #FFEB3B;
  border-radius: 14px;
  padding: 10px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  width: 220px;
}

.emoji-picker.hidden { display: none; }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.emoji-grid span {
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
}

.emoji-grid span:hover { background: #fff4d6; }

/* ACTION BUTTONS SMALL */
.action-btn {
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  color: white;
  font-family: 'Comic Sans MS', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 4px;
}

.action-btn:hover { background: rgba(255,255,255,0.35); }

.action-btn.small {
  width: auto;
  padding: 6px 12px;
  font-size: 18px;
}


/* ΜΗΝΥΜΑΤΑ */
#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: #37474F;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  max-width: 80vw;
  text-align: center;
}

#toast.visible { opacity: 1; }

/* ΧΑΜΗΛΕΣ ΟΘΟΝΕΣ (π.χ. laptop 1366x768): πιο πυκνή πλαϊνή μπάρα,
   ώστε χρώματα και μέγεθος να φαίνονται χωρίς κύλιση */
@media (max-height: 900px) {
  #sidebar { padding: 8px 15px; }
  .app-title { font-size: 20px; margin: 2px 0 6px; line-height: 1.1; }
  #sidebar h3, #sidebar label { margin-top: 4px; margin-bottom: 4px; font-size: 15px; }
  #sidebar hr { margin: 5px 0; }
  #sidebar > br { display: none; }
  .tools-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .tool-btn, .pencil-wrapper .tool-btn { height: 52px; font-size: 26px; border-radius: 12px; }
  .pencil-wrapper { min-height: 52px; }
  .stickers { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
  .stickers button { font-size: 20px; margin: 0; padding: 2px 0; }
  .action-btn { padding: 5px; font-size: 13px; }
  .color-section hr { display: none; }
  .color-section { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .color-presets { margin: 4px 0; flex: 1 1 100%; order: 3; }
  .size-slider-container { padding: 6px 10px; margin-top: 2px; }
}

/* ΣΤΕΝΕΣ ΟΘΟΝΕΣ (κινητό): τα εργαλεία πάνω, ο καμβάς από κάτω */
@media (max-width: 700px) {
  #app { flex-direction: column; }
  #sidebar {
    width: auto;
    max-height: 42vh;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  }
  .app-title { font-size: 18px; margin: 0 0 4px; }
  .tools-grid { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .tool-btn, .pencil-wrapper .tool-btn { height: 44px; font-size: 22px; }
  .pencil-wrapper { min-height: 44px; }
  #canvas-area { min-height: 0; }
  .button-group { gap: 6px; }
  .button-group button { padding: 6px 8px; font-size: 12px; }
}

/* ΚΑΤΩ ΜΠΑΡΑ: σε μεσαίες οθόνες τα κουμπιά χωράνε σε μία σειρά */
@media (max-width: 1500px) {
  .button-group { gap: 5px; }
  .button-group button { padding: 8px 7px; font-size: 12.5px; }
}

/* ΑΝΑΙΡΕΣΗ / ΕΠΑΝΑΛΗΨΗ */
.button-group button.icon-btn {
  font-size: 16px;
  padding: 5px 9px;
  line-height: 1;
}
