/* MarIA Psychology Chatbot Styles - Turquoise Theme for Igor Duarte */

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@400;500;600;700&family=Instrument+Sans:wght@400;500;600&display=swap');

:root {
    --primary-color: #17A2B8;
    --primary-dark: #0C7B8E;
    --primary-light: #40CBD9;
    --accent-color: #20C997;
    --base-color: #FFFFFF;
    --light-bg: #F8FCFC;
    --lighter-bg: #FEFEFE;
    --text-dark: #1A202C;
    --text-muted: #4A5568;
    --text-light: #9CA3AF;
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;
    --shadow-soft: rgba(23, 162, 184, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --success-color: #20C997;
    --gradient-primary: linear-gradient(135deg, #17A2B8 0%, #40CBD9 100%);
    --gradient-light: linear-gradient(135deg, #FFFFFF 0%, #F8FCFC 100%);
    --gradient-accent: linear-gradient(135deg, #20C997 0%, #6FEDD6 100%);
}

#livia-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#livia-chat-bubble {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse 3s infinite;
    border: 3px solid var(--base-color);
}

#livia-chat-bubble:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 30px var(--shadow-soft);
}

#livia-chat-bubble svg {
    width: 32px;
    height: 32px;
    fill: var(--base-color);
}

@keyframes pulse {
    0% { 
        box-shadow: 0 4px 20px var(--shadow-soft), 0 0 0 0 rgba(23, 162, 184, 0.3);
    }
    50% { 
        box-shadow: 0 4px 20px var(--shadow-soft), 0 0 0 8px rgba(23, 162, 184, 0);
    }
    100% { 
        box-shadow: 0 4px 20px var(--shadow-soft), 0 0 0 0 rgba(23, 162, 184, 0);
    }
}

#livia-chat-widget {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: min(450px, calc(100vw - 40px));
    height: min(650px, calc(100vh - 140px));
    max-width: 450px;
    max-height: 650px;
    background: var(--base-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--shadow-light), 0 0 0 1px var(--border-color);
    overflow: hidden;
    z-index: 10000;
}

#livia-chat-widget.show {
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

#livia-chat-header {
    background: var(--gradient-light);
    color: var(--text-dark);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    min-height: 60px;
    box-sizing: border-box;
}

#livia-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Jost', sans-serif;
    letter-spacing: -0.02em;
    color: var(--text-dark);
}

.header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

#livia-chat-refresh,
#livia-chat-close {
    background: var(--border-light);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

#livia-chat-close {
    font-size: 18px;
}

#livia-chat-refresh:hover,
#livia-chat-close:hover {
    background: var(--primary-color);
    color: var(--base-color);
    border-color: var(--primary-color);
}

#livia-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #FFFFFF;
    min-height: 350px;
    max-height: calc(100vh - 280px);
}

.livia-message {
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.livia-message.bot {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.livia-message.user {
    text-align: right;
}

.livia-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--base-color);
    font-size: 14px;
    font-weight: 700;
    font-family: 'Jost', sans-serif;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--shadow-soft);
    border: 2px solid var(--base-color);
}

.livia-message-content {
    max-width: 80%;
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    font-weight: 400;
}

.livia-message.bot .livia-message-content {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    color: #1A202C;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.livia-message.user .livia-message-content {
    background: var(--gradient-primary);
    color: var(--base-color);
    margin-left: auto;
    display: inline-block;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 1px 3px var(--shadow-soft);
    font-weight: 500;
}

.livia-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-left: 48px;
}

.livia-button {
    background: var(--base-color);
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Jost', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px var(--shadow-light);
    tabindex: 0;
    outline: none;
}

.livia-button:hover {
    background: var(--primary-color);
    color: var(--base-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-soft);
}

.livia-button:active {
    transform: translateY(0);
}

#livia-chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--base-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
    min-height: 80px;
    box-sizing: border-box;
}

#livia-chat-input {
    flex: 1;
    border: 1.5px solid #E2E8F0;
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 15px;
    font-family: 'Instrument Sans', sans-serif;
    outline: none;
    resize: none;
    min-height: 24px;
    max-height: 80px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background: #FFFFFF;
    color: #1A202C;
}

#livia-chat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
    background: var(--base-color);
}

#livia-chat-input::placeholder {
    color: #9CA3AF;
    font-weight: 400;
}

#livia-chat-input:disabled {
    background: #F3F4F6;
    color: #9CA3AF;
    cursor: not-allowed;
    border-color: #E5E7EB;
}

#livia-send-button {
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Instrument Sans', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--base-color);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--shadow-soft);
    white-space: nowrap;
    min-height: 44px;
}

#livia-send-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-soft);
}

#livia-send-button:active {
    transform: translateY(0);
    background: var(--primary-dark);
}

#livia-send-button:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.livia-typing {
    display: flex;
    align-items: center;
    gap: 12px;
}

.livia-typing .livia-message-content {
    padding: 16px 20px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.livia-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.livia-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typingDots 1.6s infinite;
}

.livia-typing-dot:nth-child(2) {
    animation-delay: 0.3s;
}

.livia-typing-dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Enhanced link styling for WhatsApp links */
.livia-message-content a {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    background: rgba(23, 162, 184, 0.1) !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(23, 162, 184, 0.2) !important;
    display: inline-block !important;
    margin: 2px 0 !important;
    transition: all 0.2s ease !important;
}

.livia-message-content a:hover {
    background: var(--primary-color) !important;
    color: var(--base-color) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px var(--shadow-soft) !important;
}

/* Enhanced Mobile responsiveness */
@media (max-width: 768px) {
    #livia-chatbot {
        bottom: 15px;
        right: 15px;
    }
    
    #livia-chat-widget {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        max-height: 90vh;
        bottom: 85px;
        right: 15px;
        left: 15px;
        border-radius: 12px;
    }
    
    #livia-chat-header {
        padding: 12px 16px;
        min-height: 56px;
    }
    
    #livia-chat-header h3 {
        font-size: 16px;
    }
    
    #livia-chat-messages {
        padding: 16px;
        min-height: 250px;
    }
    
    #livia-chat-input-area {
        padding: 12px 16px;
        min-height: 70px;
        gap: 8px;
    }
    
    #livia-send-button {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    #livia-chat-bubble {
        width: 56px;
        height: 56px;
    }
    
    #livia-chat-bubble svg {
        width: 28px;
        height: 28px;
    }
    
    #livia-chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 75px;
        right: 10px;
        left: 10px;
    }
    
    #livia-chat-messages {
        padding: 12px;
        max-height: calc(100% - 100px);
    }
    
    .livia-message-content {
        font-size: 14px;
        max-width: 90%;
        padding: 12px 16px;
    }
    
    .livia-buttons {
        padding-left: 0;
    }
    
    #livia-chat-input {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 36px;
    }
    
    #livia-send-button {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }
    
    #livia-chat-input-area {
        padding: 10px;
        min-height: 56px;
        gap: 6px;
    }
    
    #livia-chat-header {
        padding: 15px;
    }
    
    #livia-chat-header h3 {
        font-size: 16px;
    }
}

/* Hide on very small screens */
@media (max-width: 320px) {
    #livia-chatbot {
        display: none;
    }
}

/* Enhanced scrollbar */
#livia-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#livia-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#livia-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#livia-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Accessibility improvements */
.livia-button:focus,
#livia-chat-input:focus,
#livia-send-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #livia-chat-bubble {
        animation: none;
    }
    
    .livia-message {
        animation: none;
    }
    
    .livia-typing-dot {
        animation: none;
    }
    
    * {
        transition: none !important;
    }
}