/* =============================================
   JavaScript Learning Docs — Global Stylesheet
   RedoHub | javascript section
   ============================================= */

/* ---------- Headings ---------- */
h1.text-success,
h2.text-success,
h3.text-success,
h4.text-success {
    color: #2e7d52 !important;
}

/* ---------- Code Block Wrapper (keeps copy button fixed) ---------- */
.pre-wrapper {
    position: relative;          /* button anchors here, not inside pre */
    margin: 1rem 0 1.4rem;
}

/* ---------- Code Blocks (pre) ---------- */
pre {
    background-color: #f6f8fa;
    color: #24292e;
    border-radius: 8px;
    padding: 1.2rem 1.4rem;
    font-size: 0.88rem;
    line-height: 1.7;
    overflow-x: auto;
    border: 1px solid #d0d7de;
    margin: 0;                   /* margin handled by .pre-wrapper */
    position: static;            /* NOT relative — button lives outside */
}

/* ---------- Copy Code Button ---------- */
.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    z-index: 10;                 /* always on top */
    background: #ffffff;
    color: #57606a;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.copy-code-btn:hover {
    background: #f3f4f6;
    color: #24292e;
    border-color: #adb5bd;
}

.copy-code-btn.copied {
    background: #198754;
    color: #ffffff;
    border-color: #198754;
}


pre code {
    font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
    font-size: inherit;
    color: inherit;
    background: none;
    padding: 0;
}

/* ---------- Inline code ---------- */
code {
    background-color: #f0f4ff;
    color: #c7254e;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875em;
}

/* =============================================
   Prism.js Syntax Highlighting — Light Theme
   (works on the existing #f6f8fa code bg)
   ============================================= */

/* Comments → muted gray + italic */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6a737d;
    font-style: italic;
}

/* Keywords: let, const, function, if, return … */
.token.keyword,
.token.important,
.token.atrule,
.token.rule {
    color: #d73a49;
    font-weight: 600;
}

/* Strings: "text"  'text'  `template` */
.token.string,
.token.char,
.token.attr-value {
    color: #032f62;
}

/* Numbers */
.token.number,
.token.unit {
    color: #005cc5;
}

/* true / false / null */
.token.boolean,
.token.constant {
    color: #d73a49;
}

/* Function & method names */
.token.function,
.token.function-name {
    color: #6f42c1;
}

/* Class names */
.token.class-name,
.token.maybe-class-name {
    color: #6f42c1;
}

/* Operators: = + - * / === !== … */
.token.operator,
.token.entity,
.token.url {
    color: #d73a49;
}

/* Punctuation: { } ( ) ; , . */
.token.punctuation {
    color: #24292e;
}

/* Built-in objects */
.token.builtin {
    color: #005cc5;
}

/* HTML tag names: <div>  <button>  </span> */
.token.tag .token.tag {
    color: #22863a;
}

/* HTML attribute names: class= id= href= */
.token.attr-name {
    color: #6f42c1;
}

/* HTML/CSS property names */
.token.property {
    color: #005cc5;
}

/* Selector */
.token.selector {
    color: #6f42c1;
}

/* Brackets / angle brackets in tags */
.token.tag .token.punctuation {
    color: #24292e;
}

/* ---------- Keyboard keys (kbd) ---------- */
kbd {
    background-color: #f1f3f5;
    color: #212529;
    border: 1px solid #ced4da;
    border-bottom: 2px solid #adb5bd;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.82em;
    font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
}

/* ---------- Page navigation (Next / Prev buttons) ---------- */
.page-nav {
    margin-top: 2.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---------- Note / Tip / Warning boxes ---------- */
.note-box {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    font-size: 0.93rem;
}

.tip-box {
    background-color: #d1e7dd;
    border-left: 4px solid #198754;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    font-size: 0.93rem;
}

.warning-box {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    font-size: 0.93rem;
}

.info-box {
    background-color: #dbeafe;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    font-size: 0.93rem;
}

/* ---------- Tables ---------- */
.table {
    border-color: #a3cfbb !important;
}

.table-bordered> :not(caption)>*>* {
    border-color: #a3cfbb;
}

.table thead.table-dark {
    background-color: #198754 !important;
    color: #ffffff;
}

.table thead.table-dark th {
    background-color: #198754;
    border-color: #146c43;
}

.table tbody tr:hover {
    background-color: #f0faf4;
}