/* ── Ollama Chat — Clean Claude/ChatGPT style UI ── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

#ollama-wrap {
    --bg:        #ffffff;
    --surface:   #f8f8f8;
    --border:    #e8e8e8;
    --text:      #1a1a1a;
    --subtext:   #6b6b6b;
    --accent:    #e63946;
    --accent-dk: #c1121f;
    --user-bg:   #1a1a2e;
    --bot-bg:    #f3f3f3;
    --radius:    18px;
    --font:      'Sora', sans-serif;

    font-family: var(--font);
    background:  var(--bg);
    color:       var(--text);
    min-height:  80vh;
    display:     flex;
    flex-direction: column;
    align-items: center;
    padding:     0 16px 0;
    position:    relative;
}

/* ── Hero ── */
#ollama-hero {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    text-align:     center;
    padding:        80px 20px 40px;
    max-width:      680px;
    width:          100%;
    animation:      ollama-fade-up 0.5s ease both;
}

.ollama-logo {
    margin-bottom: 28px;
    filter: drop-shadow(0 4px 16px rgba(230,57,70,0.3));
}

.ollama-hero-title {
    font-size:   2.4rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #1a1a2e 0%, #e63946 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ollama-hero-sub {
    font-size:   1rem;
    color:       var(--subtext);
    font-weight: 300;
    line-height: 1.6;
    margin-bottom: 36px;
}

/* ── Suggestion Pills ── */
.ollama-suggestions {
    display:   flex;
    flex-wrap: wrap;
    gap:       10px;
    justify-content: center;
}

.ollama-suggestion-pill {
    background:    var(--surface);
    border:        1.5px solid var(--border);
    border-radius: 100px;
    padding:       10px 18px;
    font-size:     0.85rem;
    font-family:   var(--font);
    font-weight:   400;
    color:         var(--text);
    cursor:        pointer;
    transition:    all 0.2s ease;
    white-space:   nowrap;
}
.ollama-suggestion-pill:hover {
    border-color: var(--accent);
    color:        var(--accent);
    background:   #fff5f5;
    transform:    translateY(-1px);
}

/* ── Messages ── */
#ollama-messages {
    width:      100%;
    max-width:  740px;
    padding:    24px 0 32px;
    display:    flex;
    flex-direction: column;
    gap:        28px;
}

.ollama-msg {
    display:   flex;
    gap:       14px;
    animation: ollama-fade-up 0.3s ease both;
}

.ollama-msg.user {
    flex-direction: row-reverse;
}

.ollama-msg-avatar {
    width:       36px;
    height:      36px;
    border-radius: 50%;
    display:     flex;
    align-items: center;
    justify-content: center;
    font-size:   13px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top:  2px;
}
.ollama-msg.bot  .ollama-msg-avatar { background: #0f0f1a; color: #e63946; }
.ollama-msg.user .ollama-msg-avatar { background: #e63946; color: white; }

.ollama-msg-content {
    max-width: 80%;
    display:   flex;
    flex-direction: column;
    gap:       4px;
}

.ollama-msg-name {
    font-size:   11px;
    font-weight: 500;
    color:       var(--subtext);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.ollama-msg.user .ollama-msg-name { text-align: right; }

.ollama-bubble {
    padding:       14px 18px;
    border-radius: var(--radius);
    line-height:   1.7;
    font-size:     0.95rem;
    font-weight:   300;
}
.ollama-msg.bot .ollama-bubble {
    background:           var(--bot-bg);
    color:                var(--text);
    border-bottom-left-radius: 4px;
}
.ollama-msg.user .ollama-bubble {
    background:            var(--user-bg);
    color:                 #ffffff;
    border-bottom-right-radius: 4px;
}

/* ── Typing indicator ── */
.ollama-typing-wrap {
    display:   flex;
    gap:       14px;
    animation: ollama-fade-up 0.3s ease both;
}
.ollama-typing-bubble {
    background:    var(--bot-bg);
    border-radius: var(--radius);
    border-bottom-left-radius: 4px;
    padding:       16px 20px;
    display:       flex;
    gap:           6px;
    align-items:   center;
}
.ollama-typing-bubble span {
    width:  8px; height: 8px;
    background:    #aaa;
    border-radius: 50%;
    animation:     ollama-bounce 1.2s infinite;
    display:       block;
}
.ollama-typing-bubble span:nth-child(2) { animation-delay: .2s; }
.ollama-typing-bubble span:nth-child(3) { animation-delay: .4s; }

/* ── Input bar — sticky inside container, never overlaps footer ── */
#ollama-input-bar {
    position:   sticky;
    bottom:     0;
    width:      100%;
    max-width:  780px;
    background: linear-gradient(to top, #fff 80%, transparent);
    padding:    16px 0 24px;
    display:    flex;
    flex-direction: column;
    align-items: center;
    gap:        8px;
    z-index:    10;
    margin-top: auto;
}

#ollama-input-box {
    width:         100%;
    max-width:     740px;
    background:    #fff;
    border:        1.5px solid var(--border);
    border-radius: 16px;
    display:       flex;
    align-items:   flex-end;
    padding:       10px 10px 10px 18px;
    gap:           10px;
    box-shadow:    0 4px 24px rgba(0,0,0,0.08);
    transition:    border-color 0.2s, box-shadow 0.2s;
}
#ollama-input-box:focus-within {
    border-color: #1a1a2e;
    box-shadow:   0 4px 24px rgba(0,0,0,0.13);
}

#ollama-input {
    flex:        1;
    border:      none;
    outline:     none;
    font-family: var(--font);
    font-size:   0.95rem;
    font-weight: 300;
    color:       var(--text);
    background:  transparent;
    resize:      none;
    line-height: 1.6;
    max-height:  160px;
    overflow-y:  auto;
}
#ollama-input::placeholder { color: #bbb; }

#ollama-send {
    width:         42px;
    height:        42px;
    border-radius: 12px;
    background:    var(--user-bg);
    color:         white;
    border:        none;
    cursor:        pointer;
    display:       flex;
    align-items:   center;
    justify-content: center;
    flex-shrink:   0;
    transition:    background 0.2s, transform 0.1s;
}
#ollama-send:hover   { background: var(--accent); }
#ollama-send:active  { transform: scale(0.93); }
#ollama-send:disabled { background: #ddd; cursor: not-allowed; }

.ollama-footer-note {
    font-size:  11px;
    color:      #bbb;
    font-weight: 300;
    text-align: center;
}

/* ── Login notice ── */
.ollama-login-notice {
    max-width:     480px;
    margin:        80px auto;
    padding:       40px;
    text-align:    center;
    border:        1.5px solid var(--border);
    border-radius: 20px;
    font-family:   var(--font);
}
.ollama-login-notice h2 { font-size: 1.4rem; margin-bottom: 10px; }
.ollama-login-notice p  { color: var(--subtext); margin-bottom: 20px; }
.ollama-login-notice a  {
    display:       inline-block;
    background:    var(--user-bg);
    color:         white;
    padding:       12px 28px;
    border-radius: 100px;
    text-decoration: none;
    font-weight:   500;
    font-size:     0.9rem;
    transition:    background 0.2s;
}
.ollama-login-notice a:hover { background: var(--accent); }

/* ── Animations ── */
@keyframes ollama-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ollama-bounce {
    0%,80%,100% { transform: translateY(0); }
    40%         { transform: translateY(-6px); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .ollama-hero-title { font-size: 1.8rem; }
    #ollama-hero       { padding-top: 48px; }
    .ollama-msg-content { max-width: 92%; }
    .ollama-suggestion-pill { font-size: 0.8rem; padding: 8px 14px; }
}

/* ── Theme override protection ── */
#ollama-wrap button,
#ollama-wrap button:hover,
#ollama-wrap button:focus {
    background-image: none !important;
    text-transform:   none !important;
    letter-spacing:   normal !important;
    box-shadow:       none !important;
}
#ollama-send {
    background:    #1a1a2e !important;
    color:         white !important;
    width:         42px !important;
    height:        42px !important;
    border-radius: 12px !important;
    border:        none !important;
    padding:       0 !important;
    display:       flex !important;
    align-items:   center !important;
    justify-content: center !important;
    cursor:        pointer !important;
    flex-shrink:   0 !important;
}
#ollama-send:hover { background: #e63946 !important; }

.ollama-suggestion-pill {
    background:    #f8f8f8 !important;
    border:        1.5px solid #e8e8e8 !important;
    border-radius: 100px !important;
    padding:       10px 18px !important;
    font-size:     0.85rem !important;
    color:         #1a1a1a !important;
    cursor:        pointer !important;
    display:       inline-block !important;
    width:         auto !important;
}
.ollama-suggestion-pill:hover {
    border-color: #e63946 !important;
    color:        #e63946 !important;
    background:   #fff5f5 !important;
}

/* ── Markdown table rendering ─────────────────────────────────────── */
.ollama-msg-content table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 8px 0 !important;
    font-size: 0.875rem !important;
}
.ollama-msg-content table th {
    background: #f0f0f0 !important;
    padding: 7px 12px !important;
    text-align: left !important;
    font-weight: 600 !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
}
.ollama-msg-content table td {
    padding: 6px 12px !important;
    border: 1px solid #e0e0e0 !important;
    vertical-align: top !important;
    color: #1a1a1a !important;
}
.ollama-msg-content table tr:nth-child(even) td {
    background: #fafafa !important;
}
.ollama-msg-content h3,
.ollama-msg-content h4 {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    margin: 10px 0 4px !important;
    color: #222 !important;
}
.ollama-msg-content strong { font-weight: 600 !important; }

/* ── Lists ──────────────────────────────────────────────────────── */
.ollama-msg-content ul {
    margin: 6px 0 6px 0 !important;
    padding-left: 20px !important;
    list-style: disc !important;
}
.ollama-msg-content ul li {
    margin: 3px 0 !important;
    line-height: 1.5 !important;
    color: #1a1a1a !important;
}
/* ── Links ──────────────────────────────────────────────────────── */
.ollama-msg-content a {
    color: #e63946 !important;
    font-weight: 500 !important;
    text-decoration: underline !important;
    word-break: break-all !important;
}
.ollama-msg-content a:hover { opacity: 0.8 !important; }

/* ── Paragraphs inside bubble ───────────────────────────────────── */
.ollama-bubble p { margin: 2px 0 !important; }
.ollama-bubble hr {
    border: none !important;
    border-top: 1px solid #e0e0e0 !important;
    margin: 10px 0 !important;
}