/* =============================================
   PHP Learning Docs — Global Stylesheet
   RedoHub | php section
   ============================================= */

/* ---------- Headings ---------- */
h1.text-php,
h2.text-php,
h3.text-php,
h4.text-php {
    color: #198754 !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;
    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: #f0faf4;
    color: #198754;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875em;
}

/* =============================================
   Prism.js Syntax Highlighting — PHP Focused
   Colours tuned specifically for PHP code:
   $variables, keywords, strings, functions,
   class names, PHP open/close tags, etc.
   ============================================= */

/* Comments: single-line, multi-line, hash-style */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #7c8599;
    font-style: italic;
}

/* PHP Keywords: echo, if, else, elseif, foreach, while, for,
   function, class, return, new, extends, implements, etc. */
.token.keyword,
.token.important,
.token.atrule,
.token.rule {
    color: #c0392b;
    font-weight: 700;
}

/* Strings: "hello"  'world'  heredoc */
.token.string,
.token.char {
    color: #217a3c;
    /* forest green — sharp contrast on light bg */
}

/* Numbers: 42, 3.14, 0xFF */
.token.number,
.token.unit {
    color: #c0590e;
}

/* true / false / null */
.token.boolean,
.token.constant {
    color: #8e44ad;
    font-weight: 600;
}

/* ★ PHP Variables: $name  $this  $_POST  $myArray
   The most distinctive PHP token — warm burnt-orange, bold */
.token.variable {
    color: #b34a00;
    font-weight: 600;
}

/* Function & method names: strlen()  array_push()  $obj->method() */
.token.function,
.token.function-name {
    color: #0a7a8f;
    /* teal/cyan — clearly different from keywords */
}

/* Class names: MyClass  PDO  Exception  DateTime */
.token.class-name,
.token.maybe-class-name {
    color: #7d4cdb;
}

/* Built-in PHP functions flagged by Prism as builtin */
.token.builtin {
    color: #1565c0;
    font-weight: 600;
}

/* Operators: =  .  +  -  *  /  ==  ===  !==  ->  =>  :: */
.token.operator,
.token.entity {
    color: #b94040;
}

/* Punctuation: {  }  (  )  ;  ,  ->  :: */
.token.punctuation {
    color: #444c56;
}

/* PHP open/close tags: <?php  ?>  — text colour only, no background */
.token.delimiter,
.token.open-tag,
.token.close-tag {
    color: #777bb3;
}

/* HTML tag names that appear inside a PHP file: <div> <form> <input> */
.token.tag .token.tag {
    color: #c0390b;
    background: none;
    padding: 0;
}

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

/* HTML attribute values & heredoc-like quoted values */
.token.attr-value {
    color: #217a3c;
}

/* CSS property names inside <style> blocks */
.token.property {
    color: #1565c0;
}

/* CSS selectors inside <style> blocks */
.token.selector {
    color: #6f42c1;
}

/* Angle brackets < > inside HTML tags — keep neutral */
.token.tag .token.punctuation {
    color: #444c56;
    background: none;
    padding: 0;
}

/* ---------- 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 / Info 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-php {
    background-color: #198754 !important;
    color: #ffffff;
}

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

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

/* ---------- PHP Badge ---------- */
.php-badge {
    display: inline-block;
    background-color: #198754;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    vertical-align: middle;
}