/* Chatbot Styles - Perfect Portfolio Theme Match */

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: chatbot-pulse 3s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 40px rgba(15, 80, 100, 0.25);
}

.chatbot-toggle i {
    color: var(--secondary-color);
    font-size: 28px;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active i {
    transform: rotate(45deg);
}

@keyframes chatbot-pulse {
    0%, 100% {
        box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16);
    }
    50% {
        box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.3), 0 0 0 10px rgba(15, 80, 100, 0.05);
    }
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 280px;
    max-width: calc(100vw - 50px);
    height: 360px;
    max-height: calc(100vh - 150px);
    background-color: var(--secondary-color);
    border: 2px solid transparent;
    border-radius: 18px;
    box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.4s ease-out;
    backdrop-filter: blur(10px);
    /* Ensure chatbot stays within viewport */
    top: auto;
    transform: none;
}

.chatbot-container.active {
    display: flex;
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
        scale: 0.9;
    }
    to {
        transform: translateY(0);
        opacity: 1;
        scale: 1;
    }
}

/* Chatbot Header */
.chatbot-header {
    background: var(--primary-color);
    color: var(--secondary-color);
    padding: 8px 16px;
    text-align: center;
    position: relative;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary-color) !important;
    opacity: 1 !important;
}

.chatbot-header p {
    margin: 4px 0 0;
    font-size: 10px;
    opacity: 0.9;
    color: var(--secondary-color) !important;
}

.chatbot-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary-color) transparent;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--text-secondary-color);
    border-radius: 10px;
    opacity: 0.5;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.3;
    animation: fadeInMessage 0.4s ease-out;
    position: relative;
    word-wrap: break-word;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.user {
    background: var(--primary-color);
    color: var(--secondary-color);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0px 4px 12px rgba(15, 80, 100, 0.15);
}

.message.bot {
    background-color: var(--secondary-color);
    color: var(--text-color);
    align-self: flex-start;
    border: 1px solid rgba(15, 80, 100, 0.1);
    border-bottom-left-radius: 6px;
    box-shadow: 0px 2px 8px rgba(15, 80, 100, 0.08);
}

.message.bot strong {
    color: var(--primary-color);
    font-weight: 600;
}

.message.bot a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.2s ease;
}

.message.bot a:hover {
    border-bottom: 1px solid var(--primary-color);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--secondary-color);
    border-radius: 14px;
    border-bottom-left-radius: 6px;
    max-width: 60px;
    align-self: flex-start;
    border: 1px solid rgba(15, 80, 100, 0.1);
    box-shadow: 0px 2px 8px rgba(15, 80, 100, 0.08);
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick Suggestions */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 12px 6px;
    padding: 6px 0;
}

.suggestion-btn {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

.suggestion-btn:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 80, 100, 0.2);
}

/* Chatbot Input */
.chatbot-input-container {
    padding: 6px 12px;
    background-color: var(--secondary-color);
    border-top: 1px solid rgba(15, 80, 100, 0.1);
    border-radius: 0 0 16px 16px;
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--background-color);
    border: 2px solid transparent;
    border-radius: 25px;
    padding: 4px;
    transition: all 0.3s ease;
    box-shadow: 0px 2px 8px rgba(15, 80, 100, 0.05);
}

.chatbot-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0px 4px 12px rgba(15, 80, 100, 0.15);
}

.chatbot-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 14px;
    background: transparent;
    color: var(--text-color);
    font-size: 13px;
    border-radius: 18px;
    font-family: inherit;
}

.chatbot-input::placeholder {
    color: var(--text-secondary-color);
    opacity: 0.7;
}

.chatbot-send-btn {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    color: var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 4px;
    font-size: 14px;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(15, 80, 100, 0.3);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    color: var(--text-secondary-color);
    font-size: 11px;
    margin-bottom: 12px;
    padding: 10px;
    background-color: var(--secondary-color);
    border-radius: 12px;
    border: 1px solid rgba(15, 80, 100, 0.1);
    box-shadow: 0px 2px 8px rgba(15, 80, 100, 0.05);
    line-height: 1.3;
}

.welcome-message strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .chatbot-toggle i {
        font-size: 22px;
    }
    
    .chatbot-container {
        width: calc(100vw - 32px);
        height: 320px;
        bottom: 80px;
        right: 16px;
        left: 16px;
        top: auto;
        max-height: calc(100vh - 120px);
        min-height: 280px;
        border-radius: 14px;
    }
    
    .chatbot-header {
        padding: 10px 14px;
        border-radius: 12px 12px 0 0;
        flex-shrink: 0;
    }
    
    .chatbot-header h3 {
        font-size: 13px;
    }
    
    .chatbot-header p {
        font-size: 9px;
    }
    
    .chatbot-messages {
        padding: 10px;
        gap: 6px;
        min-height: 160px;
        max-height: 180px;
        overflow-y: auto;
        flex: 1;
    }
    
    .message {
        max-width: 85%;
        padding: 7px 10px;
        font-size: 11px;
        line-height: 1.3;
    }
    
    .chatbot-input-container {
        padding: 8px;
        border-radius: 0 0 12px 12px;
        flex-shrink: 0;
    }
    
    .chatbot-input {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .chatbot-send-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
    
    .suggestion-btn {
        font-size: 9px;
        padding: 3px 8px;
        border-radius: 14px;
    }
    
    .quick-suggestions {
        margin: 0 10px 4px;
        gap: 3px;
        padding: 4px 0;
        flex-shrink: 0;
    }
    
    .welcome-message {
        font-size: 10px;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .welcome-message strong {
        font-size: 11px;
        margin-bottom: 4px;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 24px);
        height: 300px;
        bottom: 70px;
        right: 12px;
        left: 12px;
        top: auto;
        max-height: calc(100vh - 100px);
        min-height: 260px;
        border-radius: 12px;
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 48px;
        height: 48px;
    }
    
    .chatbot-toggle i {
        font-size: 20px;
    }
    
    .message {
        max-width: 88%;
        padding: 6px 10px;
        font-size: 10px;
        border-radius: 12px;
        line-height: 1.2;
    }
    
    .chatbot-header {
        padding: 8px 12px;
        border-radius: 10px 10px 0 0;
        flex-shrink: 0;
    }
    
    .chatbot-header h3 {
        font-size: 12px;
    }
    
    .chatbot-header p {
        font-size: 8px;
    }
    
    .chatbot-messages {
        padding: 8px;
        gap: 5px;
        min-height: 140px;
        max-height: 160px;
        overflow-y: auto;
        flex: 1;
    }
    
    .chatbot-input {
        padding: 7px 10px;
        font-size: 11px;
    }
    
    .chatbot-send-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .chatbot-input-container {
        padding: 6px;
        border-radius: 0 0 10px 10px;
        flex-shrink: 0;
    }
    
    .suggestion-btn {
        font-size: 8px;
        padding: 2px 6px;
        border-radius: 12px;
    }
    
    .quick-suggestions {
        margin: 0 8px 4px;
        gap: 2px;
        padding: 4px 0;
        flex-shrink: 0;
    }
    
    .welcome-message {
        font-size: 9px;
        padding: 6px;
        margin-bottom: 6px;
    }
    
    .welcome-message strong {
        font-size: 10px;
        margin-bottom: 3px;
    }
    
    .typing-indicator {
        padding: 6px 10px;
        max-width: 50px;
    }
    
    .typing-dots span {
        width: 3px;
        height: 3px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .chatbot-container {
        width: calc(100vw - 20px);
        height: 280px;
        bottom: 65px;
        right: 10px;
        left: 10px;
        top: auto;
        max-height: calc(100vh - 90px);
        min-height: 240px;
    }
    
    .chatbot-toggle {
        bottom: 12px;
        right: 12px;
        width: 45px;
        height: 45px;
    }
    
    .chatbot-toggle i {
        font-size: 18px;
    }
    
    .chatbot-header {
        padding: 8px 10px;
    }
    
    .chatbot-header h3 {
        font-size: 11px;
    }
    
    .chatbot-header p {
        font-size: 7px;
    }
    
    .chatbot-messages {
        padding: 6px;
        min-height: 120px;
        max-height: 140px;
    }
    
    .message {
        max-width: 90%;
        padding: 5px 8px;
        font-size: 9px;
    }
    
    .chatbot-input {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .chatbot-send-btn {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }
    
    .chatbot-input-container {
        padding: 6px;
    }
    
    .suggestion-btn {
        font-size: 7px;
        padding: 2px 4px;
    }
    
    .welcome-message {
        font-size: 8px;
        padding: 5px;
    }
    
    .welcome-message strong {
        font-size: 9px;
    }
}

/* Large screens - more conservative sizing */
@media (min-width: 1200px) {
    .chatbot-container {
        width: 320px;
        height: 400px;
        bottom: 100px;
        right: 30px;
    }
    
    .chatbot-toggle {
        bottom: 28px;
        right: 28px;
        width: 60px;
        height: 60px;
    }
    
    .chatbot-toggle i {
        font-size: 25px;
    }
    
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-header h3 {
        font-size: 15px;
    }
    
    .chatbot-header p {
        font-size: 11px;
    }
    
    .chatbot-messages {
        padding: 14px;
        gap: 10px;
    }
    
    .message {
        font-size: 12px;
        padding: 10px 14px;
    }
    
    .chatbot-input {
        padding: 11px 14px;
        font-size: 13px;
    }
    
    .chatbot-send-btn {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
}

/* Dark mode specific adjustments */
.dark .chatbot-container {
    background-color: var(--secondary-background-color);
    box-shadow: 0px 8px 56px rgba(0, 0, 0, 0.3);
}

.dark .chatbot-messages {
    background-color: var(--background-color);
}

.dark .message.bot {
    background-color: var(--secondary-background-color);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.2);
}

.dark .suggestion-btn {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.dark .chatbot-input-wrapper {
    background-color: var(--secondary-background-color);
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);
}

.dark .chatbot-input-wrapper:focus-within {
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);
}

.dark .typing-indicator {
    background-color: var(--secondary-background-color);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.2);
}

.dark .welcome-message {
    background-color: var(--secondary-background-color);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);
}

.dark .chatbot-input-container {
    background-color: var(--secondary-background-color);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Smooth transitions for theme switching */
.chatbot-container,
.chatbot-messages,
.message,
.suggestion-btn,
.chatbot-input-wrapper,
.typing-indicator,
.welcome-message,
.chatbot-input-container {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}
