:root {
    --bg: #1c1c1c; /* slate-900 */
    --panel: #1c1c1c; /* gray-900 */
    --muted: #94a3b8; /* slate-400 */
    --text: #e5e7eb; /* gray-200 */
    --accent: #a35300; /* sky-400 */
    --accent-2: #ff7d00; /* indigo-400 */
    --ok: #22c55e; /* green-500 */
    --err: #ef4444; /* red-500 */
    --bubble-user: #151515; /* gray-800 */
    --bubble-assistant: #1c1c1c; /* custom dark */
    --radius: 16px;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

html, body {
    height: 100%;
}

.uppercase{
    text-transform: uppercase;
}

.barlow{
    font-family: 'Barlow Condensed', sans-serif;
}

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 20% -10%, #0f0f0f 0%, transparent 60%),
    radial-gradient(1100px 700px at 120% 10%, #1c1c1c 0%, transparent 50%),
    var(--bg);
    color: var(--text);
    font: 16px/1.5 'Barlow Condensed', system-ui, -apple-system, 'Barlow Condensed', Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
    display: grid;
    place-items: start center;
    padding: 32px 16px;
}

.background-img{
    z-index: -1;
    background-image: url("img/circuit-bg.webp");
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    padding-bottom: 2rem;
}

.app {
    width: min(900px, 100%);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
    border: 1px solid rgba(148, 163, 184, .15);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: clip;
    margin-bottom: 1rem;
}

/*header {*/
/*    padding: 24px;*/
/*    display: grid;*/
/*    gap: 16px;*/
/*    justify-items: center;*/
/*    text-align: center;*/
/*    background: linear-gradient(135deg, #1c1c1cde, #0f0f0fbd);*/
/*    border-bottom: 1px solid rgba(148, 163, 184, .15);*/
/*}*/

header {
    padding: 24px;
    width: 100%;
    display: inline-block;
    gap: 16px;
    justify-items: center;
    text-align: center;
    background: linear-gradient(135deg, #1c1c1cde, #0f0f0fbd);
    border-bottom: 1px solid rgba(148, 163, 184, .15);
    margin-bottom: -6px;
}

.header-img{
    float: left;
    display: inline-block;
}

.header-text{
    display: inline-block;
    float: left;
    text-align: left;
    margin-left: 1rem;
    margin-top: 0.5rem;
}

header img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, .35);
    box-shadow: 0 6px 18px rgba(2, 6, 23, .35);
    background: #0f0f0f;
    object-fit: cover;
}

h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.sub {
    color: var(--muted);
    font-size: .95rem;
}

.statusbar {
    font-size: .8rem;
    color: var(--muted);
    padding-bottom: 8px;
}

.messages {
    padding: 16px 16px 0;
    height: min(60vh, 560px);
    overflow: auto;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, #0f0f0fed, rgb(0 0 0 / 83%));
}

.message {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    margin: 12px 0;
    align-items: flex-start;
}

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #1c1c1c;
    border: 1px solid rgba(255, 255, 255, .25);
}

.assistant .avatar{
    content: url("img/chatbot.png");
}

.user .avatar{
    content: url("img/user-solid-full.svg");
}

.message.user .avatar {
    background: #0b1220;
    color: var(--text);
    border-color: rgba(148, 163, 184, .3);
}

.bubble {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 12px 14px;
    background: var(--bubble-assistant);
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bubble a{
    text-decoration: none;
    color: #ff7d00;
}

.bubble a:visited{
    text-decoration: none;
    color: #c86200;
}

.message.user .bubble {
    background: var(--bubble-user);
}

.typing {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 6px;
    align-items: center;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    opacity: .35;
    animation: blink 1.2s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: .15s;
}

.dot:nth-child(3) {
    animation-delay: .3s;
}

@keyframes blink {
    0%, 80%, 100% {
        opacity: .25;
        transform: translateY(0);
    }
    40% {
        opacity: .9;
        transform: translateY(-2px);
    }
}

form.ask {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px;
    background: var(--panel);
    border-top: 1px solid rgba(148, 163, 184, .15);
    position: sticky;
    bottom: 0;
}

.ask input[type="text"], .ask textarea {
    width: 99%;
    padding: 14px 16px;
    border-radius: 12px;
    background: #0f0f0f;
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, .25);
    outline: none;
    font-size: 1rem;
}

.ask input[type="text"]::placeholder, .ask textarea::placeholder {
    color: #748297;
}

#questionInput{
    font-size: 16px;
    box-sizing: border-box;     /* Höhe inkl. Padding/Border berechnen */
    width: 100%;
    resize: none;               /* kein manuelles Ziehen */
    overflow-y: hidden;         /* erst bei > maxRows umschalten */
    line-height: 1.4;           /* definierte Zeilenhöhe */
    padding: 10px 12px;         /* moderates Padding */
    border: 1px solid rgba(148,163,184,.25);
    border-radius: 12px;
    height: auto;               /* von JS gesteuert */
    min-height: calc(1.4em + 20px) !important; /* 1 Zeile + vert. Padding (2*10px) */
}

.ask button {
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .25);
    font-size: 18px;
    font-weight: 700;
    background: var(--accent-2);
    color: #0f0f0f;
    cursor: pointer;
    letter-spacing: 1px;
    font-family: 'Barlow Condensed', sans-serif;
    height: 50px;
    position: relative;
    margin-top: auto;
}

.ask button:hover {
    background: #ff8819;
    color: #232323;
    cursor: pointer;
}

.ask button[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

#questionInput::-webkit-scrollbar {
    width: 8px;
}

#questionInput::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.8); /* dunkles Grau/Slate */
    border-radius: 8px;
}

#questionInput::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.6); /* noch dunkler */
}

/* Firefox */
#questionInput {
    scrollbar-width: thin;                /* schmal */
    scrollbar-color: rgba(100,116,139,0.8) rgba(30,41,59,0.6);
}


.small {
    font-size: .8rem;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

/* Scrollbar (nice but subtle) */
.messages::-webkit-scrollbar {
    width: 10px;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .25);
    border-radius: 999px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

/*MODAL STYLE*/
/* Modal Hintergrund */
.modal {
    display: none; /* initial ausgeblendet */
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.65);
}

/* Modal-Box */
.modal-content {
    background: #d6d6d6;
    color: #111;
    margin: 10% auto;
    padding: 20px 24px 30px;
    border-radius: 12px;
    width: min(600px, 90%);
    position: relative;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
    font-family: 'Barlow Condensed', system-ui, sans-serif;
}

.modal h2{
    margin-top: 0;
}

.modal a{
    text-decoration: none;
}

.sendchatbtn button{
    position: fixed;
    bottom: 3rem;
    right: 3rem;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .25);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    background: #5c5c5c;
    color: #ffffff;
    cursor: pointer;
    letter-spacing: 1px;
    font-family: 'Barlow Condensed', sans-serif;
}

.sendchatbtn button:hover{
    background-color: #6e6e6e;
}

.sendchatbtn svg{
    width: 25px;
    display: block;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    color: #fff;
    fill: #fff;
    margin-bottom: 5px;
}

/*Footer*/
.footer{
    margin-bottom: 1rem;
}

.footer-links img{
    display: block;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    width: 100px;
}

.footer-logo{
    display: inline-block;
    float: left;
}

.footer-link-wrapper{
    display: inline-block;
    float: left;
    margin-top: 1.8rem;
}

.footer-links a {
    text-decoration: none;
    color: #d6d6d6;
    margin: 1rem 0 2rem 1rem;
}

/* Schließen (X) */
.close {
    position: absolute;
    right: 22px;
    top: 0px;
    font-size: 2.5rem;
    font-weight: bold;
    color: #1c1c1c;
    cursor: pointer;
}
.close:hover { color: #000; }

/* Button */
#acceptBtn {
    margin-top: 18px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #284177;
    color: white;
    font-size: 1rem;
    cursor: pointer;
}
#acceptBtn:hover {
    background: #3456a8;
}

@media(max-width: 980px){

    header {
        padding: 24px 5px;
        display: grid;
        gap: 16px;
        justify-items: center;
        text-align: center;
        background: linear-gradient(135deg, #1c1c1cde, #0f0f0fbd);
        border-bottom: 1px solid rgba(148, 163, 184, .15);
    }

    .header-img{
        display: block;
    }

    .header-text{
        width: 85%;
        display: block;
        text-align: center;
        margin: 0;
    }

    .sendchatbtn button{
        display: none;
    }

    /*FOOTER*/
    .footer-logo{
        display: block;
        width: 100%;
        text-align: center;
    }

    .footer-links a{
        text-decoration: none;
        color: #d6d6d6;
        margin: 1rem 0 2rem 0;
        text-align: center;
    }

    .footer-links a:nth-child(2) {
        margin-left: 1rem;
    }

    .footer-link-wrapper{
        display: block;
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }

    .footer-links a:nth-of-type(2n+1){
        margin-left: 1rem;
    }

    .footer-links img{
        display: block;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
        width: 100px;
    }
}