/**
 * style.css - KISEE UI Framework
 * Core styling for the Chat Interface
 */

:root {
    --primary-color: #069483;
    --primary-hover: #f4f7f9;
    --bg-main: #f4f7f9;
    --bot-bubble: #ffffff;
    --user-bubble: #069483;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --border-color: #e4e6eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, sans-serif; }

body { 
    background-color: var(--bg-main); 
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

.chat-container { 
    width: 100%; 
    max-width: 650px; 
    height: 85vh; 
    background: #fff; 
    border-radius: 16px; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.1); 
    overflow: hidden;
}

header { 
    padding: 20px; 
    background: var(--primary-color); 
    color: var(--text-light); 
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header-info h1 { font-size: 1.25rem; font-weight: 600; }
.header-info p { font-size: 0.75rem; opacity: 0.8; }

.status-indicator { 
    font-size: 0.75rem; 
    background: #2ecc71; 
    padding: 3px 10px; 
    border-radius: 20px; 
    font-weight: bold;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.65rem; 
    background: rgba(0,0,0,0.15);
    padding: 6px 10px;
    border-radius: 6px;
    text-transform: uppercase;
}

.chat-window { 
    flex: 1; 
    padding: 25px; 
    overflow-y: auto; 
    background: #fdfdfd; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    /* FIX: Allows the chat window to shrink so the bottom button stays visible */
    min-height: 0; 
}

.message { 
    padding: 12px 18px; 
    border-radius: 18px; 
    font-size: 0.95rem; 
    max-width: 80%; 
    line-height: 1.5; 
    position: relative;
    word-wrap: break-word;
}

.user-message { 
    align-self: flex-end; 
    background: var(--user-bubble); 
    color: var(--text-light); 
    border-bottom-right-radius: 4px; 
}

.bot-message { 
    align-self: flex-start; 
    background: var(--bot-bubble); 
    color: var(--text-dark); 
    border-bottom-left-radius: 4px; 
    border: 1px solid var(--text-dark); 
}

.typing-indicator { 
    padding: 10px 25px; 
    display: flex; 
    gap: 5px; 
}

.typing-indicator span { 
    width: 7px; 
    height: 7px; 
    background: #bdc3c7; 
    border-radius: 50%; 
    animation: pulse 1.5s infinite ease-in-out; 
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.3); opacity: 1; }
}

.input-area { 
    padding: 20px; 
    border-top: 1px solid var(--border-color); 
    display: flex; 
    gap: 12px; 
    /* FIX: Prevents input area from being squished */
    flex-shrink: 0; 
}

input[type="text"] { 
    flex: 1; 
    padding: 14px 20px; 
    border: 1px solid var(--border-color); 
    border-radius: 30px; 
    background: #f8f9fa; 
    outline: none; 
    transition: border 0.2s;
}

input[type="text"]:focus { border-color: var(--primary-color); }

button { 
    background: var(--primary-color); 
    color: white; 
    border: none; 
    width: 48px; 
    height: 48px; 
    border-radius: 50%; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    transition: background 0.2s, transform 0.2s;
}

button:hover { 
    background: var(--primary-hover); 
    transform: rotate(-10deg);
}

.bot-message p { margin-bottom: 10px; }
.bot-message p:last-child { margin-bottom: 0; }
.bot-message ul, .bot-message ol { margin-left: 20px; margin-bottom: 10px; }

.bot-message code {
    background: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.bot-message pre {
    background: #2d3436;
    color: #dfe6e9;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.bot-message pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* ========================================================= */
/* AUTOPILOT UI & FIXES FOR SKILLS/MODEL                     */
/* ========================================================= */

#model-name-display {
    color: var(--text-dark);
}

.autopilot-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15); 
    padding: 6px 14px;
    border-radius: 20px;
}

.autopilot-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.2);
    transition: .3s; border-radius: 22px;
}
.slider:before {
    position: absolute; content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: #2ecc71; }
input:checked + .slider:before { transform: translateX(18px); }

#persona-select {
    background: white;
    color: var(--text-dark);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
}

/* FIX: Analyze Button anchoring and sizing */
button.analyze-btn {
    width: calc(100% - 40px);
    height: auto;
    margin: 0 20px 20px 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* FIX: Prevents button from being pushed out of the flex container */
    flex-shrink: 0; 
}

button.analyze-btn:hover {
    background-color: #058071;
    transform: scale(1.02);
}

/* FIX: Skills Container anchoring and internal scrollbar */
.skills-container {
    margin: 0 20px 20px 20px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    /* FIX: Keep it visible and allow internal scrolling if it gets too large */
    flex-shrink: 0;
    max-height: 150px;
    overflow-y: auto;
}

.skills-container h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.skill-tag {
    display: inline-block;
    background: #f8f9fa;
    color: var(--text-dark) !important;
    padding: 8px 16px;
    border-radius: 25px; 
    margin: 5px;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    position: relative;
    transition: all 0.2s;
}

.skill-tag:hover {
    background: var(--primary-color);
    color: #fff !important;
    border-color: var(--primary-color);
}

.skill-tag .tooltip {
    visibility: hidden;
    width: 250px;
    background-color: var(--text-dark);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: normal;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.skill-tag:hover .tooltip {
    visibility: visible;
    opacity: 1;
}