/* Kaze - Pure ASCII Terminal Aesthetic */

#kaze-container {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
    z-index: 100;
}

#kaze {
    position: absolute;
    bottom: 0;
    left: 40px;
    pointer-events: auto;
    cursor: pointer;
}

#kaze:hover {
    filter: drop-shadow(0 0 10px var(--accent, #D6686F));
}

#kaze:hover .click-hint {
    opacity: 1;
}

.kaze-ascii {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    line-height: 1.15;
    color: var(--text-primary, #CDC5BC);
    margin: 0;
    white-space: pre;
    user-select: none;
}

.click-hint {
    font-size: 14px;
    color: var(--accent, #D6686F);
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.3s;
    display: block;
    text-align: center;
    margin-bottom: 0;
    line-height: 1;
    animation: clickBounce 2s ease-in-out infinite;
}

@keyframes clickBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.kaze-ascii .eye-l,
.kaze-ascii .eye-r {
    color: var(--accent, #D6686F);
    transition: color 0.1s;
}

/* Thinking animation */
#kaze.thinking .kaze-ascii {
    animation: kazeThink 0.4s ease-in-out infinite;
}

@keyframes kazeThink {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ==========================================
   ASCII STYLED CHAT BOX
   ========================================== */

.kaze-chatbox {
    position: fixed;
    bottom: 140px;
    left: 20px;
    width: 340px;
    max-width: calc(100vw - 30px);
    background: var(--bg-primary, #1F4437);
    border: 1px solid var(--text-primary, #CDC5BC);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', monospace;
}

.kaze-chatbox.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ASCII-style speech tail */
.kaze-chatbox::after {
    content: '╲';
    position: absolute;
    bottom: -16px;
    left: 30px;
    font-size: 20px;
    color: var(--text-primary, #CDC5BC);
    line-height: 1;
}

/* Header - terminal style */
.chatbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--text-primary, #CDC5BC);
    background: var(--bg-secondary, #172e28);
}

.chatbox-title {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-primary, #CDC5BC);
    letter-spacing: 1px;
}

.chatbox-title::before {
    content: '[ ';
    color: var(--text-muted, #3E7A64);
}

.chatbox-title::after {
    content: ' ]';
    color: var(--text-muted, #3E7A64);
}

.chatbox-close {
    background: none;
    border: none;
    color: var(--text-muted, #3E7A64);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    transition: color 0.2s;
}

.chatbox-close:hover {
    color: var(--accent, #D6686F);
}

/* Messages area */
.chatbox-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 150px;
    max-height: 250px;
    font-size: 13px;
    line-height: 1.5;
}

.chatbox-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbox-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary, #172e28);
}

.chatbox-messages::-webkit-scrollbar-thumb {
    background: var(--text-muted, #3E7A64);
}

.chat-message {
    color: var(--text-primary, #CDC5BC);
    word-wrap: break-word;
}

.chat-message .msg-body {
    color: var(--text-primary, #CDC5BC);
}

.chat-message .msg-prefix {
    color: var(--accent, #D6686F);
    font-weight: 500;
}

.chat-message.user .msg-prefix {
    color: var(--text-muted, #3E7A64);
}

/* Typing animation */
.typing .typing-spinner {
    color: var(--text-muted, #3E7A64);
    display: inline-block;
    min-width: 9ch;
    letter-spacing: 0.5ch;
    font-weight: 500;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Input area - terminal style */
.chatbox-input-container {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid var(--text-primary, #CDC5BC);
    background: var(--bg-secondary, #172e28);
    gap: 8px;
}

.chatbox-input-container::before {
    content: '>';
    color: var(--accent, #D6686F);
    font-size: 14px;
    flex-shrink: 0;
}

.chatbox-input {
    flex: 1;
    background: transparent;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary, #CDC5BC);
    outline: none;
    caret-color: var(--accent, #D6686F);
}

.chatbox-input::placeholder {
    color: var(--text-muted, #3E7A64);
}

/* Hide the send button - just use Enter */
.chatbox-send {
    display: none;
}

/* ==========================================
   TABLET
   ========================================== */
@media (max-width: 1024px) {
    #kaze-container {
        bottom: 15px;
    }
    
    .kaze-ascii {
        font-size: 16px;
    }
    
    .click-hint {
        font-size: 12px;
    }
    
    .kaze-chatbox {
        width: 320px;
        bottom: 130px;
    }
}

/* ==========================================
   MOBILE
   ========================================== */
@media (max-width: 768px) {
    #kaze-container {
        bottom: 10px;
        height: 100px;
    }
    
    #kaze {
        left: 15px !important;
    }
    
    .kaze-ascii {
        font-size: 14px;
    }
    
    .click-hint {
        font-size: 11px;
    }
    
    .kaze-chatbox {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 95px;
        max-height: 55vh;
    }
    
    .kaze-chatbox::after {
        left: 20px;
    }
    
    .chatbox-messages {
        max-height: 35vh;
        min-height: 120px;
    }
    
    .chatbox-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ==========================================
   SMALL MOBILE
   ========================================== */
@media (max-width: 480px) {
    #kaze-container {
        bottom: 8px;
        height: 90px;
    }
    
    .kaze-ascii {
        font-size: 12px;
    }
    
    .click-hint {
        font-size: 10px;
    }
    
    .kaze-chatbox {
        left: 8px;
        right: 8px;
        bottom: 85px;
    }
    
    .chatbox-header {
        padding: 6px 10px;
    }
    
    .chatbox-messages {
        padding: 10px;
        font-size: 12px;
    }
    
    .chatbox-input-container {
        padding: 8px 10px;
    }
}
