/* MyWay Studio — Child UI */
:root {
    --mws-primary:    #6C63FF;
    --mws-secondary:  #FF6B9D;
    --mws-calm-bg:    #F0F4FF;
    --mws-calm-text:  #2D2D3A;
    --mws-card-bg:    #FFFFFF;
    --mws-radius:     16px;
    --mws-shadow:     0 4px 20px rgba(108,99,255,0.12);
    --mws-font:       'Segoe UI', Arial, sans-serif;
    --mws-btn-size:   56px;
}

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

body.mws-child-layout {
    background: var(--mws-calm-bg);
    font-family: var(--mws-font);
    color: var(--mws-calm-text);
    min-height: 100vh;
}

.mws-child-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 80px;
    min-height: 100vh;
    position: relative;
}

/* Help Button */
.mws-help-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    width: var(--mws-btn-size);
    height: var(--mws-btn-size);
    background: var(--mws-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--mws-shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.mws-help-label {
    font-size: 10px;
    font-weight: 600;
}

/* Bottom Nav */
.mws-child-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 12px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 999;
}

.mws-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--mws-calm-text);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    transition: background 0.2s;
}

.mws-nav-item:hover,
.mws-nav-item.active {
    background: var(--mws-calm-bg);
    color: var(--mws-primary);
}

.mws-nav-icon { font-size: 22px; }

/* Cards */
.mws-card {
    background: var(--mws-card-bg);
    border-radius: var(--mws-radius);
    box-shadow: var(--mws-shadow);
    padding: 20px;
    margin-bottom: 16px;
}

/* Level adjustments */
.mws-level-level_3 .mws-help-btn { width: 64px; height: 64px; font-size: 24px; }
.mws-level-level_3 .mws-nav-icon { font-size: 28px; }

/* ===== RTL Support ===== */
[dir="rtl"] .mws-child-wrap,
[dir="rtl"] .mws-home,
[dir="rtl"] .mws-page {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .mws-greeting { text-align: right; }
[dir="rtl"] .mws-aac-bar { flex-direction: row-reverse; }
[dir="rtl"] .mws-help-btn { right: auto; left: 20px; }
[dir="rtl"] .mws-logout { left: auto; right: 20px; }
[dir="rtl"] #mws-lang-sw { right: auto; left: 14px; }
[dir="rtl"] #mws-lang-opts { align-items: flex-start; }
[dir="rtl"] .mws-nav-item { direction: rtl; }
[dir="rtl"] .mws-card { direction: rtl; }
[dir="rtl"] .back { transform: rotate(180deg); }
[dir="rtl"] .mws-back-btn { transform: rotate(180deg); }
[dir="rtl"] .mws-topbar { flex-direction: row-reverse; }

/* Hebrew font */
[lang="he"] { font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif; }
/* Arabic font */
[lang="ar"] { font-family: 'Segoe UI', 'Tahoma', Arial, sans-serif; }

/* ===== RTL Full Fix ===== */
[dir="rtl"] { direction: rtl; }
[dir="rtl"] .mws-home,
[dir="rtl"] .mws-page,
[dir="rtl"] .wrap { direction: rtl; text-align: right; }

[dir="rtl"] .mws-header { flex-direction: row-reverse; }
[dir="rtl"] .mws-greeting { text-align: right; }
[dir="rtl"] .mws-aac-bar { flex-direction: row-reverse; }
[dir="rtl"] .mws-aac-text { text-align: right; }

[dir="rtl"] .mws-nav { direction: rtl; }
[dir="rtl"] .mws-nav-item { direction: rtl; }

[dir="rtl"] .mws-topbar { flex-direction: row-reverse; }
[dir="rtl"] .mws-back-btn,
[dir="rtl"] .back { order: 2; }

[dir="rtl"] .mws-help-btn { right: auto !important; left: 20px !important; }
[dir="rtl"] .mws-logout   { left: auto !important; right: 20px !important; }
[dir="rtl"] #mws-lang-sw  { left: auto !important; right: 14px !important; }
[dir="rtl"] #mws-lang-opts { align-items: flex-end !important; }

[dir="rtl"] .mws-card { direction: rtl; }
[dir="rtl"] .mws-modal { direction: rtl; text-align: right; }
[dir="rtl"] .mws-modal-btn { flex-direction: row-reverse; }

[dir="rtl"] .mws-toolbar-row { flex-direction: row-reverse; }

[dir="rtl"] .story-card { direction: rtl; }
[dir="rtl"] .mission-card { flex-direction: row-reverse; }
[dir="rtl"] .activity-item { flex-direction: row-reverse; }
[dir="rtl"] .badge-item { direction: rtl; }

/* RTL Fonts */
[lang="he"] * { font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif !important; }
[lang="ar"] * { font-family: 'Segoe UI', Tahoma, Arial, sans-serif !important; }
