// Thinkera Academy — rules added after Boost.

// Arabic is a joined script: never letter-space it.
body { letter-spacing: 0; }

// ---------------------------------------------------------------- top bar
.navbar.fixed-top {
    background: #fff !important;
    border-bottom: 1px solid #DDE3EC;
    box-shadow: 0 1px 2px rgba(15, 27, 45, .05);
}
.navbar .navbar-brand .logo { max-height: 34px; }
.navbar .primary-navigation .nav-link.active,
.navbar .primary-navigation .nav-link[aria-current="true"] {
    color: $tk-royal;
    border-bottom-color: $tk-royal !important;
}

// ---------------------------------------------------------------- buttons
.btn-primary { background-color: $tk-royal; border-color: $tk-royal; }
.btn-primary:hover, .btn-primary:focus { background-color: $tk-royal-600; border-color: $tk-royal-600; }
.btn-secondary { background-color: #fff; border-color: #C3CDDC; color: $tk-royal; }
.btn-secondary:hover { background-color: $tk-pale; color: $tk-royal; }
:focus-visible { outline: 3px solid $tk-royal-600; outline-offset: 2px; }

// ---------------------------------------------------------------- login page
.pagelayout-login #page {
    background:
        radial-gradient(circle at 85% 0%, rgba(143, 179, 230, .22), transparent 45%),
        linear-gradient(160deg, $tk-royal 0%, #0C2B58 45%, $tk-navy 100%);
    min-height: 100vh;
}
.pagelayout-login .login-container {
    background: #fff;
    border-radius: 22px;
    border: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    padding: 2.5rem 2.25rem;
}
.pagelayout-login .login-logo img { max-height: 64px; }
.pagelayout-login h1.login-heading { color: $tk-ink; font-weight: 600; }
.pagelayout-login .login-divider { border-color: #DDE3EC; }
.pagelayout-login #loginbtn { width: 100%; }

// Thinkera side panel: brand navy with the teal glow instead of the vendor's photo and figures
.login-layout-left {
    background: radial-gradient(circle at 15% 0%, rgba(143, 179, 230, .24), transparent 50%), $tk-navy !important;
    background-image: radial-gradient(circle at 15% 0%, rgba(143, 179, 230, .24), transparent 50%) !important;
    &::before, &::after { display: none !important; content: none !important; }
}
.thinkera-login-panel { color: #D7E3F5; max-width: 480px; }
.thinkera-login-panel h1 { color: #fff; font-weight: 700; line-height: 1.35; }
.thinkera-login-logo {
    display: block; width: 220px; height: 44px; margin-bottom: 2.5rem;
    background: url([[pix:theme|logo-white]]) no-repeat left center / contain;
}
[dir="rtl"] .thinkera-login-logo { background-position: right center; }
.thinkera-login-facts { display: flex; gap: 2rem; margin: 2rem 0 0; }
.thinkera-login-facts li { display: flex; flex-direction: column; }
.thinkera-login-facts strong { font-size: 2rem; color: #fff; line-height: 1.1; }
.thinkera-login-facts span { font-size: .85rem; color: #A9BEDB; }

// ---------------------------------------------------------------- page chrome
// A Latin title in an Arabic page (a lesson named "1-1 How AI Works") keeps its own reading order.
.page-header-headings h1, #page-header h1, .breadcrumb-item, .activity-name, .instancename { unicode-bidi: plaintext; }
.page-header-headings h1, #page-header h1 { color: $tk-ink; }
.card { box-shadow: 0 1px 2px rgba(15, 27, 45, .05); }
.course-card .card-img, .dashboard-card-img { background-color: $tk-royal !important; }
.progress-bar { background-color: $tk-azure; }

// ---------------------------------------------------------------- footer
#page-footer .btn-footer-popover { background-color: $tk-royal !important; color: #fff; }
#page-footer .thinkera-footer-brand { display: flex; align-items: center; gap: .75rem; }
#page-footer .thinkera-footer-logo {
    display: inline-block; width: 130px; height: 26px; flex: none;
    background: url([[pix:theme|logo]]) no-repeat center / contain;
}
#page-footer .thinkera-footer-brand small { color: $tk-muted; }

// ---------------------------------------------------------------- the protected video player
.filter-tkvideo { box-shadow: 0 10px 30px rgba(15, 27, 45, .12); }

// ---------------------------------------------------------------- sign-in and sign-up, mobile first
// Every field 16px (below that, iPhone zooms in on focus) and every tap target at least 48px high.
.pagelayout-login {
    input.form-control, select.form-select, .custom-select { font-size: 16px; min-height: 48px; border-radius: 12px; }
    .btn { min-height: 48px; }
    // "No account? Create account" becomes a full-width outlined button under the sign-in button
    .text-center.small:has(> a[href$="/login/signup.php"]) {
        font-size: 1rem !important; display: flex; flex-direction: column; gap: .5rem; align-items: stretch;
    }
    a[href$="/login/signup.php"] {
        display: flex; align-items: center; justify-content: center; min-height: 48px;
        border: 2px solid $tk-royal; border-radius: 999px; color: $tk-royal; font-weight: 600; text-decoration: none;
        &:hover, &:focus { background: $tk-pale; }
    }
    // "Sign in with Google" (shown once GOOGLE_OAUTH_* is set in .env)
    .login-identityprovider-btn {
        display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 48px;
        border: 1px solid #C3CDDC; border-radius: 999px; background: #fff; color: $tk-ink; font-weight: 600;
        &:hover { background: $tk-pale; }
        img { width: 20px; height: 20px; }
    }
    .login-identityproviders { margin-bottom: 1rem; }
}
// The sign-up page: same card as sign-in, labels above fields on phones
#page-login-signup {
    .login-container { max-width: 560px; margin-inline: auto; }
    .mform .fitem { margin-bottom: .9rem; }
    #fitem_id_passwordpolicyinfo .form-control-static { font-size: .85rem; color: $tk-muted; }
    @include media-breakpoint-down(sm) {
        .login-container { padding: 1.5rem 1.1rem; border-radius: 18px; }
        .mform .col-md-3, .mform .col-md-9 { flex: 0 0 100%; max-width: 100%; }
    }
}

// The sign-in page shows the product only: Arabic is the one language, and no vendor help or cookie footnote.
.pagelayout-login {
    .login-cookiesnotice, .login-container .action-menu, .login-languagemenu, .btn-footer-popover,
    [data-region="footer-container-popover"], .logininfo { display: none !important; }
}
.progress-bar { background-color: $tk-azure; }

// ------------------------------------------------------- the reading size a student chose
// Everything in this theme is sized in rem, so moving the root size scales the text, the buttons and the
// space around them together — which is what someone who wants larger text actually wants. The two bars
// keep their own size so the frame of the app stays the shape it is on a phone.
:root:has(body.tk-text-large) { font-size: 17.6px; }
:root:has(body.tk-text-xlarge) { font-size: 19.2px; }
body:is(.tk-text-large, .tk-text-xlarge) {
    .tk-appbar, .tk-tabbar, .tk-footer { font-size: 16px; }
}

// ---------------------------------------------------------------- the floating quick links (templates/quicklinks.mustache)
// Mobile first: on a phone one 56px round button in the corner, above the tab bar when there is one; it is the link
// itself when there is one link, and opens a short list when there are more. From tablet width up the links show
// labelled, and the tab bar is gone, so they sit lower.
.tkf {
    position: fixed; z-index: 1025; inset-inline-end: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; align-items: flex-end;
}
.tkf--tabbar { bottom: calc(76px + env(safe-area-inset-bottom)); }
.tkf-fab, .tkf-one {
    display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
    background: $tk-royal; color: #fff; box-shadow: 0 8px 22px rgba(10, 22, 40, .28); cursor: pointer;
    list-style: none; border: 2px solid #fff;
    &::-webkit-details-marker, &::marker { display: none; content: ''; }
    &:hover, &:focus { color: #fff; text-decoration: none; }
    &:focus-visible { outline: 3px solid $tk-teal; outline-offset: 2px; }
}
.tkf-one .tkf-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tkf-menu { position: relative; }
.tkf-close { display: none; }
.tkf-menu[open] .tkf-open { display: none; }
.tkf-menu[open] .tkf-close { display: block; }
.tkf-list {
    position: absolute; inset-inline-end: 0; bottom: 66px;
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.tkf-link {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px; white-space: nowrap;
    border-radius: 999px; border: 1px solid #E3E9F2; background: #fff; color: $tk-royal; font-weight: 700; font-size: .95rem;
    text-decoration: none; box-shadow: 0 8px 22px rgba(10, 22, 40, .18);
    &:hover, &:focus { color: $tk-royal; text-decoration: none; }
    &:focus-visible { outline: 3px solid $tk-teal; outline-offset: 2px; }
}
.tkf-link--primary { background: $tk-royal; border-color: #fff; color: #fff; &:hover, &:focus { color: #fff; } }
.tkf-wide { display: none; }
// an icon in a flex row keeps its size
.tkf-link svg, .tkf-one svg, .tkf-fab svg { flex: none; max-width: none; }
@include media-breakpoint-up(md) {
    .tkf, .tkf--tabbar { bottom: calc(24px + env(safe-area-inset-bottom)); inset-inline-end: 24px; }
    .tkf-menu { display: none; }
    .tkf-wide { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
    .tkf-one {
        width: auto; height: auto; min-height: 48px; padding: 0 18px 0 14px; border-radius: 999px; gap: 8px;
        display: inline-flex; font-weight: 700; font-size: .95rem; border-color: #fff;
        .tkf-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    }
}
@media (prefers-reduced-motion: no-preference) {
    .tkf-link, .tkf-fab, .tkf-one { transition: transform .15s ease, box-shadow .15s ease; }
    .tkf-link:hover, .tkf-one:hover { transform: translateY(-2px); }
}
// the page ends above the button, so the footer's last line is never under it
.tk-footer, .tkt-foot, .tk-auth-foot { padding-bottom: 96px !important; }
