/* ======================
   Global
   ====================== */
body {
    margin: 0;
    padding: 0;
    background-color: #171D1F;
    color: #F1F1F1;
    font-size: 15px;
    font-family: Arial, Helvetica, sans-serif;
}

/* Seitencontainer – zentriertes Layout */
.seite {
    width: 85%;
    margin: 20px auto;
    padding: 10px 20px;
    border: 3px solid #5B5B5B;
    z-index: 0;
}

/* Header */
.header {
    background-color: #6C6C6C;
    border: 1px solid #909090;
    margin-bottom: 10px;
    z-index: 0;
}
.logo {
    max-width: 125px;
    min-width: 30px;
}

/* ======================
   Navigation
   ====================== */
.topnav {
    position: relative;       /* Damit Hamburger-Icon absolut innerhalb .topnav sitzt */
    overflow: hidden;
    background-color: #2E2E2E;
}

/* Link‐Bereich (links) */
.topnav .nav-left a {
    float: left;
    display: block;
    color: #f2f2f2;
    text-decoration: none;
    padding: 7px 8px;
    font-size: 15px;
    background-color: transparent;  /* Default keine Hintergrundfarbe */
}
.topnav .nav-left a:hover {
    background-color: #FDCA00;  /* Ganz gelb bei Hover */
    color: #050505;
}
.topnav .nav-left a.active {
    background-color: #535353;  /* Dunkelgrau, wenn aktiv */
    color: #F1F1F1;
}

/* Rechts‐Bereich mit Begrüßung und Login/Logout */
.topnav .nav-right {
    float: right;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 0px;        /* Kein extra Padding am rechten Rand */
}
.topnav .nav-right .greeting {
    color: #f2f2f2;
    font-size: 15px;
}
.topnav .nav-right a {
    display: block;
    color: #f2f2f2;
    text-decoration: none;
    padding: 7px 8px;
    font-size: 15px;
    background-color: transparent;
}
.topnav .nav-right a:hover {
    background-color: #FDCA00;
    color: #050505;
}
.topnav .nav-right a.active {
    background-color: #535353;
    color: #F1F1F1;
}

/* Hamburger‐Icon (immer versteckt in Desktop-Ansicht) */
.topnav .icon {
    display: none;
    /* wenn sichtbar, Position weiter oben setzen */
}

/* ======================
   Responsive Navigation
   ====================== */
@media screen and (max-width: 775px) {
    /* 1) Verstecke alle Links außer dem ersten in nav-left und die gesamte nav-right */
    .topnav .nav-left a:not(:first-child),
    .topnav .nav-right {
        display: none;
    }
    /* 2) Zeige das Hamburger‐Icon rechts oben und etwas höher */
    .topnav .icon {
        float: right;
        display: block;
        padding: 7px 8px;
        position: absolute;    /* absolut innerhalb .topnav positionieren */
        top: 1px;              /* etwas höher – nach Bedarf anpassen */
        right: 8px;            /* bündig am rechten Rand */
        cursor: pointer;
    }
    /* 3) Sobald "responsive" dazukommt, zeige nav-left links untereinander */
    .topnav.responsive .nav-left a {
        float: none;
        display: block;        /* ganze Zeile (100% Breite) */
        text-align: left;
        margin: 0;             /* keine Lücke zwischen Zeilen */
        padding: 10px 8px;     /* etwas größeres Padding für Touch */
        background-color: transparent;
        color: #f2f2f2;
    }
    .topnav.responsive .nav-left a:hover {
        background-color: #FDCA00;  /* gesamte Zeile gelb bei Hover */
        color: #050505;
    }
    .topnav.responsive .nav-left a.active {
        background-color: #535353;  /* aktiv dunkelgrau */
        color: #F1F1F1;
    }
    /* 4) Und zeige nav-right (Begrüßung + Logout/Login) ebenfalls untereinander */
    .topnav.responsive .nav-right {
        float: none;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 5px 8px;
        gap: 5px;
        text-align: left;
        margin-top: 5px;
        background-color: transparent;
    }
    .topnav.responsive .nav-right a {
        display: block;        /* ganze Zeile */
        text-align: left;
        padding: 10px 8px;     /* gleiche Höhe wie nav-left */
        background-color: transparent;
        color: #f2f2f2;
    }
    .topnav.responsive .nav-right a:hover {
        background-color: #FDCA00;  /* gesamte Zeile gelb bei Hover */
        color: #050505;
    }
    .topnav.responsive .nav-right a.active {
        background-color: #535353;  /* aktiv dunkelgrau */
        color: #F1F1F1;
    }
    /* 5) Platziere das Hamburger‐Icon endgültig */
    .topnav.responsive .icon {
        position: absolute;
        top: 1px;              /* bleibt hier, damit es auf allen Zeilen gleich sitzt */
        right: 8px;
    }
}

/* ======================
   Content
   ====================== */
.content {
    background-color: #6C6C6C;
    border: 1px solid #909090;
    min-height: 430px;
    padding: 5px 0 10px;
    position: relative;
    z-index: 0;
}

/* ======================
   Footer
   ====================== */
.footer {
    clear: both;
    text-align: center;
    background-color: #6C6C6C;
    border: 1px solid #909090;
    font-size: 10px;
    line-height: 15px;
    margin-top: 10px;
    padding: 5px 0;
    z-index: 1;
}
.footer a,
.footer a:visited {
    font-size: 10px;
    color: #F4F4F4;
    text-decoration: none;
}

/* ======================
   Scripteditor-spezifisch
   ====================== */

/* Flex-Layout: Menü + Editor */
.container {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Seiten-Menü */
.menu {
    flex: 0 0 350px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    margin-right: 10px;
}
.menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.menu li {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}
.menu li:hover {
    background: #ddd;
}

/* Editor-Bereich */
.editor {
    flex: 1;
    padding-right: 0;
}

/* Editor-Container (weißer Kasten) */
.editor-container {
    position: relative;
    width: 100%;
    height: 500px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #ffffff !important;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    margin: 0;
    padding: 0;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    line-height: 1.2;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
}

/* Code-Highlight Overlay */
#highlightedCode {
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    pointer-events: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: inherit;
    word-wrap: inherit;
    color: #000 !important;
    z-index: 2;
}

/* Tatsächliches Textarea */
#codeEditor {
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: inherit;
    word-wrap: inherit;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: transparent;
    caret-color: #000;
    overflow: auto;
    z-index: 3;
}

/* Syntax-Farben im Highlight */
.number  { color: blue  !important; }
.keyword { color: red   !important; }

/* ======================
   Schnell-Einfügeleiste
   ====================== */
.quick-insert {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}
/* Icon-Buttons in der Schnell-Einfügeleiste: 32×32px mit 24×24px Icon und abgerundeten Ecken */
.quick-insert button {
    width: 32px;                   /* Button-Breite */
    height: 32px;                  /* Button-Höhe */
    padding: 0;                    /* Kein Innenabstand */
    background-color: #ffffff;     /* Weißer Hintergrund */
    border: 1px solid #cccccc;     /* Leichter, grauer Rahmen */
    border-radius: 6px;            /* Abgerundete Ecken */
    display: flex;
    align-items: center;           /* Vertikal zentrieren */
    justify-content: center;       /* Horizontal zentrieren */
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.quick-insert button img {
    width: 20px;                   /* Icon-Breite */
    height: 20px;                  /* Icon-Höhe */
    display: block;
}
.quick-insert button:hover {
    background-color: #EFEFEF;     /* Dunkleres Grau bei Hover (Hex #EFEFEF) */
}
.quick-insert button:active,
.quick-insert button:focus {
    outline: none;
    background-color: #CCCCCC;     /* Noch dunkler bei Klick/Fokus */
}

/* ======================
   Eingabe & Buttons
   ====================== */
.save-functions-area {
    margin-bottom: 15px;
}
.save-functions-area input[type="text"] {
    width: 97%;
    padding: 5px;
    font-size: 14px;
    margin-bottom: 5px;
}
.save-functions-buttons {
    display: flex;
    gap: 5px;
}
.save-functions-buttons button {
    flex: 1;
    padding: 5px;
    font-size: 14px;
    cursor: pointer;
}

/* ======================
   Passwort-Hashing
   ====================== */
.hash-area {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 15px;
}
.hash-area input {
    flex: 1;
    padding: 5px;
    font-size: 14px;
}
/* Icon-Button in der Hash-Area: ebenfalls 32×32px mit 24×24px Icon */
.hash-area button {
    width: 32px;
    height: 32px;
    padding: 0;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.hash-area button img {
    width: 20px;
    height: 20px;
    display: block;
}
.hash-area button:hover {
    background-color: #EFEFEF;
}
.hash-area button:active,
.hash-area button:focus {
    outline: none;
    background-color: #CCCCCC;
}

/* ======================
   Dropdown-Aktionen
   ====================== */
#templateActions,
#scriptActions {
    display: none;
    gap: 5px;
    margin-bottom: 15px;
    justify-content: space-between;
}
#templateActions button,
#scriptActions button {
    flex: 1;
    padding: 5px;
    cursor: pointer;
}

/* ======================
   Statusmeldung
   ====================== */
.message {
    text-align: center;
    padding: 10px 0;
    background: #f4f4f4;
    position: fixed;
    bottom: 0;
    width: 100%;
}

/* Formular für Name */
.script-name {
    text-align: center;
    margin-bottom: 15px;
}
.script-name input {
    width: 300px;
    padding: 8px;
    font-size: 14px;
}
.script-name button {
    padding: 8px 12px;
    font-size: 14px;
    margin-left: 10px;
}

/* ======================
   ID- und Dropdown-Controls
   ====================== */
.idate,
.idropdown,
.idropdown_data,
.idropdown_router,
.ibutton_anzeigen {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    background-color: #F5F5F5;
    color: #050505;
    border-radius: 4px;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.5);
}
.idate {
    border: 1px solid #FDC300;
    width: 99px;
}
.idropdown {
    border: 1px solid #FDC300;
    width: 100%;
    min-width: 50px;
    max-width: 60px;
}
.idropdown_data {
    border: 1px solid #FDC300;
    width: 100%;
    min-width: 50px;
    max-width: 130px;
}
.idropdown_router {
    border: 1px solid #FDC300;
    width: 100%;
    min-width: 50px;
    max-width: 100px;
}
.ibutton_anzeigen {
    border: none;
    max-width: 100px;
    min-width: 50px;
    width: 100%;
    padding: 4px;
    transition: 0.2s;
}
.ibutton_anzeigen:hover {
    background-color: #C9A100;
    color: #F1F1F1;
}

/* Navigationsmenü-Höhe */
.navimenu {
    height: 17px;
}
