/* Léna Panel — TrackMate v2 */

:root {
    --lena-bg: #0a0e17;
    --lena-bg-light: #111827;
    --lena-accent: #f59e0b;
    --lena-accent-hover: #d97706;
    --lena-text: #e5e7eb;
    --lena-text-muted: #9ca3af;
    --lena-border: #1f2937;
    --lena-user-bg: #1e3a5f;
    --lena-assistant-bg: #1a1a2e;
}

/* Bottom bar (collapsed) */
.lena-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--lena-bg);
    border-top: 2px solid var(--lena-accent);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.lena-bar:hover {
    background: var(--lena-bg-light);
}

.lena-bar.hidden {
    display: none;
}

/* Panel (expanded) */
.lena-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    height: 50vh;
    min-height: 25vh;
    max-height: 85vh;
    background: var(--lena-bg);
    border-top: 2px solid var(--lena-accent);
    display: flex;
    flex-direction: column;
    transition: height 0.1s ease;
}

.lena-panel.hidden {
    display: none;
}

/* Drag handle */
.lena-drag {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 0;
    cursor: ns-resize;
    flex-shrink: 0;
}

.lena-drag-handle {
    width: 40px;
    height: 4px;
    background: #4b5563;
    border-radius: 2px;
}

.lena-drag:hover .lena-drag-handle {
    background: var(--lena-accent);
}

/* Header */
.lena-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    flex-shrink: 0;
    border-bottom: 1px solid var(--lena-border);
}

.lena-header:hover {
    background: var(--lena-bg-light);
}

.lena-header-btn {
    margin-left: auto;
    color: var(--lena-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.lena-header-btn:hover {
    color: var(--lena-accent);
    background: rgba(255,255,255,0.05);
}

/* Avatar */
.lena-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lena-accent), #ef4444);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.lena-name {
    color: var(--lena-accent);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
}

.lena-role {
    color: var(--lena-text-muted);
    font-size: 12px;
}

.lena-toggle {
    margin-left: 0;
    color: var(--lena-text-muted);
    font-size: 14px;
}

.lena-last-msg {
    color: var(--lena-text-muted);
    font-size: 13px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Messages area */
.lena-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lena-messages::-webkit-scrollbar {
    width: 6px;
}

.lena-messages::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

/* Message bubbles */
.lena-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--lena-text);
    word-wrap: break-word;
}

.lena-msg.user {
    align-self: flex-end;
    background: var(--lena-user-bg);
    border-bottom-right-radius: 4px;
}

.lena-msg.assistant {
    align-self: flex-start;
    background: var(--lena-assistant-bg);
    border: 1px solid var(--lena-accent);
    border-bottom-left-radius: 4px;
}

/* Thinking animation */
.lena-msg.thinking {
    align-self: flex-start;
    background: var(--lena-assistant-bg);
    border: 1px solid var(--lena-accent);
    border-bottom-left-radius: 4px;
}

.lena-thinking-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: var(--lena-accent);
    border-radius: 50%;
    animation: lena-bounce 1.4s infinite ease-in-out both;
}

.lena-thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.lena-thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
.lena-thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes lena-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input area */
.lena-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--lena-border);
    flex-shrink: 0;
}

#lena-input {
    flex: 1;
    background: var(--lena-bg-light);
    border: 1px solid var(--lena-border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--lena-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    min-height: 38px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
}

#lena-input:focus {
    border-color: var(--lena-accent);
}

#lena-input::placeholder {
    color: var(--lena-text-muted);
}

#lena-send {
    background: var(--lena-accent);
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

#lena-send:hover {
    background: var(--lena-accent-hover);
}

#lena-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Card action messages */
.lena-card-action {
    align-self: flex-start;
    background: #052e16;
    border: 1px solid #22c55e;
    border-bottom-left-radius: 4px;
    font-size: 13px;
}

.lena-card-action strong {
    color: #22c55e;
}

.lena-card-close {
    background: #1a1000;
    border-color: var(--lena-accent);
}

.lena-card-close strong {
    color: var(--lena-accent);
}

/* Suggest message */
.lena-card-suggest {
    align-self: flex-start;
    background: #0c1b3a;
    border: 1px solid #3b82f6;
    border-bottom-left-radius: 4px;
    font-size: 13px;
}

.lena-card-suggest em {
    color: #9ca3af;
    display: block;
    margin: 6px 0;
}

.lena-suggest-btn {
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

.lena-suggest-yes {
    background: #22c55e;
    color: #000;
}

.lena-suggest-yes:hover {
    background: #16a34a;
}

.lena-suggest-no {
    background: #374151;
    color: #9ca3af;
}

.lena-suggest-no:hover {
    background: #4b5563;
}

/* --- Markdown renderelés --- */

/* Inline code */
.lena-inline-code {
    background: #1e293b;
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85em;
}

/* Code blocks */
.lena-code-block {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.82em;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre;
}

.lena-code-lang {
    display: inline-block;
    background: #334155;
    color: #94a3b8;
    padding: 1px 8px;
    border-radius: 4px 4px 0 0;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

/* Blockquote */
.lena-quote {
    border-left: 3px solid var(--lena-accent);
    padding: 4px 12px;
    margin: 6px 0;
    color: #d1d5db;
    font-style: italic;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 0 4px 4px 0;
}

/* Links in messages */
.lena-link {
    color: #60a5fa;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}
.lena-link:hover {
    color: #93c5fd;
}

/* Bold/italic in messages */
.lena-msg strong {
    color: #fbbf24;
}

.lena-msg em {
    color: #a5b4fc;
}

/* --- Lecke rendszer --- */

/* Lesson bar (status strip below header) */
.lena-lesson-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: linear-gradient(90deg, #1e1b4b 0%, #312e81 100%);
    border-bottom: 1px solid #4338ca;
    flex-shrink: 0;
    font-size: 12px;
}

.lena-lesson-info {
    flex: 1;
    min-width: 0;
}

.lena-lesson-code {
    color: #818cf8;
    font-weight: 700;
    font-family: monospace;
}

.lena-lesson-title {
    color: #c7d2fe;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lena-lesson-stats {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.lena-lesson-stars {
    font-size: 11px;
}

.lena-lesson-scene {
    color: #a5b4fc;
    font-size: 11px;
    white-space: nowrap;
}

.lena-lesson-stop {
    background: none;
    border: 1px solid #6366f1;
    color: #a5b4fc;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.lena-lesson-stop:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Lesson action messages */
.lena-lesson-start {
    align-self: flex-start;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border: 1px solid #6366f1;
    border-bottom-left-radius: 4px;
    font-size: 13px;
}

.lena-lesson-start strong {
    color: #a5b4fc;
}

.lena-lesson-method {
    color: #818cf8;
    font-size: 11px;
}

.lena-lesson-point {
    align-self: flex-start;
    background: #052e16;
    border: 1px solid #22c55e;
    border-bottom-left-radius: 4px;
    font-size: 13px;
}

.lena-point-reason {
    color: #86efac;
    font-size: 11px;
    font-style: italic;
}

.lena-lesson-complete-pass {
    align-self: flex-start;
    background: linear-gradient(135deg, #1a1000, #422006);
    border: 2px solid var(--lena-accent);
    border-bottom-left-radius: 4px;
    font-size: 14px;
    padding: 14px 18px;
}

.lena-lesson-complete-fail {
    align-self: flex-start;
    background: #1c1917;
    border: 1px solid #78716c;
    border-bottom-left-radius: 4px;
    font-size: 13px;
    padding: 14px 18px;
}

/* Lesson picker */
.lena-lesson-picker {
    align-self: stretch !important;
    max-width: 100% !important;
    background: var(--lena-bg-light);
    border: 1px solid var(--lena-border);
    border-radius: 12px;
    padding: 14px;
}

.lena-picker-header {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--lena-text);
}

.lena-picker-grade {
    color: var(--lena-accent);
    font-weight: 700;
    font-size: 13px;
    margin: 10px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lena-picker-lesson {
    display: block;
    width: 100%;
    text-align: left;
    background: #1a1a2e;
    border: 1px solid #2d2d44;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 4px 0;
    color: var(--lena-text);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.lena-picker-lesson:hover {
    background: #2a2a4a;
    border-color: #6366f1;
}

.lena-picker-lesson.lena-lesson-done {
    border-color: #22c55e;
    opacity: 0.7;
}

.lena-picker-lesson.lena-lesson-done:hover {
    opacity: 1;
}

.lena-picker-loading {
    color: var(--lena-text-muted);
    text-align: center;
    padding: 20px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .lena-msg {
        max-width: 90%;
        font-size: 13px;
    }

    .lena-panel {
        height: 60vh;
    }

    .lena-lesson-bar {
        flex-wrap: wrap;
    }
}
