@charset "utf-8";
/* CSS Document */

.perplexity-chat-container {
    max-width: 800px;
    margin: 2rem auto;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 700px;
}

.chat-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #0073aa, #006098);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reset-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: rgba(255,255,255,0.3);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-content {
    padding: 15px 20px;
    border-radius: 18px;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.user-message {
    margin-left: auto;
}

.user-message .message-content {
    background: #0073aa;
    color: white;
    border-bottom-right-radius: 5px;
}

.assistant-message {
    margin-right: auto;
}

.assistant-message .message-content {
    background: #fff;
    border: 1px solid #eaeaea;
    border-bottom-left-radius: 5px;
    padding-right: 40px; /* Space for speak button */
}

.speak-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.speak-btn:hover {
    background: rgba(0,0,0,0.1);
}

.speak-btn svg {
    width: 14px;
    height: 14px;
}

.loading .message-content {
    color: #777;
    font-style: italic;
}

.chat-input-area {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

.input-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

#chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #eaeaea;
    border-radius: 12px;
    font-size: 16px;
    resize: none;
    min-height: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#chat-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,115,170,0.15);
}

.button-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-status {
    font-size: 0.85em;
    color: #777;
    text-align: center;
    min-width: 60px;
    white-space: nowrap;
}

.round-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.voice-btn {
    background: #5c6bc0;
    color: white;
}

.voice-btn:hover {
    background: #3f51b5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92, 107, 192, 0.3);
}

.voice-btn.active {
    background: #e53935;
    animation: listening-pulse 1.5s infinite;
}

@keyframes listening-pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.7);
        transform: scale(1);
    }
    70% { 
        box-shadow: 0 0 0 15px rgba(229, 57, 53, 0);
        transform: scale(1.05);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(229, 57, 53, 0);
        transform: scale(1);
    }
}

.send-btn {
    background: #0073aa;
    color: white;
}

.send-btn:hover {
    background: #006098;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.icon-svg {
    width: 24px;
    height: 24px;
    display: block;
    pointer-events: none;
    filter: brightness(0) invert(1); /* Makes icons white */
}

/* Voice prompt */
.voice-prompt {
    background-color: #e3f2fd;
    border-radius: 18px;
    padding: 15px 20px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.voice-prompt p {
    margin: 0;
    font-weight: 600;
}

.voice-prompt-buttons {
    display: flex;
    gap: 10px;
}

.voice-prompt-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.voice-prompt-yes {
    background: #27ae60;
    color: white;
}

.voice-prompt-yes:hover {
    background: #229954;
}

.voice-prompt-no {
    background: #e0e0e0;
    color: #333;
}

.voice-prompt-no:hover {
    background: #d5d5d5;
}

.citations {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
    font-size: 0.95em;
}

.citations ul {
    padding-left: 20px;
    margin: 10px 0 0 0;
}

.citations li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.citations a {
    color: #0073aa;
    text-decoration: underline;
    transition: color 0.3s;
}

.citations a:hover {
    color: #005a8c;
    text-decoration: none;
}

.chat-history::-webkit-scrollbar {
    width: 8px;
}

.chat-history::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive design */
@media (max-width: 768px) {
    .perplexity-chat-container {
        margin: 1rem;
        height: 85vh;
    }
    
    .input-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .button-controls {
        align-self: stretch;
        justify-content: center;
    }
    
    #chat-input {
        min-height: 60px;
    }
    
    .round-btn {
        width: 45px;
        height: 45px;
    }
    
    .icon-svg {
        width: 20px;
        height: 20px;
    }
}
