/* Bee-Bot Emulador Educativo - Prof. Fer Solares */

:root {
  --terrapin-bg: #F4F4F4;
  --sidebar-width: 300px;
  --orange-btn-top: #FF8A00;
  --orange-btn-bot: #E65100;
  --green-home: #2E7D32;
  --green-go: #A5D6A7;
  --red-stop: #C62828;
  --blue-cmd: #1565C0;
  --orange-box-bg: #FF6600;
  --font-terrapin: 'Roboto', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-terrapin);
  background: #EAEAEA;
  color: #222222;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
}

/* Master Responsive Wrapper */
.terrapin-app-wrapper {
  display: flex;
  width: 100%;
  max-width: 1100px;
  background: #FFFFFF;
  border: 2px solid #ABABAB;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  overflow: hidden;
}

@media (max-width: 820px) {
  .terrapin-app-wrapper {
    flex-direction: column;
    max-width: 100%;
  }
}

/* LEFT SIDEBAR */
.terrapin-sidebar {
  width: var(--sidebar-width);
  background: #F3F3F3;
  border-right: 2px solid #CCCCCC;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 820px) {
  .terrapin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #CCCCCC;
  }
}

.terrapin-brand {
  border-bottom: 2px solid #CCCCCC;
  padding-bottom: 6px;
}

.brand-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.header-mascot-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid #E53935;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.logo-box {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-terrapin {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #C62828;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 0.72rem;
  color: #666666;
  font-weight: 500;
  margin-top: -2px;
}

.terrapin-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #000000;
  margin-top: 4px;
}

/* Select Label & Dropdown */
.sidebar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #333333;
  margin-bottom: 3px;
  display: block;
}

.terrapin-select {
  width: 100%;
  font-family: var(--font-terrapin);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 5px 8px;
  border: 2px solid #777777;
  border-radius: 4px;
  background: #FFFFFF;
  color: #000000;
  cursor: pointer;
  outline: none;
}

.sidebar-checkbox-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #333333;
}

.sidebar-checkbox-group input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Utility Action Buttons */
.sidebar-action-bar {
  display: flex;
  gap: 6px;
}

.terrapin-btn-sm {
  flex: 1;
  font-family: var(--font-terrapin);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 3px;
  background: linear-gradient(180deg, #FFFFFF 0%, #E0E0E0 100%);
  border: 1px solid #777777;
  border-radius: 4px;
  color: #222222;
  cursor: pointer;
  box-shadow: inset 0 1px 0 #FFFFFF, 0 1px 2px rgba(0,0,0,0.1);
  text-align: center;
}

.terrapin-btn-sm:active {
  background: #CCCCCC;
}

/* Keypad Layout (Slightly Scaled for Laptops) */
.terrapin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 68px);
  gap: 8px;
  justify-items: center;
  align-items: center;
  margin: 4px 0;
}

/* 1. Circular Home Button */
.terrapin-btn-round.btn-home {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #4CAF50, #1B5E20);
  border: 3px solid #0D3B10;
  box-shadow: 0 3px 5px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.4);
  color: #FFFFFF;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 2. Octagonal DETENER (STOP) Button */
.terrapin-btn-octagon.btn-stop {
  width: 56px;
  height: 56px;
  background: radial-gradient(circle at 30% 30%, #E53935, #B71C1C);
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border: none;
  box-shadow: 0 3px 5px rgba(0,0,0,0.3);
  color: #FFFFFF;
  font-family: var(--font-terrapin);
  font-weight: 900;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  letter-spacing: 0.5px;
}

/* 3. Orange Oval Direction Buttons */
.terrapin-btn-oval {
  border-radius: 50px;
  background: linear-gradient(180deg, #FF9800 0%, #F57C00 50%, #E65100 100%);
  border: 3px solid #BF360C;
  box-shadow: 0 3px 5px rgba(0,0,0,0.25), inset 0 2px 4px rgba(255,255,255,0.5);
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.05s, filter 0.05s;
}

.btn-orange-vert {
  width: 44px;
  height: 64px;
}

.btn-orange-horiz {
  width: 64px;
  height: 44px;
}

.arrow-shape {
  font-size: 1.4rem;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* 4. Light Green GO Button */
.terrapin-btn-round.btn-go {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #E8F5E9, #C8E6C9);
  border: 3px solid #81C784;
  box-shadow: 0 3px 5px rgba(0,0,0,0.2), inset 0 2px 4px rgba(255,255,255,0.8);
  color: #2E7D32;
  font-family: var(--font-terrapin);
  font-weight: 900;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 5. Blue Action Buttons (Clear X & Pause) */
.terrapin-btn-rect.btn-blue {
  width: 60px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1E88E5 0%, #1565C0 100%);
  border: 3px solid #0D47A1;
  box-shadow: 0 3px 5px rgba(0,0,0,0.25), inset 0 2px 4px rgba(255,255,255,0.4);
  color: #FFFFFF;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.terrapin-keypad button:active {
  transform: translateY(2px);
  filter: brightness(0.9);
}

/* Orange Command Container Box */
.terrapin-orange-cmd-box {
  width: 100%;
  height: 58px;
  background: #FF6600;
  border: 3px solid #CC4400;
  border-radius: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
  padding: 5px;
  overflow-x: auto;
  display: flex;
  align-items: center;
}

.cmd-list-strip {
  display: flex;
  gap: 5px;
  align-items: center;
}

.terrapin-cmd-pill {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 2px solid #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.terrapin-cmd-pill.cmd-F { background: #FF9800; }
.terrapin-cmd-pill.cmd-B { background: #F57C00; }
.terrapin-cmd-pill.cmd-L { background: #FF9800; }
.terrapin-cmd-pill.cmd-R { background: #FF9800; }
.terrapin-cmd-pill.cmd-P { background: #1565C0; }

.terrapin-cmd-pill.executing {
  transform: scale(1.15);
  border-color: #FFFF00;
  box-shadow: 0 0 10px #FFFF00;
}

/* RIGHT MAIN CONTENT */
.terrapin-main-content {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #FFFFFF;
  overflow: hidden;
}

/* Activity / Challenge Card Header */
.activity-card {
  background: #F9F9F9;
  border: 2px solid #DDDDDD;
  border-radius: 6px;
  padding: 10px 14px;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #EEEEEE;
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.mat-badge {
  background: #C62828;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.mat-title-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111111;
}

.challenge-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.challenge-num-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0D47A1;
}

.challenge-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #222222;
}

.challenge-desc {
  font-size: 0.85rem;
  color: #555555;
  margin-top: 2px;
}

.challenge-controls {
  display: flex;
  gap: 6px;
}

.act-btn {
  font-family: var(--font-terrapin);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid #888888;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-speak {
  background: #FFF8E1;
  border-color: #FFB300;
  color: #F57F17;
}

.btn-next {
  background: #E8F5E9;
  border-color: #4CAF50;
  color: #2E7D32;
}

/* Canvas Container (Responsive Max-Width) */
.mat-canvas-container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #FAFAFA;
  border: 2px solid #CCCCCC;
  border-radius: 6px;
  padding: 6px;
  overflow: hidden;
}

#game-board {
  max-width: 100%;
  max-height: 520px;
  height: auto;
  display: block;
}

/* Creator Toolbar */
.creator-toolbar {
  position: absolute;
  bottom: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 5px 10px;
  border-radius: 6px;
  border: 2px solid #888888;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.creator-tool {
  font-family: var(--font-terrapin);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #CCCCCC;
  background: #FFFFFF;
  cursor: pointer;
}

.creator-tool.active {
  background: #1976D2;
  color: #FFFFFF;
  border-color: #0D47A1;
}

.hidden {
  display: none !important;
}

/* Victory Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  border: 4px solid #4CAF50;
  padding: 24px 20px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}

.modal-stars {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #2E7D32;
}

.modal-desc {
  font-size: 0.95rem;
  color: #444444;
  margin: 8px 0 18px 0;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-btn {
  flex: 1;
  padding: 9px;
  border-radius: 5px;
  border: none;
  font-family: var(--font-terrapin);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: #4CAF50;
  color: #FFFFFF;
}

.secondary-btn {
  background: #E0E0E0;
  color: #333333;
}
