/* ==========================================================
   activity-common.css
   Shared layout & component styles for all kid-activity templates
   ========================================================== */

/* --- Variables --- */
:root{
  --gap: 14px;
  --panelBorder: #d7dce6;
  --btnBorder: #cfd6e4;
  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --radius: 14px;
  --ok: #1a7f37;
  --bad: #b42318;
  --muted: #6b7280;
}

/* --- Reset (with !important to override Enfold parent theme) --- */
*{ box-sizing:border-box; }
html{
  height: 100%;
}
body{
  margin: 0 !important;
  padding: 0 !important;
  font-family: "owners", sans-serif;
  background: #0d4649 !important;
  color: #111;
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  letter-spacing: 0.04em;
}

/* Neutralise Enfold theme layout interference */
.wrap, .panel, .stageCard, .panel-body,
.wrap > *, .panel > * {
  float: none !important;
}

/* --- Main wrapper: centred, max-width, 25% / 75% columns --- */
.wrap{
  display: grid !important;
  grid-template-columns: 25% 1fr !important;
  gap: 30px !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  padding: 0 14px !important;
  align-items: stretch !important;
  width: 100% !important;
  float: none !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

@media (max-width: 900px){
  .wrap{
    grid-template-columns: 1fr !important;
  }
}

/* --- Left panel (scrollable with kid-friendly arrows) --- */
.panel{
  background: #0D4649;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  width: 100% !important;
  float: none !important;
  color: #fff;
}
.panel h2{
  margin: 0 0 4px;
  font-size: 18px;
  color: #ff6814;
}
.panel, .panel-body{
  font-size: 15px;
}

/* Scrollable inner area */
.panel-body{
  flex: 1 1 0% !important;
  overflow-y: auto !important;
  padding: 12px;
  min-height: 0 !important;
  scroll-behavior: smooth;
}
/* custom scrollbar */
.panel-body::-webkit-scrollbar{ width: 10px; }
.panel-body::-webkit-scrollbar-track{ background: transparent; }
.panel-body::-webkit-scrollbar-thumb{ background: #39b54a; border-radius: 5px; }

/* Arrow navigation row at bottom of panel */
.panel-arrows{
  display: none;           /* shown via JS only when content overflows */
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,.15);
  background: transparent;
  justify-content: center;
  align-items: center;
}
.panel-arrows.visible{
  display: flex;
}
.panel-arrows button{
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #0D4649;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background .15s ease, color .15s ease;
  box-shadow: -6px 4px 0px #002729;
}
.panel-arrows button:hover{
  background: #39b54a;
  color: #fff;
}
.panel-arrows button:active{
  background: #2f9a3e;
  color: #fff;
}

/* --- Right stage card --- */
.stageCard{
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  width: 100% !important;
}

/* --- Stage area (canvas / grid host) --- */
.stage{
  position: relative;
  flex: 1;
  background-color: #ffffff;
  border-bottom: none;
  overflow: hidden;
  min-height: 420px;
  background-repeat: no-repeat;
  background-size: cover !important;
  border-radius: var(--radius);
}

/* --- "Screen too small" fallback message --- */
.height-too-small-msg{
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 30px 20px;
  color: #ff6814 !important;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  min-height: 200px;
}
.height-too-small-msg svg{
  width: 70px;
  height: 70px;
  fill: #ff6814;
}
.height-too-small-msg.visible{
  display: flex !important;
}

/* --- On-canvas text overlay (bottom-right) --- */
.oncanvas-text{
  position: absolute;
  bottom: 10px;
  right: 12px;
  color: #fff;
  font-size: 16px;
  text-shadow: 2px 2px 4px #0D4649;
  font-weight: 400;
  line-height: 1.3;
  text-align: right;
  pointer-events: none;
  z-index: 5;
  max-width: 60%;
  word-wrap: break-word;
  letter-spacing: 1.5px;
}

/* --- Fixed back-to-cover button on right edge --- */
.btn-back-cover{
  position: fixed;
  right: 0;
  top: 25%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 50px;
  height: 50px;
  background: #39b54a;
  border-radius: 10px 0 0 10px;
  box-shadow: -3px 3px 6px rgba(0,0,0,.3);
  text-decoration: none;
  transition: width .2s ease, gap .2s ease;
  overflow: hidden;
  white-space: nowrap;
}
.btn-back-cover:hover{
  width: auto;
  gap: 6px;
  padding: 0 14px 0 12px;
  background: #2f9a3e;
  text-decoration: none;
}
.btn-back-cover svg{
  width: 26px;
  height: 26px;
  fill: #fff;
  flex-shrink: 0;
}
.btn-back-cover span{
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  max-width: 0;
  overflow: hidden;
  transition: max-width .2s ease;
}
.btn-back-cover:hover span{
  max-width: 80px;
}

/* --- Controls row under stage --- */
.stageControls,
.canvasControls{
  padding: 12px 0px 12px 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #0D4649;
  text-transform: uppercase;
}

/* --- Common hint / small text --- */
.hint{ font-size: 15px; color: #fff; }
.small{ font-size: 17px; color: #fff; font-weight: 400; margin-bottom: 14px; }

/* --- Buttons --- */
button{
  padding: 8px 12px;
  border: 1px solid var(--btnBorder);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.05em;
}
button:hover{ background: #f7f8fb; }
button:disabled{ opacity: .5; cursor: not-allowed; }

button.actionBtn{
  font-weight: 600;
}
button.actionBtn:hover{ background: #f7f8fb; }
button.actionBtn[disabled]{ opacity: .55; cursor: not-allowed; }

/* Check / Let's check button */
.btn-check{
  background: #39b54a !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: -6px 4px 0px #002729;
  text-transform: uppercase !important;
  letter-spacing: 0.05em;
}
.btn-check:hover{
  background: #2f9a3e !important;
}

/* Clear / Start Over button */
.btn-clear{
  background: #ff6814 !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: -6px 4px 0px #002729;
  text-transform: uppercase !important;
  letter-spacing: 0.05em;
}
.btn-clear:hover{
  background: #e55b0e !important;
}

/* --- Score / status box --- */
.scoreBox{
  padding: 6px 10px;
  border: none;
  border-radius: 0;
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  background: transparent;
  margin-left: auto;
  box-shadow: none;
}

/* --- Notice / error text --- */
.notice{
  font-size: 13px;
  color: #ff9999;
  min-height: 16px;
  margin-top: 6px;
}

/* --- Modal dialog (all popups) --- */
dialog{
  border: none;
  border-radius: 18px;
  padding: 24px;
  background: #B5E2F4;
  width: min(520px, calc(100% - 32px));
  box-shadow: -6px 4px 0px #002729;
  font-size: 16px;
  color: #0D4649;
  text-align: center;
}
dialog::backdrop{
  background: rgba(0,0,0,.65);
}
dialog h2{
  color: #ff6814;
  margin: 0 0 12px;
  font-size: 20px;
  text-align: center;
}
dialog p{
  color: #0D4649;
  font-size: 16px;
  text-align: center;
}
dialog .btn-dialog-close{
  background: #ff6814 !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: -6px 4px 0px #002729;
  text-transform: uppercase !important;
  cursor: pointer;
  font-size: 14px;
}
dialog .btn-dialog-close:hover{
  background: #e55b0e !important;
}

/* Dialog action row — Close left, action button right */
.dialog-actions{
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

/* Green action button inside dialogs (Get my Code, etc.) */
dialog .btn-dialog-action{
  background: #39b54a !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: -6px 4px 0px #002729;
  text-transform: uppercase !important;
  cursor: pointer;
  font-size: 14px;
}
dialog .btn-dialog-action:hover{
  background: #2f9a3e !important;
}

/* Dark-green Home button inside dialogs */
dialog .btn-dialog-home{
  background: #0D4649 !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: -6px 4px 0px #002729;
  text-transform: uppercase !important;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}
dialog .btn-dialog-home:hover{
  background: #0a3638 !important;
}

/* All dialog buttons same font-size */
dialog button{
  font-size: 14px !important;
}

/* Dialog selects / dropdowns */
dialog select{
  font-size: 16px;
}

/* --- Badge-ready text --- */
.badge-ready-text{
  margin: 0 0 8px;
  font-weight: 400;
  text-align: center;
}

/* --- Activity code display --- */
.activity-code-row{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}
.activity-code{
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  letter-spacing: .18em;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 12px;
  text-align: center;
  user-select: all;
}

/* --- Code section (hidden until generated) --- */
.codeSection{ display: none; }
.codeSection.show{ display: block; }

/* ==========================================================
   Header
   ========================================================== */
.activity-header{
  max-width: 1400px;
  margin: 0 auto;
  margin-bottom: 30px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
}
.activity-header .header-logo img{
  height: 60px;
  width: auto;
  display: block;
}
.activity-header .header-back{
  text-align: right;
  line-height: 1.4;
}
.activity-header .header-back a.back-btn{
  display: inline-block;
  text-align: right;
  text-decoration: none;
  background: rgba(13, 70, 73, 0.75);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  line-height: 1.4;
  transition: background .15s ease;
}
.activity-header .header-back a.back-btn:hover{
  background: rgba(13, 70, 73, 0.9);
}
.activity-header .header-back .back-label{
  display: block;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .75;
}
.activity-header .header-back .back-site{
  color: #81c784;
  font-size: 14px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* --- Partner logos cloned into header when footer is off-screen --- */
.header-partner-logos{
  display: none;
  align-items: center;
  gap: 12px;
  opacity: 0.85;
}
.header-partner-logos.visible{
  display: flex !important;
}
.header-partner-logos img{
  height: 24px;
  width: auto;
  display: block;
}
.header-partner-logos img.ministry-logo{
  height: 34px;
}

/* ==========================================================
   Footer
   ========================================================== */
.activity-footer{
  max-width: 1400px;
  margin: 0 auto;
  margin-top: 50px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  width: 100%;
}
.footer-logos{
  display: flex;
  align-items: center;
  gap: 30px;
}
.footer-logos img{
  height: 36px;
  width: auto;
  display: block;
}
.footer-logos img.ministry-logo{
  height: 54px;
}
.footer-text{
  font-size: 12px;
  color: rgba(255,255,255,.75);
  text-align: right;
  line-height: 1.6;
}
.footer-text a{
  color: rgba(255,255,255,.9);
  text-decoration: none;
}
.footer-text a:hover{
  color: #fff;
  text-decoration: none;
}
.footer-sep{
  margin: 0 6px;
  opacity: .5;
}

/* ==========================================================
   Screen-size / orientation gate
   ========================================================== */
.screen-gate{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a2e30;
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: 30px 30px;
}
.screen-gate .gate-top{
  flex-shrink: 0;
}
.screen-gate .gate-top img{
  height: 50px;
  width: auto;
}
.screen-gate .gate-middle{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.screen-gate .gate-middle svg{
  width: 80px;
  height: 80px;
  fill: #ff6814;
}
.screen-gate h2{
  font-size: 24px;
  font-weight: 400;
  color: #ff6814;
  margin: 0;
  letter-spacing: 0.05em;
}
.screen-gate p{
  font-size: 16px;
  font-weight: 400;
  color: rgba(255,255,255,.85);
  margin: 0;
  max-width: 400px;
  line-height: 1.5;
}
.screen-gate .gate-bottom{
  flex-shrink: 0;
  text-align: center;
}
.screen-gate .gate-bottom a.back-btn{
  display: inline-block;
  text-align: center;
  text-decoration: none;
  background: rgba(13, 70, 73, 0.75);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  line-height: 1.4;
  transition: background .15s ease;
}
.screen-gate .gate-bottom a.back-btn:hover{
  background: rgba(13, 70, 73, 0.9);
}
.screen-gate .gate-bottom .back-label{
  display: block;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .75;
  margin-bottom: 4px;
}
.screen-gate .gate-bottom .back-site{
  color: #81c784;
  font-size: 14px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Show on portrait tablets & phones (max-width:900px landscape threshold) */
@media (max-width: 900px){
  .screen-gate{ display: flex; }
}
/* Also show on landscape phones (short height + narrow) */
@media (max-height: 500px) and (max-width: 900px){
  .screen-gate{ display: flex; }
}
/* Hide on landscape tablets and up */
@media (min-width: 901px) and (min-height: 501px){
  .screen-gate{ display: none; }
}
/* Portrait tablets: show gate */
@media (orientation: portrait) and (max-width: 1024px){
  .screen-gate{ display: flex; }
}
