/* === Say & Play Student Portal — Illustrated Theme === */
/* Google Fonts loaded via <link> in HTML head for better performance */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:            #F3E4C9;
    --brown:         #5c3d1e;
    --brown-mid:     #8b6340;
    --brown-light:   #faf3e8;
    --brown-border:  #b8936a;
    --olive:         #BAC09C;
    --olive-dark:    #6b7050;
    --white:         #ffffff;
    --text:          #3d2b1f;
    --text-muted:    #8b7060;
    --green:         #4a7a35;
    --green-light:   #e8f5e0;
    --red:           #c0392b;
    --red-light:     #fdecea;
    --orange:        #d4621a;
    --orange-light:  #fff0e0;
    --blue:          #2563eb;
    --blue-light:    #dbeafe;
    --purple:        #7c3aed;
    --radius:        18px;
    --radius-sm:     10px;
    --border:        2px solid var(--brown-border);
    --shadow:        0 2px 10px rgba(91,61,30,0.08);
    --shadow-md:     0 4px 20px rgba(91,61,30,0.13);
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 19px;
    line-height: 1.7;
}

/* === Navbar === */
.navbar {
    background: #6b7050;
    padding: 0 1.5rem;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.nav-logo { height: 56px; width: auto; }
@media (max-width: 768px) {
    .navbar {
        height: 56px;
        padding: 0 0.75rem;
    }

    .nav-logo {
        height: 28px;
        width: auto;
    }
}
.nav-right { display: flex; align-items: center; gap: 1.25rem; }
.nav-icon-wrap {
    display: flex; align-items: center; gap: 0.4rem;
    color: rgba(255,255,255,0.85); font-size: 0.88rem; font-weight: 700;
}
.nav-icon-wrap img { width: 20px; height: 20px; filter: brightness(0) invert(1); opacity: 0.85; }
.lang-switcher { display: flex; align-items: center; gap: 0.35rem; }
.lang-switcher a { color: rgba(255,255,255,0.6); text-decoration: none; font-weight: 800; font-size: 0.85rem; }
.lang-switcher a.active { color: #fff; }
.lang-switcher span { color: rgba(255,255,255,0.3); }
.nav-logout { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 0.88rem; font-weight: 700; }
.nav-logout:hover { color: #fff; }

/* Login page lang switcher */
.lang-switcher-top { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: flex; align-items: center; gap: 0.4rem; }
.lang-switcher-top a { color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: 0.85rem; }
.lang-switcher-top a.active { color: var(--text); }
.lang-switcher-top span { color: var(--brown-border); }

/* === Container === */
.container { max-width: 860px; margin: 0 auto; padding: 1.75rem 1rem 5rem; position: relative; }

/* === Alerts === */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; font-weight: 700; }
.alert-error   { background: var(--red-light); color: var(--red); border-left: 4px solid var(--red); }
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }

/* === Login === */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box {
    background: var(--white); border-radius: var(--radius);
    border: var(--border); box-shadow: var(--shadow-md);
    padding: 2rem 2.25rem; width: 100%; max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo img { height: 52px; width: auto; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.7rem; color: var(--olive-dark); font-weight: 900; }
.login-logo p  { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; font-weight: 600; }

.tabs { display: flex; margin-bottom: 1.5rem; border-bottom: 2px solid var(--bg); }
.tab {
    flex: 1; text-align: center; padding: 0.65rem; text-decoration: none;
    color: var(--text-muted); font-size: 0.9rem; font-weight: 800;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.15s;
}
.tab.active { color: var(--olive-dark); border-bottom-color: var(--olive-dark); }
.tab:hover:not(.active) { color: var(--text); }
.switch-tab { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.switch-tab a { color: var(--olive); text-decoration: none; font-weight: 800; }
.hint { font-size: 0.82rem; color: var(--text-muted); text-align: center; margin-top: 0.75rem; font-weight: 600; }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem;
}
.form-group input {
    width: 100%; padding: 0.65rem 0.9rem; border: var(--border);
    border-radius: var(--radius-sm); font-size: 0.95rem; font-family: 'Nunito', sans-serif;
    color: var(--text); background: var(--white); transition: border-color 0.15s;
}
.form-group input:focus { outline: none; border-color: var(--olive); }

/* === Buttons === */
.btn {
    display: inline-block; padding: 0.75rem 1.5rem; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 800; cursor: pointer;
    border: none; text-decoration: none; transition: opacity 0.15s, transform 0.1s;
    font-family: 'Nunito', sans-serif;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #6b7050; color: var(--white); }
.btn-primary:hover { opacity: 0.9; }
.btn-full { width: 100%; text-align: center; }

/* === Section titles === */
.section-title {
    font-size: 0.82rem; font-weight: 900; color: var(--brown-mid);
    text-transform: uppercase; letter-spacing: 0.07em;
    margin-bottom: 0.75rem; margin-top: 2rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.empty-state { color: var(--text-muted); font-size: 0.88rem; font-style: italic; font-weight: 600; }
.muted { color: var(--text-muted); }
.green { color: var(--green); }
.red   { color: var(--red); }
.gray  { color: var(--text-muted); }

/* === Child block === */
.child-block { margin-bottom: 2.5rem; position: relative; }

.child-header {
    background: var(--white);
    border-radius: var(--radius);
    border: var(--border);
    box-shadow: var(--shadow-md);
    padding: 1.25rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem; gap: 1rem;
    position: relative; overflow: hidden;
}

.child-header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.child-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    border: 3px solid var(--brown-border);
    background: var(--brown-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.child-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.15) translateX(8px);
    transform-origin: center;
    display: block;
}

.child-avatar-letter {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--brown-mid);
}

.child-name { font-size: 1.5rem; font-weight: 900; margin-bottom: 0.3rem; color: var(--text); }
.child-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.level-badge {
    background: var(--brown-light); color: var(--brown-mid);
    font-size: 0.75rem; font-weight: 800; padding: 0.2rem 0.75rem;
    border-radius: 20px; border: 1.5px solid var(--brown-border);
}
.group-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 700; }

.attendance-stats { display: flex; gap: 1.5rem; text-align: center; flex-shrink: 0; }
.stat-circle {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--brown); color: var(--white);
    font-size: 1.6rem; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.35rem;
}
.stat-circle.absent { background: var(--red); }
.stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 800; }

/* === Cards grid === */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    position: relative;
}
@media (max-width: 580px) { .cards-grid { grid-template-columns: 1fr; } }

.card {
    background: var(--white);
    border-radius: var(--radius);
    border: var(--border);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    position: relative;
}
.card h3 {
    font-size: 0.88rem; font-weight: 900; color: var(--brown-mid);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 0.9rem; display: flex; align-items: center; gap: 0.6rem;
}
.card-icon-img { width: 28px; height: 28px; flex-shrink: 0; }

/* Full-width cards */
.card-links { grid-column: 1 / -1; }

.card-coming-soon {
    border: 2px dashed var(--brown-border);
    box-shadow: none; background: var(--brown-light);
}
.coming-soon-text { font-size: 0.85rem; color: var(--text-muted); font-style: italic; font-weight: 600; }

/* === Decorative stars === */
.star-deco {
    position: absolute; pointer-events: none;
    width: 22px; height: 22px; opacity: 0.8;
    z-index: 0;
}
.star-deco.sm { width: 15px; height: 15px; }
.star-deco.lg { width: 30px; height: 30px; }
.trees-deco {
    position: absolute; pointer-events: none;
    width: 110px; height: auto; opacity: 0.45;
    z-index: 0;
}
/* All real content sits above decorations */
.child-block { isolation: isolate; }
.child-header { z-index: 1; }
.cards-grid > .card { position: relative; z-index: 1; }
.section-title, .card { position: relative; z-index: 1; }

/* === Link buttons === */
.link-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.link-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1.1rem; border-radius: 10px; font-size: 0.88rem;
    font-weight: 800; text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    font-family: 'Nunito', sans-serif;
}
.link-btn:active { transform: scale(0.97); }
.link-btn:hover { opacity: 0.85; }
.link-btn-zoom    { background: #2D8CFF; color: #fff; }
.link-btn-pm      { background: var(--purple); color: #fff; }
.link-btn-cabinet { background: #6b7050; color: #fff; }
.link-btn-drive   { background: var(--bg); color: var(--text); border: var(--border); }

/* === Lesson list === */
.lesson-list { display: flex; flex-direction: column; }
.lesson-row {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0; border-bottom: 1.5px solid var(--bg);
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row.lesson-cancelled { opacity: 0.5; }
.lesson-row-time { min-width: 80px; flex-shrink: 0; }
.lesson-row-date { font-size: 0.85rem; color: var(--text-muted); font-weight: 700; }
.lesson-row-clock { font-size: 1.1rem; font-weight: 900; }
.lesson-row-topic { flex: 1; font-size: 0.95rem; font-weight: 600; }

/* === Attendance === */
.att-list { display: flex; flex-direction: column; }
.att-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.55rem 0; border-bottom: 1.5px solid var(--bg);
}
.att-row:last-child { border-bottom: none; }
.att-date { font-size: 0.92rem; color: var(--text-muted); font-weight: 700; }
.att-right { display: flex; align-items: center; gap: 0.5rem; }
.att-badge {
    font-size: 0.82rem; font-weight: 800; padding: 0.25rem 0.85rem;
    border-radius: 20px; white-space: nowrap;
}
.att-present { background: var(--green-light); color: var(--green); border: 1.5px solid var(--green); }
.att-absent  { background: var(--red-light);   color: var(--red);   border: 1.5px solid var(--red); }
.att-late    { background: var(--orange-light); color: var(--orange); border: 1.5px solid var(--orange); }
.skip-type {
    font-size: 0.75rem; color: var(--text-muted); font-weight: 700;
    background: var(--bg); padding: 0.15rem 0.5rem; border-radius: 10px;
    border: 1.5px solid var(--brown-border);
}

/* === Notes tabs === */
.notes-tabs { display: flex; margin-bottom: 0.85rem; border-bottom: 2px solid var(--bg); gap: 0; }
.notes-tab {
    padding: 0.35rem 0.85rem; font-size: 0.75rem; font-weight: 900;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
    cursor: pointer; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -2px; background: none; transition: color 0.15s;
    font-family: 'Nunito', sans-serif;
}
.notes-tab.active { color: var(--brown-mid); border-bottom-color: var(--brown-mid); }
.notes-panel { display: none; }
.notes-panel.active { display: block; }

/* === Notes text === */
.notes-text { font-size: 1rem; color: var(--text); line-height: 1.7; white-space: pre-wrap; font-weight: 600; }

/* === Status badges === */
.status-badge {
    font-size: 0.72rem; font-weight: 800;
    padding: 0.2rem 0.75rem; border-radius: 20px; white-space: nowrap;
}
.status-scheduled { background: var(--blue-light); color: var(--blue); }
.status-completed { background: var(--green-light); color: var(--green); }
.status-cancelled { background: var(--red-light); color: var(--red); }
.status-partial   { background: var(--orange-light); color: var(--orange); }

/* === Payments table === */
.payments-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.payments-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 400px; }
.payments-table th {
    text-align: left; padding: 0.5rem 0.75rem;
    font-size: 0.72rem; font-weight: 900; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 2px solid var(--bg);
}
.payments-table td { padding: 0.7rem 0.75rem; border-bottom: 1.5px solid var(--bg); font-weight: 600; }
.payments-table tr:last-child td { border-bottom: none; }
.payments-table tr.row-overdue td { background: #fff5f0; }

@media (max-width: 520px) {
    .child-header { flex-direction: column; align-items: flex-start; }
}

/* === Class Updates Feed === */
.update-feed-wrap {
    position: relative;
}
.update-feed-wrap::after {
    content: '';
    position: absolute;
    bottom: 28px; left: 0; right: 8px;
    height: 64px;
    background: linear-gradient(to bottom, transparent, var(--white));
    pointer-events: none;
    border-radius: 0 0 var(--radius) var(--radius);
    transition: opacity 0.3s;
    z-index: 2;
}
.update-feed-wrap.feed-at-end::after { opacity: 0; }
.feed-scroll-hint {
    text-align: center;
    font-size: 0.7rem; font-weight: 800;
    color: var(--text-muted);
    padding: 0.3rem 0 0.1rem;
    transition: opacity 0.3s;
    letter-spacing: 0.03em;
}
.update-feed-wrap.feed-at-end .feed-scroll-hint { opacity: 0; pointer-events: none; }
.update-feed {
    max-height: 820px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.25rem 0.25rem 0.25rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--brown-border) transparent;
}
.update-feed::-webkit-scrollbar { width: 5px; }
.update-feed::-webkit-scrollbar-track { background: transparent; }
.update-feed::-webkit-scrollbar-thumb { background: var(--brown-border); border-radius: 10px; }

.update-item {
    background: var(--brown-light);
    border: 1.5px solid var(--brown-border);
    border-radius: 4px 18px 18px 18px;
    padding: 0.85rem 1.1rem 0.75rem;
    box-shadow: var(--shadow);
    position: relative;
}
.update-header {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.5rem; margin-bottom: 0.5rem;
}
.update-date {
    font-size: 0.74rem; font-weight: 800; color: var(--text-muted);
}
.update-topic {
    font-size: 0.78rem; font-weight: 900; color: var(--olive-dark);
    background: rgba(186,192,156,0.35);
    padding: 0.1rem 0.6rem; border-radius: 20px;
}
.update-summary {
    font-size: 0.95rem; color: var(--text); line-height: 1.65;
    font-weight: 600; margin-bottom: 0.5rem;
}
.update-summary p { margin: 0 0 0.65rem; }
.update-summary p:last-child { margin-bottom: 0; }
.update-latest-badge {
    font-size: 0.63rem; font-weight: 900;
    background: var(--green); color: var(--white);
    padding: 0.1rem 0.55rem; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.06em;
    flex-shrink: 0;
}
.update-summary-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.update-summary-clamp.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}
@media (max-width: 768px) {
    .update-summary-clamp { -webkit-line-clamp: 5; }
}
.update-read-more {
    background: none; border: none;
    font-size: 0.78rem; font-weight: 800;
    color: var(--olive-dark); cursor: pointer;
    padding: 0.15rem 0; text-decoration: underline;
    display: none; margin-top: 0.2rem;
}
.update-focus-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.update-focus-pill {
    font-size: 0.75rem; font-weight: 700;
    padding: 0.2rem 0.65rem; border-radius: 20px;
}
.pill-vocab   { background: var(--blue-light); color: var(--blue); }
.pill-grammar { background: var(--orange-light); color: var(--orange); }
.pill-speak   { background: var(--green-light); color: var(--green); }
.update-hw-block {
    font-size: 0.88rem; font-weight: 600; color: var(--text);
    background: #fff8ee; border-left: 3px solid var(--orange);
    padding: 0.4rem 0.75rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 0.5rem;
}
.update-hw-label { font-weight: 800; color: var(--orange); margin-right: 0.3rem; }
.update-hw-block p { margin: 0.3rem 0 0; display: inline; }
.update-hw-block p:first-child { display: inline; }
.update-links-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }

@media (max-width: 768px) {
    .update-feed { max-height: 600px; }
}
