/* ===========================
   Reset
=========================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===========================
   Body
=========================== */

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    background: #f7f7f8;
    color: #333;

    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 20px;
}

/* ===========================
   Hauptcontainer
=========================== */

.chat-container {

    width: 100%;
    max-width: 1100px;

    height: 92vh;

    background: white;

    border-radius: 14px;

    box-shadow:
        0 6px 24px rgba(0,0,0,0.08);

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

/* ===========================
   Header
=========================== */

.chat-header {

    padding: 24px;

    background: #f9fafb;

    border-bottom:
        1px solid #e5e7eb;
}

.chat-header h1 {

    color: #111827;

    margin-bottom: 10px;

    font-size: 1.7rem;
}

.subtitle {

    color: #6b7280;

    line-height: 1.6;
}

/* ===========================
   Eingabebereich oben
=========================== */

.top-prompt {

    padding: 20px;

    background: white;

    border-bottom:
        1px solid #e5e7eb;
}

.prompt-label {

    margin-bottom: 10px;

    font-weight: 600;

    color: #166534;
}

.prompt-input-wrapper {

    display: flex;

    gap: 12px;

    align-items: flex-end;
}

#user-input {

    flex: 1;

    min-height: 70px;
    max-height: 180px;

    padding: 14px;

    border: 2px solid #cbd5e1;

    border-radius: 10px;

    resize: none;

    font-size: 1.05rem;

    outline: none;

    transition: all .2s ease;
}

#user-input:focus {

    border-color: #16a34a;

    box-shadow:
        0 0 0 4px rgba(22,163,74,.15);
}

#send-button {

    width: 56px;
    height: 56px;

    border: none;

    border-radius: 10px;

    background: #16a34a;

    color: white;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: .2s;
}

#send-button:hover {

    background: #15803d;
}

/* ===========================
   Nachrichtenbereich
=========================== */

.chat-messages {

    flex: 1;

    overflow-y: auto;

    padding: 24px;

    display: flex;

    flex-direction: column;

    gap: 18px;
}

/* ===========================
   Nachrichten
=========================== */

.message {

    padding: 14px 18px;

    border-radius: 12px;

    line-height: 1.65;

    word-wrap: break-word;

    max-width: 100%;
}

.message.user {

    align-self: flex-end;

    background: #e5e7eb;

    color: #111827;

    max-width: 80%;
}

.message.assistant {

    align-self: stretch;

    background: #f3f4f6;

    color: #111827;

    white-space: normal;
}

.message.loading {

    font-style: italic;

    color: #6b7280;
}

.message.error {

    color: #dc2626;
}

/* ===========================
   Markdown-Formatierung
=========================== */

.message.assistant p {
    margin-bottom: 14px;
}

.message.assistant ul,
.message.assistant ol {

    margin-left: 24px;
    margin-bottom: 14px;
}

.message.assistant li {
    margin-bottom: 6px;
}

.message.assistant h1,
.message.assistant h2,
.message.assistant h3 {

    margin-top: 18px;
    margin-bottom: 12px;

    color: #111827;
}

.message.assistant table {

    width: 100%;

    border-collapse: collapse;

    margin: 14px 0;
}

.message.assistant th,
.message.assistant td {

    border: 1px solid #d1d5db;

    padding: 8px;
}

.message.assistant code {

    background: #e5e7eb;

    padding: 2px 5px;

    border-radius: 4px;
}

.message.assistant pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.message.assistant pre {

    background: #f8fafc;

    color: #334155;

    border: 1px solid #cbd5e1;

    padding: 14px;

    border-radius: 8px;

    overflow-x: auto;

    white-space: pre;

    font-family:
        Consolas,
        Monaco,
        monospace;

    font-size: 0.85rem;

    line-height: 1.45;

    margin-top: 12px;
}

/* ===========================
   Geodaten Details
=========================== */

.geo-details {

    margin-top: 18px;

    border: 1px solid #d1d5db;

    border-radius: 10px;

    background: #f8fafc;

    overflow: hidden;
}

.geo-details summary {

    padding: 12px 16px;

    cursor: pointer;

    font-weight: 600;

    color: #166534;

    background: #ecfdf5;

    user-select: none;
}

.geo-details summary:hover {

    background: #dcfce7;
}

.geo-details[open] summary {

    border-bottom: 1px solid #d1d5db;
}

.geo-details pre {

    margin: 0;
    border: none;
    border-radius: 0;
}

.geo-source {

    padding: 12px 16px;

    font-size: 0.85rem;

    color: #64748b;

    border-top: 1px solid #d1d5db;

    background: #f8fafc;
}


/* ===========================
   Scrollbar
=========================== */

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb {

    background: #cbd5e1;

    border-radius: 10px;
}

/* ===========================
   Mobilgeräte
=========================== */

@media (max-width: 768px) {

    body {
        padding: 0;
    }

    .chat-container {

        width: 100%;

        max-width: 100%;

        height: 100dvh;

        border-radius: 0;
    }

    .chat-header {

        padding: 16px;
    }

    .chat-header h1 {

        font-size: 1.3rem;
    }

    .subtitle {

        font-size: 0.9rem;
    }

    .top-prompt {

        padding: 14px;
    }

    .chat-messages {

        padding: 14px;
    }

    #user-input {

        min-height: 60px;

        font-size: 16px;
    }

    #send-button {

        width: 52px;
        height: 52px;
    }

    .message.user {

        max-width: 92%;
    }
}
