/* =====================================================================
   Learning Portal — Design System
   Re-themed to GrOKarSAB Technology brand:
   #222222 primary | #6FECFF secondary | #BAEEFF third | #E02020 accent-red
   Type: Inter (display) / DM Sans (body) / JetBrains Mono (certificate codes)
   ===================================================================== */

:root {
    --bg:           #F7FEFF;   /* brand bg-light */
    --surface:      #FFFFFF;
    --ink:          #222222;   /* brand primarycolor */
    --ink-dim:      #6B7280;   /* brand text-muted */
    --border:       #D8F5FA;   /* brand border-light */

    --primary:      #00B5CE;   /* brand cyandark */
    --primary-dark: #222222;   /* brand primarycolor */
    --primary-soft: #E8FDFF;   /* brand cyanlight */

    --accent:       #E02020;   /* brand redaccent — free badges, CTAs, certificate seal */
    --accent-soft:  #FFF0F0;   /* brand redlight */

    --success:      #0D9488;   /* progress / completion */
    --success-soft: #DEF7F3;

    --danger:       #C01515;   /* brand red-hover shade, kept distinct from accent */
    --danger-soft:  #FCE8E8;

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 22px;
    --shadow-sm: 0 2px 12px rgba(111, 236, 255, 0.12);
    --shadow:    0 8px 30px rgba(111, 236, 255, 0.18);
    --transition: 180ms ease;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

h1, h2, h3, h4, .display {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.text-mono { font-family: 'JetBrains Mono', monospace; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Visible keyboard focus everywhere — accessibility floor, never remove. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Navbar
   --------------------------------------------------------------------- */
.lp-navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}
.lp-navbar .navbar-brand {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--ink);
}
.lp-navbar .navbar-brand span { color: var(--primary); }
.lp-navbar .nav-link {
    color: var(--ink-dim);
    font-weight: 500;
    padding: 0.5rem 1rem !important;
}
.lp-navbar .nav-link.active, .lp-navbar .nav-link:hover { color: var(--primary); }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn-lp-primary {
    background: var(--primary);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.4rem;
    transition: background var(--transition), transform var(--transition);
}
.btn-lp-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }

.btn-lp-accent {
    background: var(--accent);
    border: none;
    color: #fff;
    font-weight: 700;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.4rem;
}
.btn-lp-accent:hover { background: #C01515; color: #fff; }

.btn-lp-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.3rem;
    font-weight: 600;
}
.btn-lp-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */
.lp-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 4rem 0 5rem;
}
.lp-hero h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.2rem); }
.lp-hero p { color: rgba(255,255,255,0.85); font-size: 1.15rem; max-width: 640px; }

/* ---------------------------------------------------------------------
   Cards: courses / modules / topics
   --------------------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.5rem;
}

.lp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.lp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lp-card .lp-card-thumb {
    aspect-ratio: 16/9;
    background: var(--primary-soft);
    object-fit: cover;
    width: 100%;
}
.lp-card-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.lp-card-body h3 { font-size: 1.05rem; margin: 0; }
.lp-card-body p { color: var(--ink-dim); font-size: 0.92rem; margin: 0; flex: 1; }

.badge-free {
    background: var(--success-soft); color: var(--success);
    font-weight: 700; font-size: 0.75rem; padding: 0.3rem 0.65rem;
    border-radius: 999px; display: inline-block; width: fit-content;
}
.badge-price {
    background: var(--accent-soft); color: #A81616;
    font-weight: 700; font-size: 0.75rem; padding: 0.3rem 0.65rem;
    border-radius: 999px; display: inline-block; width: fit-content;
}

/* ---------------------------------------------------------------------
   Signature element: the Learning Path rail
   A vertical line connecting numbered module nodes in curriculum order —
   this *is* legitimate sequence (modules are meant to be taken in order),
   which is why numbering earns its place here.
   --------------------------------------------------------------------- */
.lp-path {
    position: relative;
    padding-left: 3.25rem;
}
.lp-path::before {
    content: '';
    position: absolute;
    left: 1.1rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 3px;
    background: var(--border);
    border-radius: 2px;
}
.lp-path-node { position: relative; margin-bottom: 1.5rem; }
.lp-path-node:last-child { margin-bottom: 0; }
.lp-path-node::before {
    content: attr(data-index);
    position: absolute;
    left: -3.25rem;
    top: 0.4rem;
    width: 2.4rem; height: 2.4rem;
    background: var(--surface);
    border: 2.5px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif; font-weight: 700; font-size: 0.95rem;
    z-index: 1;
}
.lp-path-node.is-done::before {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.lp-path-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------
   Topic / lesson page
   --------------------------------------------------------------------- */
.video-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}
.video-frame iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}
.topic-screenshot {
    width: 100%; border-radius: var(--radius); border: 1px solid var(--border);
}

/* ---------------------------------------------------------------------
   Progress bar
   --------------------------------------------------------------------- */
.lp-progress-track {
    background: var(--border);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}
.lp-progress-fill {
    background: linear-gradient(90deg, var(--success), #14B8A6);
    height: 100%;
    transition: width 400ms ease;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.lp-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    box-shadow: var(--shadow);
    max-width: 460px;
    margin: 0 auto;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.is-invalid ~ .invalid-feedback { display: block; }
.is-invalid { border-color: var(--danger) !important; }

/* ---------------------------------------------------------------------
   Certificate
   --------------------------------------------------------------------- */
.certificate-frame {
    background: var(--surface);
    border: 10px solid var(--primary);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}
.certificate-frame::before {
    content: '';
    position: absolute; inset: 14px;
    border: 1.5px solid var(--accent);
    border-radius: 10px;
    pointer-events: none;
}
.certificate-seal {
    width: 90px; height: 90px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem; font-weight: 800; font-family: 'Inter', sans-serif;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.lp-footer {
    background: var(--ink);
    color: rgba(255,255,255,0.75);
    padding: 2.5rem 0;
    margin-top: 4rem;
}
.lp-footer a { color: #fff; }



/* ---------------------------------------------------------------------
   Responsive breakpoints — mobile / tablet / laptop / large display (TV)
   Bootstrap's grid already handles most of this; these refine the parts
   Bootstrap doesn't (hero sizing, path rail, card density).
   --------------------------------------------------------------------- */

/* Mobile phones */
@media (max-width: 575.98px) {
    .lp-hero { padding: 2.5rem 0 3rem; text-align: center; }
    .lp-form-card { padding: 1.5rem; margin: 0 1rem; }
    .lp-path { padding-left: 2.75rem; }
    .lp-path-node::before { left: -2.75rem; width: 2rem; height: 2rem; font-size: 0.8rem; }
    .card-grid { grid-template-columns: 1fr; }
}

/* Tablets */
@media (min-width: 576px) and (max-width: 991.98px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Laptops / desktops */
@media (min-width: 992px) and (max-width: 1399.98px) {
    .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Large displays / TVs / wide monitors — widen the content rail so text
   doesn't stretch edge-to-edge into unreadable line lengths. */
@media (min-width: 1400px) {
    .card-grid { grid-template-columns: repeat(4, 1fr); }
    .lp-container-wide { max-width: 1320px; margin: 0 auto; }
    body { font-size: 17px; }
}

/* ---------------------------------------------------------------------
   Topic rich-text content (admin/topics.php editor output)
   --------------------------------------------------------------------- */
.topic-editor-toolbar.ql-toolbar.ql-snow {
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--surface);
}
.topic-editor-body.ql-container.ql-snow {
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    min-height: 220px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.95rem;
    background: var(--surface);
}
.topic-editor-table-tools {
    border-left: 1px solid var(--border);
    padding-left: 8px;
}
.topic-editor-table-tools button {
    font-size: 0.72rem;
    width: auto !important;
    padding: 0 6px !important;
    color: var(--ink-dim);
}
.topic-editor-table-tools button:hover { color: var(--primary); }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value]::before { content: attr(data-value); }

/* Read-only render of saved topic descriptions on the public topic page */
.topic-rich-content { line-height: 1.7; color: var(--ink); }
.topic-rich-content h1, .topic-rich-content h2, .topic-rich-content h3 { margin: 1.2em 0 0.5em; }
.topic-rich-content p { margin: 0 0 0.9em; }
.topic-rich-content blockquote {
    border-left: 3px solid var(--primary);
    margin: 1em 0; padding: 0.4em 1em;
    color: var(--ink-dim); font-style: italic;
}
.topic-rich-content ul, .topic-rich-content ol { margin: 0 0 0.9em; padding-left: 1.4em; }
.topic-rich-content li[data-list="checked"],
.topic-rich-content li[data-list="unchecked"] { list-style: none; margin-left: -1.4em; padding-left: 1.4em; position: relative; }
.topic-rich-content li[data-list="checked"]::before,
.topic-rich-content li[data-list="unchecked"]::before {
    position: absolute; left: 0; top: 0.15em; font-size: 0.9em;
}
.topic-rich-content li[data-list="unchecked"]::before { content: '☐'; color: var(--ink-dim); }
.topic-rich-content li[data-list="checked"]::before { content: '☑'; color: var(--success); }

.topic-rich-content code {
    background: var(--bg); color: var(--ink); border: 1px solid var(--border);
    padding: 0.15em 0.4em; border-radius: 4px;
    font-family: 'JetBrains Mono', monospace; font-size: 0.88em;
}
.code-block-wrap { position: relative; margin: 0 0 1em; }
.topic-rich-content pre, .code-block-wrap pre {
    background: #1E1B16; color: #F2EDE3;
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem; overflow-x: auto;
    font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; line-height: 1.6;
}
.topic-rich-content pre code { background: none; color: inherit; padding: 0; }
.copy-code-btn {
    position: absolute; top: 0.5rem; right: 0.5rem;
    background: rgba(255,255,255,0.12); color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px; font-size: 0.72rem; font-weight: 600;
    padding: 3px 10px; cursor: pointer; transition: var(--transition);
}
.copy-code-btn:hover { background: rgba(255,255,255,0.22); }

.topic-rich-content table {
    width: 100%; border-collapse: collapse; margin: 0 0 1.2em;
    font-size: 0.92rem;
}
.topic-rich-content table td, .topic-rich-content table th {
    border: 1px solid var(--border); padding: 0.55em 0.75em; vertical-align: top;
}
.topic-rich-content table th { background: var(--bg); font-weight: 700; }
.topic-rich-content table p { margin: 0; }

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------------
   Module page: tools / skills / topics list (module.php)
   Uses existing design tokens — no new colors introduced.
   --------------------------------------------------------------------- */

/* Topics list */
.topics-list {
    max-width: 640px;
}

.topic-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    margin-bottom: 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    border: 2px solid var(--border);
    transition: border-color var(--transition), background var(--transition);
}
.topic-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.topic-item.is-done {
    opacity: 0.75;
    border-color: var(--success);
}
.topic-item.is-done:hover { border-color: var(--success); }

.topic-checkmark {
    width: 32px; height: 32px;
    border-radius: 50%;
    margin-right: 1rem;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface);
    border: 2px solid var(--border);
}
.topic-checkmark.is-done {
    background: var(--success);
    border-color: var(--success);
}
.topic-checkmark .topic-num {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--ink-dim);
    font-weight: 700;
}
.topic-checkmark .bi-check-lg {
    color: #fff;
    font-size: 1rem;
}

.topic-title-wrap {
    flex: 1;
    min-width: 0;   /* allow this flex child to shrink below its text's natural width */
}
.topic-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topic-title.is-done { text-decoration: line-through; color: var(--ink-dim); }

.topic-status {
    margin-left: 1rem;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}
.topic-status-done {
    background: var(--success-soft);
    color: var(--success);
    padding: 0.4rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.topic-status-start {
    color: var(--ink-dim);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Mobile: stack title above the status badge instead of forcing one row */
@media (max-width: 575.98px) {
    .topic-item {
        flex-wrap: wrap;
        padding: 0.85rem;
    }
    .topic-title-wrap {
        flex-basis: 100%;
        order: 2;
        margin-top: 0.4rem;
    }
    .topic-title {
        white-space: normal;   /* let it wrap to 2 lines instead of truncating on mobile */
        overflow: visible;
        text-overflow: unset;
    }
    .topic-status {
        order: 3;
        margin-left: auto;
        margin-top: 0.4rem;
    }
    .topic-checkmark { order: 1; }

    /* Tool cards: shrink so 3 fit per row instead of overflowing */
    .tool-card-logo, .tool-card-placeholder { width: 48px; height: 48px; }
}

/* Tools covered cards */
.tool-card { text-align: center; }
.tool-card-logo {
    width: 60px; height: 60px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}
.tool-card-placeholder {
    width: 60px; height: 60px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}
.tool-card-name {
    font-size: 0.9rem;
    margin: 0;
    color: var(--ink);
}

/* Skills covered list */
.skills-list { max-width: 640px; }
.skill-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.skill-item-icon {
    width: 24px; height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}
.skill-item-icon .bi-check { color: #fff; font-size: 0.9rem; }
.skill-item-text { font-size: 0.95rem; color: var(--ink); }