/* app.css — Baanabus mobile-first styles
 * Only contains styles actively in use. Legacy CSS kept in styles.css for reference.
 */

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    color: hsl(210, 100%, 20%);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* Canvas scene pages lock scroll via JS adding this class */
body.scene-view { overflow: hidden; }

/* === Typography === */
h1, h2, h3 { color: hsl(210, 100%, 20%); font-weight: 400; margin-top: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
p  { margin: 0.5rem 0; line-height: 1.5; }

.muted    { color: #888; font-size: 0.9em; }
.hint     { color: #aaa; font-size: 0.82em; }
.highlight { font-weight: 700; color: hsl(210, 100%, 30%); }
.completed { color: #aaa; font-weight: 300; text-decoration: line-through; }
.hidden   { display: none !important; }

/* === Navbar === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 200;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.navbar li a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px;
    height: 44px;
    text-decoration: none;
    color: hsl(210, 100%, 20%);
    font-size: 0.85em;
    white-space: nowrap;
    transition: color 0.2s;
}

.navbar li a:hover { color: hsl(210, 100%, 45%); }

/* Mobile: hide nav labels, show emojis only */
@media (max-width: 600px) {
    .navbar li a { padding: 0 9px; font-size: 1.2em; }
    .navbar li a .nav-text { display: none; }
}

/* === Buttons === */
.btn,
button.btn,
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    min-height: 44px;
    background: hsl(210, 100%, 30%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover  { background: hsl(210, 100%, 40%); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: hsl(210, 100%, 30%);
    border: 1.5px solid hsl(210, 100%, 30%);
}
.btn-secondary:hover { background: hsl(210, 100%, 96%); }

/* === Form elements === */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    min-height: 44px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    color: hsl(210, 100%, 20%);
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
    border-color: hsl(210, 100%, 40%);
    outline: none;
    box-shadow: 0 0 0 3px hsla(210, 100%, 40%, 0.15);
}

/* === Layout: Container === */
.container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 1rem;
}

/* On pages with a navbar, push content below it */
.page-content {
    padding-top: 52px;
}

/* === Card === */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
}

/* === Overlay (full-screen modal layer) === */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
}

.overlay-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 14px;
    padding: 1.5rem;
    width: 88%;
    max-width: 760px;
    max-height: 82vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: bottom sheet */
@media (max-width: 640px) {
    .overlay-content {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-height: 88vh;
        border-radius: 18px 18px 0 0;
        padding: 1rem 1rem 1.5rem;
    }
}

/* Close button (works inside both overlay and speechBubble) */
.close-button {
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    padding: 4px;
    -webkit-tap-highlight-color: transparent;
}
.close-button:hover { color: #000; }

/* === Speech Bubble === */
.speechBubble {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
}

.speechBubble-content {
    position: absolute;
    background: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-width: min(320px, 85vw);
    pointer-events: auto;
    /* Default position: right of centre, adjusted for avatar */
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
}

@media (max-width: 640px) {
    .speechBubble-content {
        top: auto;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* === Status / feedback text === */
#authStatus, .auth-status, #status {
    min-height: 1.4em;
    margin-top: 0.5rem;
    font-size: 0.9em;
}

/* === Progress bar === */
.progress-container {
    width: 100%;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    height: 18px;
    margin: 8px 0;
}
.progress-bar {
    height: 100%;
    background: #4caf50;
    transition: width 0.4s ease;
}

/* === Task items === */
.task-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid hsl(210, 100%, 80%);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 4px 0;
    gap: 8px;
}

.task-info-box {
    border: 1px solid hsl(210, 100%, 80%);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 4px 0;
    font-size: 0.95em;
    overflow: hidden;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid hsl(210, 100%, 30%);
    border-radius: 4px;
    cursor: pointer;
    accent-color: hsl(210, 100%, 30%);
    vertical-align: middle;
}

.left-content  { display: inline; }
.right-content { float: right; display: flex; gap: 6px; }

/* === Action links === */
.edit-link,
.delete-link,
.action-button,
.choice-button {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    min-height: 36px;
    background: hsl(210, 100%, 30%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.edit-link:hover, .action-button:hover, .choice-button:hover {
    background: hsl(210, 100%, 40%);
}
.delete-link { background: #dc3545; }
.delete-link:hover { background: #c0392b; }

/* === Scene canvas === */
#sceneCanvas, #calCanvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
}

/* === Calendar scene nav bar === */
#cal-nav {
    position: fixed;
    top: 44px;
    left: 0;
    width: 100%;
    height: 44px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    z-index: 150;
}
#cal-nav h2 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.01em;
}
#cal-nav button {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: hsl(210, 100%, 30%);
    cursor: pointer;
    padding: 0 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Star pip animation === */
@keyframes fly-to-bar {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  15%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.1); opacity: 0; }
}
.star-pip {
  position: fixed;
  pointer-events: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #f5a623;
  text-shadow: 0 0 8px rgba(245, 166, 35, 0.9);
  z-index: 999;
  animation: fly-to-bar 0.75s cubic-bezier(0.4, 0, 0.8, 0.3) forwards;
}

/* === Progress bar (scene overlay) === */
.scene-progress {
    position: fixed;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(260px, 78vw);
    height: 6px;
    background: rgba(180, 160, 130, 0.35);
    border-radius: 3px;
    display: none;
    z-index: 50;
    pointer-events: none;
}
body.scene-view .scene-progress { display: block; }
.scene-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f5a623, #f7c96a);
    border-radius: 3px;
    transition: width 0.5s ease;
    min-width: 0;
}

/* === Onboarding wizard === */
#setup-wizard { text-align: center; padding: 0.5rem 0 1rem; }

.wiz-progress {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.75rem;
}
.wiz-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s;
}
.wiz-dot.active { background: hsl(210, 100%, 40%); }

.wiz-sheep { font-size: 3.5rem; margin-bottom: 0.5rem; line-height: 1; }

.wiz-choices {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0 0.5rem;
}
.wiz-choice.wiz-chosen {
    outline: 3px solid hsl(210, 100%, 40%);
    outline-offset: 2px;
}

/* Tic-tac-toe board */
#ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 76px);
    gap: 8px;
    justify-content: center;
    margin: 1rem auto 0.75rem;
}
.ttt-cell {
    width: 76px;
    height: 76px;
    font-size: 2rem;
    background: hsl(210, 30%, 97%);
    border: 2px solid hsl(210, 20%, 85%);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.1s;
    font-family: inherit;
}
.ttt-cell:hover:not(:disabled):not(.ttt-x):not(.ttt-o) {
    background: hsl(210, 60%, 93%);
}
.ttt-cell.ttt-x { color: hsl(210, 100%, 35%); font-weight: 700; }
.ttt-cell.ttt-o { color: hsl(0, 65%, 55%); font-weight: 700; }
.ttt-cell:disabled { cursor: default; }

/* === Utility === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.selected { outline: 3px solid hsl(210, 100%, 30%); }
