/* ============================================================
   tutor_style.css — Ergänzungen zu style.css für tutor.php
   ============================================================ */

body {
    position: relative;
}

/* ============================================================
   Kopfzeile
   ============================================================ */
#tutor-header {
    flex-shrink: 0;
    background: #0284c7;
    color: #fff;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    z-index: 10;
    position: relative;
    transition: background 0.3s;
}

#tutor-header .icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

#tutor-header .info {
    flex: 1;
    min-width: 0;
}

#tutor-header .titel {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.15;
    display: flex;
    align-items: center;
    gap: 8px;
}

#tutor-header .name {
    font-size: 11px;
    opacity: 0.85;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tutor-header .punkte {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

#tutor-header.view-header {
    background: #475569;
}

#tutor-header.lehrer-header {
    background: #a855f7;
    box-shadow: 0 2px 15px rgba(168, 85, 247, 0.4);
}

#btn-ki-freigeben {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}
#btn-ki-freigeben:active { background: rgba(255,255,255,0.4); }
#btn-ki-freigeben:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   Lehrer rufen Button (Professionell)
   ============================================================ */
#btn-lehrer-rufen {
    flex-shrink: 0;
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #b91c1c;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.02em;
}
#btn-lehrer-rufen:active {
    background: #b91c1c;
    transform: scale(0.96);
}
#btn-lehrer-rufen:disabled {
    background: #94a3b8;
    border-color: #64748b;
    cursor: not-allowed;
}

/* ============================================================
   Hilfe-Button (?)
   ============================================================ */
#btn-hilfe {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}
#btn-hilfe:active {
    background: rgba(255,255,255,0.4);
    transform: scale(0.94);
}

.view-badge {
    background: rgba(255,255,255,0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ============================================================
   KI- & Lehrer-Blasen
   ============================================================ */
#chat-scroll .blase.ki {
    background: #e0f2fe;
    align-self: flex-start;
    border-top-left-radius: 2px;
    border-top-right-radius: 10px;
    border: 1px dashed #0284c7;
    min-width: 0;
}

#chat-scroll .blase.lehrer {
    background: #f3e8ff;
    align-self: flex-start; 
    border-top-left-radius: 2px; 
    border-top-right-radius: 10px; 
    border: 1px solid #c084fc; 
    min-width: 0;
    box-shadow: 0 1px 3px rgba(168, 85, 247, 0.15);
}

.zeitstempel {
    font-size: 9px;
    color: #94a3b8;
    margin-bottom: 4px;
    font-family: ui-monospace, monospace;
    letter-spacing: 0.02em;
}

/* ============================================================
   Baustein-Bild
   ============================================================ */
.tutor-bild {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.tutor-bild img {
    display: block;
    max-width: 100%;
    max-height: 25vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    background: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tutor-bild .bild-hinweis {
    text-align: center;
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}

/* ============================================================
   KaTeX-Formeln
   ============================================================ */
.blase .formel-rendered {
    margin-top: 6px;
    padding: 2px 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.blase .formel-rendered::-webkit-scrollbar { display: none; }
.blase .formel-rendered .katex-display { margin: 0; }
.blase .formel-rendered .katex { font-size: 1.05em; }

/* ============================================================
   Denk-Blase
   ============================================================ */
.denk-bubble .denk-punkte {
    display: flex;
    gap: 4px;
    padding: 4px 0 2px;
}
.denk-bubble .denk-punkte span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0284c7;
    animation: denkt 1.2s infinite ease-in-out;
}
.denk-bubble .denk-punkte span:nth-child(2) { animation-delay: 0.15s; }
.denk-bubble .denk-punkte span:nth-child(3) { animation-delay: 0.3s; }

@keyframes denkt {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

/* ============================================================
   Status-Blasen
   ============================================================ */
.tutor-hinweis {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    font-style: italic;
    padding: 40px 20px;
}
.tutor-fehler {
    text-align: center;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    padding: 40px 20px;
}

/* ============================================================
   SCHAFWIESE
   ============================================================ */
#schaf-wiese {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 18rem;
    background-color: #16a34a;
    background-image: url('bilder/wiese.png');
    background-size: cover;
    background-position: center bottom;
    border-bottom: 4px solid #14532d;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    box-shadow: inset 0 -10px 20px -5px rgba(0,0,0,0.6);
    overflow: hidden;
    z-index: 40;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s;
    padding-top: env(safe-area-inset-top);
}
#schaf-wiese.ausgeblendet {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}
.wiese-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
    z-index: 5;
}
#wiese-inhalt {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 10;
}
#wiese-inhalt .wiese-meldung {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    opacity: 0.9;
    font-size: 20px;
    text-align: center;
    padding: 0 16px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    z-index: 20;
}
.schaf-wrapper {
    position: absolute;
    transform-origin: bottom center;
    transition: all 0.3s ease-out;
    z-index: 10;
}
.schaf-wrapper img {
    display: block;
    animation: schafGrasen 4s ease-in-out infinite;
    transform-origin: bottom center;
}
@keyframes schafGrasen {
    0%   { transform: translateX(0)      translateY(0)   rotate(0deg)  scale(1);    }
    25%  { transform: translateX(-5vh)   translateY(2px) rotate(-5deg) scale(1.06); }
    50%  { transform: translateX(5vh)    translateY(0)   rotate(5deg)  scale(1);    }
    75%  { transform: translateX(-2.5vh) translateY(1px) rotate(-2deg) scale(1.04); }
    100% { transform: translateX(0)      translateY(0)   rotate(0deg)  scale(1);    }
}
.schaf-neu { animation: schafDrop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes schafDrop {
    0%   { transform: scale(0.5) translateY(-30px); opacity: 0; }
    100% { transform: scale(1) translateY(0);       opacity: 1; }
}
.schaf-blase {
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
}
.schaf-blase.sichtbar {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.bild-multiply { mix-blend-mode: multiply; }

/* ============================================================
   System-Nachrichten
   ============================================================ */
.chat-system-hinweis {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 6px 12px;
    margin: 10px auto;
    align-self: center;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #16a34a;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 5000;
    animation: toastFade 2.5s ease forwards;
    max-width: 90vw;
    text-align: center;
    pointer-events: none;
}
.toast.fehler { background: #dc2626; }
@keyframes toastFade {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    85%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================================
   NEU: Footer mit Recht-Links
   ============================================================ */
#tutor-footer {
    flex-shrink: 0;
    background: #efeae2;
    border-top: 1px solid #e2e8f0;
    padding: 3px 8px;
    padding-bottom: max(3px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 10px;
    color: #94a3b8;
    z-index: 5;
    line-height: 1.2;
}
#tutor-footer button {
    background: none;
    border: 0;
    color: #64748b;
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    padding: 2px 4px;
    -webkit-tap-highlight-color: transparent;
}
#tutor-footer button:hover,
#tutor-footer button:active {
    color: #0284c7;
    text-decoration: underline;
}
#tutor-footer .sep { color: #cbd5e1; user-select: none; }

/* ============================================================
   NEU: Modals (Hilfe & Recht)
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    z-index: 5000;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.modal-box {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 800px;
    height: 90vh;
    height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    background: #008069;
    color: white;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: transparent;
    border: 0;
    color: white;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.modal-close:hover,
.modal-close:active { background: rgba(255,255,255,0.2); }
.modal-iframe {
    flex: 1;
    width: 100%;
    border: 0;
    background: #efeae2;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}