/* ============================================================
   journal.css — Shared styles for English Learning Journal
   Place at: public_html/css/journal.css

   THEMING SYSTEM
   Each program (sed / ate / bmg) defines its own colors in
   its JSON config under "theme". JournalApp.init() reads
   those values and sets them on :root as CSS variables.
   Defaults below match the sed palette.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ─────────────────────────────────────────
   CSS VARIABLE DEFAULTS  (sed palette)
   Override per-program via JS:
     document.documentElement.style.setProperty('--nav-bg', '#...')
───────────────────────────────────────── */
:root {
    --nav-bg:               #0B0F2C;

    --btn-welcome-bg:       #00C3FF;
    --btn-welcome-color:    #0B0F2C;

    --btn-checklist-bg:     #58FFBA;
    --btn-checklist-color:  #0B0F2C;

    --btn-reflection-bg:    #8E3FFF;
    --btn-reflection-color: #ffffff;

    --btn-progress-bg:      #00ADA4;
    --btn-progress-color:   #0B0F2C;

    --btn-print-bg:         #EC208B;
    --btn-print-color:      #ffffff;

    --quote-gradient:       linear-gradient(135deg, #00ADA4, #58FFBA);
}

/* ── Base ── */
body {
    font-family: 'Poppins', sans-serif;
    overscroll-behavior-y: contain;
}

/* ── Pages ── */
.page { min-height: 100vh; width: 100%; display: none; background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 50%, #fef7ed 100%); }
.page.active { display: block; }

.pattern-bg {
    background-image:
        radial-gradient(circle at 20% 50%, rgba(59,130,246,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16,185,129,0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(245,158,11,0.1) 0%, transparent 50%);
}

/* ── Nav visibility ── */
.desktop-nav { display: block; }
.mobile-nav  { display: none; }

/* ── Desktop nav background from variable ── */
nav.desktop-nav { background-color: var(--nav-bg); }

/* ── Nav buttons (colors from CSS variables) ── */
.nav-btn {
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
}
.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
/* Glow ring on active tab — uses currentColor so it picks up the button's own color */
.nav-btn.active {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 0 14px currentColor;
    opacity: 1 !important;
}
.nav-btn:not(.active) { opacity: 0.65; }

/* Per-tab colors */
.nav-btn-welcome    { background: var(--btn-welcome-bg);    color: var(--btn-welcome-color); }
.nav-btn-checklist  { background: var(--btn-checklist-bg);  color: var(--btn-checklist-color); }
.nav-btn-reflection { background: var(--btn-reflection-bg); color: var(--btn-reflection-color); }
.nav-btn-progress   { background: var(--btn-progress-bg);   color: var(--btn-progress-color); }
.nav-btn-print      { background: var(--btn-print-bg);      color: var(--btn-print-color); }

/* ── Motivational quote banner ── */
.quote-block {
    background: var(--quote-gradient);
    border-radius: 1rem;
    padding: 1.5rem 2rem;
    color: white;
    max-width: 48rem;
    margin: 0 auto 1.5rem;
}

/* ── Section images ── */
.section-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 1.5rem;
}

/* ── Mobile top nav ── */
.nav-container {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--nav-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    padding: 8px 10px;
    z-index: 40;
}
.nav-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}
.nav-buttons::-webkit-scrollbar { display: none; }

.print-btn {
    width: 100%;
    text-align: center;
    padding: 9px;
    border-radius: 10px;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    background: var(--btn-print-bg);
    color: var(--btn-print-color);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

/* ── Floating logo ── */
.floating-logo { position: fixed; bottom: 20px; left: 20px; z-index: 1000; }
.floating-logo img { width: 185px; height: auto; opacity: 0.9; transition: opacity 0.3s; }
.floating-logo img:hover { opacity: 1; }

/* ── Cards ── */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    padding: 20px;
    width: 100%;
    max-width: 435px;
    box-sizing: border-box;
}
.card h3 { margin: 0 0 12px; font-size: 1.1rem; }

/* ── Grid ── */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1320px;
    margin: 0 auto;
}

/* ── Checkbox / Checkable cards ── */
.checkbox-item { transition: all 0.1s ease; }
.checkable-card { cursor: pointer; }
.checkable-card.checked { background-color: rgb(59 130 246 / 15%); border-radius: 8px; }
.checkable-card p { border-bottom: 2px solid lightgray; padding-bottom: 4px; margin-bottom: 4px; }
.checkable-card p:last-child { border-bottom: none; margin-bottom: 0; }
.checkbox-item:not(.checked):hover { background-color: rgba(59,130,246,0.05); border-radius: 8px; }

/* ── Progress bar ── */
.progress-bar {
    background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
    border-radius: 10px;
    height: 20px;
    transition: width 0.5s ease;
}

/* ── Badge images ── */
.badge-img {
    filter: grayscale(100%) opacity(0.35);
    transition: filter 0.5s ease;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}
.badge-item.unlocked .badge-img { filter: none; }

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* ── Tooltips ── */
.tooltip-wrapper { position: relative; display: inline-block; cursor: help; }
.checkable-card .tooltip-wrapper { display: block; }

.tooltip-text {
    visibility: hidden;
    width: 240px;
    background-color: #f0f4ff;
    color: #000;
    text-align: left;
    border-radius: 0.75rem;
    padding: 10px 12px;
    position: absolute;
    z-index: 100;
    bottom: 120%;
    left: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 0.875rem;
    line-height: 1.4;
    pointer-events: none;
}
.tooltip-wrapper:hover .tooltip-text { visibility: visible; opacity: 1; }
.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 14px;
    border-width: 6px;
    border-style: solid;
    border-color: #f0f4ff transparent transparent transparent;
}

/* ── Skill border colors ── */
.reception-border    { border-left: 4px solid #3b82f6; }
.production-border   { border-left: 4px solid rgb(74 222 128); }
.interaction-border  { border-left: 4px solid rgb(192 132 252); }
.orange-border-welcome  { border-left: 4px solid #f97316; }
.redish-border-welcome  { border-left: 4px solid #db2777; }

/* ── Textareas ── */
textarea.welcome {
    width: 100%; padding: 12px; font-size: 0.95rem;
    border: 2px solid #ddd; border-radius: 8px; resize: vertical;
    outline: none; transition: border-color 0.3s ease;
    font-family: 'Poppins', sans-serif;
}
textarea.welcome:focus         { border-color: #7e22ce; }
textarea.blue-welcome:focus    { border-color: #3b82f6 !important; }
textarea.green-welcome:focus   { border-color: #10b981 !important; }
textarea.orange-welcome:focus  { border-color: #f97316 !important; }

#feedback-other {
    padding: 4px 6px; border: 1px solid #ccc; border-radius: 4px;
    font-size: 14px; margin-top: 10px; font-family: 'Poppins', sans-serif;
}
#feedback-other:focus { border: 2px solid #db2777 !important; outline: none; }

/* ── Buttons ── */
button.welcome {
    margin-top: 12px; padding: 10px 16px; font-size: 0.9rem;
    font-weight: bold; color: white; border: none; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    font-family: 'Poppins', sans-serif;
}
button.welcome:hover { opacity: 0.9; }
.purple { background-color: #a855f7; }
.blue   { background-color: #3b82f6; }
.green  { background-color: #10b981; }
.orange { background-color: #f97316; }
.pink   { background-color: #db2777; }

/* ── Styled checkbox ── */
.styled-checkbox { width: 18px; height: 18px; margin-right: 8px; vertical-align: middle; accent-color: #4a90e2; position: relative; top: -2px; }

/* ── Other checkbox wrapper ── */
.other-checkbox-wrapper { clear: both; display: block; width: 100%; margin-top: 8px; }
.other-checkbox-wrapper label { display: block !important; width: 100% !important; clear: both; }

/* ── Validation ── */
.required-field { border: 2px solid #ef4444 !important; background-color: rgba(239,68,68,0.05) !important; }
.error-message  { color: #ef4444; font-size: 0.875rem; margin-top: 0.5rem; }

/* ── Auto-save indicator ── */
.auto-save-indicator {
    position: fixed; top: 20px; right: 20px;
    background: #10b981; color: white;
    padding: 8px 16px; border-radius: 20px; font-size: 12px;
    opacity: 0; transition: opacity 0.3s ease; z-index: 1000; pointer-events: none;
}
.auto-save-indicator.show { opacity: 1; }

/* ── Thermometer (kept for levels that still use it) ── */
.thermometer-container {
    display: flex; align-items: flex-end; gap: 20px;
    position: relative; transform: rotate(90deg);
    margin-top: -200px; margin-bottom: -200px;
}
.thermometer-wrapper { position: relative; display: flex; flex-direction: column; align-items: center; }
.thermometer { width: 60px; height: 500px; background-color: #fff; border: 4px solid #ccc; border-radius: 30px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; z-index: 1; }
.bulb { width: 94px; height: 94px; background-color: #ccc; border: 4px solid #ccc; border-radius: 50%; box-shadow: inset -5px -5px 10px rgba(255,255,255,0.2); transition: background-color 0.3s, border-color 0.3s; margin-top: -35px; z-index: 1; }
.segment { flex: 1; width: 100%; cursor: pointer; transition: background-color 0.3s; border-top: 2px solid #ccc; }
.segment:first-child { border-top: none; }
.redd, .yelloww, .limee, .greenn { background-color: #f0f0f0; }
.redd.active    { background-color: #e53935; }
.yelloww.active { background-color: #fdd835; }
.limee.active   { background-color: #9ccc65; }
.greenn.active  { background-color: #43a047; }
.emojis { display: flex; flex-direction: column; justify-content: space-between; height: 500px; position: relative; top: -90px; }
.emoji {
    font-size: 24px;
    height: 100px;
    text-align: center;
    transform: rotate(-90deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    line-height: 1;
}
.emoji-label {
    font-size: 8px;
    font-weight: 600;
    color: #374151;
    white-space: normal;     /* allow wrapping on desktop */
    text-align: center;
    max-width: 80px;         /* forces wrapping before it overflows into neighbours */
    line-height: 1.2;
}

/* ── Utility ── */
.bg-darkgreen-100 { background-color: rgb(151 255 187) !important; color: #1a3124 !important; }

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 768px) {
    .desktop-nav { display: none !important; }
    .mobile-nav  { display: block !important; }
    .floating-logo img { width: 125px; height: auto; opacity: 0.9; transition: opacity 0.3s; }
    /* .floating-logo { display: none; } */

    /* Nav is now at top — pages need top padding to clear it (~145px) */
    .page { padding-top: 145px !important; padding-bottom: 20px; }

    /* Nav buttons stretch to fill their grid cell */
    .nav-buttons .nav-btn {
        width: 100%;
        text-align: center;
        border-radius: 10px;
        padding: 0.55rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .card { width: 100%; padding: 1rem; }
    .grid-container { grid-template-columns: 1fr; padding: 0 1rem; }
    .nav-btn { padding: 0.5rem 0.9rem; font-size: 0.8rem; white-space: nowrap; border-radius: 20px; }

    .thermometer-container { flex-direction: row; align-items: center; justify-content: center; gap: 30px; margin: 40px auto; max-width: 300px; transform: none !important; }
    .thermometer { width: 60px; height: 300px; }
    .bulb { width: 80px; height: 80px; margin-top: -30px; }
    .emojis { height: 270px; top: 0; }
    .emoji { font-size: 28px; height: 50px; line-height: 1; transform: none !important; flex-direction: row; gap: 6px; }
    .emoji-label { font-size: 10px; align-self: center; white-space: nowrap; max-width: none; }

    .tooltip-text { width: 280px; max-width: 90vw; left: 50%; transform: translateX(-50%); }
    .tooltip-text::after { left: calc(50% - 6px); }
    #feedback-other { margin-left: 0 !important; width: 100%; }
}

@media (max-width: 480px) {
    .mobile-nav { display: block !important; }
    .text-6xl   { font-size: 3rem; }
    .text-5xl   { font-size: 2.5rem; }
    .card h3    { font-size: 1rem; }
    .nav-btn    { padding: 0.4rem 0.7rem; font-size: 0.72rem; }
    .tooltip-text { width: 250px; max-width: 85vw; font-size: 0.8rem; padding: 8px 10px; }
}
