/* ============================================
   LORA THEME — Modro-ružová, vysoký kontrast
   ============================================ */

:root {
    --bg-deep: #0a0a14;
    --bg-panel: #12122a;
    --bg-sidebar: #0d0d20;
    --bg-input: #1a1a2e;
    --blue: #4fc3f7;
    --blue-dark: #0288d1;
    --pink: #e84393;
    --pink-light: #fd79a8;
    --text: #e0e0e0;
    --text-dim: #8888aa;
    --border: #1e1e3a;
    --success: #00e676;
    --accent-gradient: linear-gradient(135deg, var(--blue), var(--pink));
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
    display: flex;
    height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    gap: 20px;
}

.lora-profile { text-align: center; }

.lora-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid transparent;
    background: var(--accent-gradient);
    padding: 3px;
    object-fit: cover;
    box-shadow: 0 0 24px rgba(232, 67, 147, 0.3);
}

.lora-name {
    font-size: 1.4em;
    margin-top: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lora-subtitle {
    font-size: 0.8em;
    color: var(--text-dim);
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.btn-reset, .btn-backup {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.btn-reset:hover { border-color: var(--pink); }
.btn-backup:hover { border-color: var(--blue); }

.sidebar-status {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75em;
    color: var(--text-dim);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffc107;
}
.status-dot.connected { background: var(--success); }
.status-dot.error { background: #ff5252; }

/* ============================================
   MAIN
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9em;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active {
    color: var(--pink);
    border-bottom-color: var(--pink);
}

/* ============================================
   TAB PANELS
   ============================================ */
.tab-panel { display: none; flex: 1; flex-direction: column; }
.tab-panel.active { display: flex; }

/* ============================================
   CHAT
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: var(--bg-deep); }
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
}

.message.lora .msg-avatar {
    background: linear-gradient(135deg, var(--blue-dark), var(--pink));
}

.message.user .msg-avatar {
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.msg-content {
    background: var(--bg-panel);
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.95em;
}

.message.user .msg-content {
    background: var(--blue-dark);
    color: #fff;
}

.msg-content p { margin: 0; }
.msg-content p + p { margin-top: 8px; }
.msg-content code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.msg-content pre {
    background: rgba(0,0,0,0.4);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}
.msg-content pre code {
    background: none;
    padding: 0;
}

.msg-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

/* ============================================
   INPUT AREA
   ============================================ */
.chat-input-area {
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
}

.image-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}

.image-preview img {
    max-height: 100px;
    border-radius: 8px;
    border: 2px solid var(--pink);
}

.btn-remove-image {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ff5252;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.75em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.btn-attach {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-size: 1.2em;
    transition: border-color 0.2s;
    flex-shrink: 0;
}
.btn-attach:hover { border-color: var(--blue); }

#chatInput {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95em;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}
#chatInput:focus { border-color: var(--pink); }

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.1em;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.btn-send:hover { opacity: 0.9; }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================
   TYPING INDICATOR
   ============================================ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pink);
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* ============================================
   LOGS
   ============================================ */
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.btn-refresh {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
}

.log-content {
    flex: 1;
    background: var(--bg-deep);
    color: var(--text-dim);
    padding: 16px;
    margin: 0;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8em;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 12px 8px;
    }
    .lora-photo { width: 44px; height: 44px; }
    .lora-name, .lora-subtitle, .btn-reset, .btn-backup, .status-text { display: none; }
    .message { max-width: 90%; }
}
