/* =========================================================
   CODEDEKHO ONLINE COMPILER
   Responsive + PickPlugins Safe CSS
   (FIXED: mobile overflow from Prism Live editor)
   ========================================================= */


/* =========================================================
   MAIN COMPILER
   ========================================================= */

#lmscode-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    overflow: hidden;
}


/* Make every compiler element respect the screen width.
   This is the key fix: max-width:100% is now applied to
   EVERY descendant, not just the ones we named explicitly.
   Without this, the Prism Live editor's internal <pre>/<code>
   nodes (which use white-space:pre) can force the whole
   form wider than the viewport. */

#lmscode-form,
#lmscode-form *,
#lmscode-form *::before,
#lmscode-form *::after {
    box-sizing: border-box;
    max-width: 100%;
}


/* =========================================================
   CODEDEKHO COMPILER HEADING
   ========================================================= */

#lmscode-form .codedekho-compiler-title {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 18px 0 18px 0;
    padding: 13px 18px;

    background: #ff6a00 !important;
    border-left: 5px solid #ffffff;
    border-radius: 5px;

    text-align: left;

    overflow: hidden;
}


#lmscode-form .codedekho-compiler-title span {
    display: block;

    color: #ffffff !important;

    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;

    line-height: 1.4;
    letter-spacing: 0.3px;

    white-space: normal;
}


/* =========================================================
   LANGUAGE SELECT
   ========================================================= */

#lmscode-form .lang-select {
    width: auto;
    max-width: 100%;

    padding: 7px 10px;

    font-size: 16px;
    font-weight: 600;
    font-family: Arial, sans-serif;

    border: 2px solid #333333;
    background: #ffffff;

    box-sizing: border-box;
}


/* =========================================================
   COMPILER TEXT
   ========================================================= */

#lmscode-form .lmscode-txt {
    width: 100%;
    max-width: 100%;

    margin: 12px 0;

    font-family: Arial, sans-serif;
    line-height: 1.5;

    box-sizing: border-box;
}


/* =========================================================
   CODE EDITOR (TEXTAREA)
   ========================================================= */

#lmscode-form textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


/* =========================================================
   PRISM LIVE EDITOR
   The Prism Live Editor library wraps the textarea in extra
   divs and renders a <pre><code> highlighting layer behind
   it. That <pre>/<code> layer uses white-space:pre by default
   so long lines of code do NOT wrap — they force the element
   (and everything around it) wider than the screen. We fix
   that here by forcing wrapping and hard word-breaks on the
   highlight layer specifically, plus covering the common
   wrapper class names the plugin generates.
   ========================================================= */

#lmscode-form .prism-live,
#lmscode-form .prism-live-wrapper,
#lmscode-form .prism-live-editor,
#lmscode-form .prism-live-source,
#lmscode-form .prism-live-highlight {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
}

#lmscode-form .prism-live pre,
#lmscode-form .prism-live code,
#lmscode-form pre,
#lmscode-form code {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;

    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}


/* =========================================================
   INPUT BOX
   ========================================================= */

#lmscode-form .lmscode-input {
    display: block;

    width: 100%;
    max-width: 640px;

    min-width: 0 !important;

    min-height: 40px !important;

    margin: 0 0 10px 0;

    padding: 10px 12px;

    box-sizing: border-box;
}


/* Safety net: catch the "stdin" input even if the plugin
   gives it a different class than .lmscode-input. Targets
   any plain text/number input that is a direct descendant
   of the compiler form. */

#lmscode-form input[type="text"],
#lmscode-form input[type="number"],
#lmscode-form input:not([type="checkbox"]):not([type="radio"]) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}


/* =========================================================
   RUN BUTTON
   ========================================================= */

#lmscode-form .code-run-btn {
    display: inline-block;

    padding: 12px 34px;

    font-size: 15px;
    font-weight: 600;

    color: #ffffff !important;
    background: #000000 !important;

    border: 1px solid #000000 !important;
    border-radius: 0;

    cursor: pointer;

    box-sizing: border-box;
}


#lmscode-form .code-run-btn:hover {
    background: #222222 !important;
    color: #ffffff !important;
}


/* =========================================================
   OUTPUT
   ========================================================= */

#lmscode-form .lmscode-result {
    width: 100%;
    max-width: 100%;

    box-sizing: border-box;

    overflow-wrap: anywhere;
    word-break: break-word;
}


/* =========================================================
   MOBILE RESPONSIVE
   ========================================================= */

@media screen and (max-width: 768px) {

    #lmscode-form {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;

        /* Was 0 — this is what let the stdin input (and
           anything else missing an explicit inset) touch
           the physical screen edge. Match this to whatever
           left/right gutter the rest of the page uses; 15px
           is a common WordPress theme default — adjust if
           your theme's container padding differs. */
        padding: 0 15px !important;

        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Belt-and-suspenders: force every direct child block
       to stay within the viewport on mobile too. */
    #lmscode-form > * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }


    /* -----------------------------------------
       Compiler title
       ----------------------------------------- */

    #lmscode-form .codedekho-compiler-title {
        width: 100% !important;
        max-width: 100% !important;

        margin: 15px 0 !important;

        padding: 11px 14px !important;

        background: #ff6a00 !important;

        border-left: 4px solid #ffffff !important;
        border-radius: 4px !important;

        display: block !important;
    }


    #lmscode-form .codedekho-compiler-title span {
        color: #ffffff !important;

        font-size: 18px !important;
        line-height: 1.4 !important;

        white-space: normal !important;
    }


    /* -----------------------------------------
       Language dropdown
       ----------------------------------------- */

    #lmscode-form .lang-select {
        width: auto !important;
        max-width: 100% !important;

        font-size: 16px !important;

        padding: 7px 10px !important;
    }


    /* -----------------------------------------
       Text
       ----------------------------------------- */

    #lmscode-form .lmscode-txt {
        width: 100% !important;
        max-width: 100% !important;

        font-size: 16px !important;

        margin: 12px 0 !important;
    }


    /* -----------------------------------------
       Code editor
       ----------------------------------------- */

    #lmscode-form textarea,
    #lmscode-form .prism-live,
    #lmscode-form .prism-live-wrapper,
    #lmscode-form .prism-live-editor {
        width: 100% !important;
        max-width: 100% !important;

        min-width: 0 !important;

        box-sizing: border-box !important;
    }

    #lmscode-form pre,
    #lmscode-form code {
        white-space: pre-wrap !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        max-width: 100% !important;
    }


    /*
       Prevent Prism editor from making
       the entire page horizontally wide.
    */

    #lmscode-form .prism-live-source {
        max-width: 100% !important;
    }


    /* -----------------------------------------
       Input
       ----------------------------------------- */

    #lmscode-form .lmscode-input {
        width: 100% !important;
        max-width: 100% !important;

        min-width: 0 !important;

        min-height: 45px !important;

        font-size: 16px !important;

        box-sizing: border-box !important;
    }


    /* -----------------------------------------
       Run button
       ----------------------------------------- */

    #lmscode-form .code-run-btn {
        padding: 12px 30px !important;

        font-size: 16px !important;

        background: #000000 !important;
        color: #ffffff !important;

        border: 1px solid #000000 !important;
    }


    /* -----------------------------------------
       Output
       ----------------------------------------- */

    #lmscode-form .lmscode-result {
        width: 100% !important;
        max-width: 100% !important;

        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }
}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media screen and (max-width: 480px) {

    #lmscode-form .codedekho-compiler-title {
        padding: 10px 12px !important;
        margin: 12px 0 !important;
    }


    #lmscode-form .codedekho-compiler-title span {
        font-size: 17px !important;
    }


    #lmscode-form .lmscode-txt {
        font-size: 15px !important;
    }


    #lmscode-form .lang-select {
        font-size: 15px !important;
    }


    #lmscode-form .code-run-btn {
        padding: 11px 28px !important;
    }
}
