/*
Theme Name: GeminiPulse AI Assistant
Theme URI: https://shokek.online/
Author: Custom WP Developer
Description: Complete Gemini & ChatGPT Style Conversational AI WordPress Theme supporting Gemini 3.8 Flash (Free) & OpenAI API.
Version: 3.0.0
License: GNU General Public License v2 or later
Text Domain: geminipulse
*/

:root {
    --bg-sidebar: #f0f4f9;
    --bg-main: #ffffff;
    --bg-input: #f0f4f9;
    --bg-user-msg: #e8f0fe;
    --bg-ai-msg: #ffffff;
    --text-main: #1f1f1f;
    --text-muted: #5f6368;
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --border-color: #e0e3e7;
    --code-bg: #1e293b;
    --code-text: #f8fafc;
}

body.dark-mode {
    --bg-sidebar: #1e1f20;
    --bg-main: #131314;
    --bg-input: #1e1f20;
    --bg-user-msg: #282a2c;
    --bg-ai-msg: #131314;
    --text-main: #e3e3e3;
    --text-muted: #9aa0a6;
    --primary: #8ab4f8;
    --primary-hover: #aecbfa;
    --border-color: #333537;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

.ai-app-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
}

.ai-sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: transform 0.3s ease;
    z-index: 50;
}

.ai-new-chat-btn {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s;
}

.ai-new-chat-btn:hover {
    background: var(--bg-user-msg);
}

.ai-history-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 22px 8px 10px;
    letter-spacing: 0.04em;
}

.ai-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-history-item {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-history-item:hover, .ai-history-item.active {
    background: var(--bg-user-msg);
}

.ai-sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-side-link {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-side-link:hover {
    background: var(--bg-user-msg);
}

.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

.ai-topbar {
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.ai-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

.ai-model-pill {
    font-size: 0.78rem;
    background: var(--bg-sidebar);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.ai-mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-main);
    cursor: pointer;
}

.ai-chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px 40px;
    scroll-behavior: smooth;
}

.ai-stream-inner {
    max-width: 820px;
    margin: 0 auto;
}

.ai-welcome {
    text-align: center;
    padding: 50px 10px 20px;
}

.ai-welcome h1 {
    font-size: 2.3rem;
    font-weight: 800;
    background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.ai-welcome p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

.ai-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    text-align: left;
}

.ai-suggestion-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s;
}

.ai-suggestion-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.ai-suggestion-card strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.ai-suggestion-card span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.ai-msg-row {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.ai-msg-row.user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    font-weight: 700;
}

.ai-avatar.bot {
    background: linear-gradient(135deg, #4285f4, #9b72cb);
    color: #fff;
}

.ai-avatar.user {
    background: var(--primary);
    color: #fff;
}

.ai-bubble {
    max-width: 82%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.98rem;
    line-height: 1.65;
    word-wrap: break-word;
}

.ai-msg-row.user .ai-bubble {
    background: var(--bg-user-msg);
    border-bottom-right-radius: 4px;
}

.ai-msg-row.bot .ai-bubble {
    background: var(--bg-ai-msg);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    width: 100%;
}

.ai-bubble p {
    margin-bottom: 10px;
}

.ai-bubble p:last-child {
    margin-bottom: 0;
}

.ai-bubble ul, .ai-bubble ol {
    margin: 8px 0 12px 22px;
}

.ai-bubble pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 14px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 12px 0;
    position: relative;
    font-size: 0.88rem;
}

.ai-copy-code {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
}

.ai-msg-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.ai-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 5px;
}

.ai-action-btn:hover {
    background: var(--bg-sidebar);
    color: var(--text-main);
}

.ai-typing {
    display: inline-flex;
    gap: 5px;
    padding: 6px 4px;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.3s infinite ease-in-out;
}

.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.ai-input-area {
    padding: 12px 16px 20px;
    background: var(--bg-main);
}

.ai-input-box {
    max-width: 820px;
    margin: 0 auto;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 14px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ai-input-box:focus-within {
    border-color: var(--primary);
}

.ai-input-box textarea {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    max-height: 160px;
    padding: 8px 4px;
    outline: none;
    line-height: 1.5;
}

.ai-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.ai-icon-btn:hover {
    background: rgba(0,0,0,0.06);
    color: var(--text-main);
}

.ai-send-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.ai-send-btn:hover {
    background: var(--primary-hover);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

@media (max-width: 768px) {
    .ai-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .ai-sidebar.open {
        transform: translateX(0);
    }
    .ai-mobile-menu-btn {
        display: inline-block;
    }
    .ai-welcome h1 {
        font-size: 1.7rem;
    }
}
