/**
 * Gemini Chatbot Styles
 * Responsive and customizable design
 */

:root {
    --chatbot-primary-color: #0066cc;
    --chatbot-text-color: #333333;
    --chatbot-bg-light: #f5f5f5;
    --chatbot-bg-white: #ffffff;
    --chatbot-border-radius: 12px;
    --chatbot-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --chatbot-transition: all 0.3s ease;
}

/* Prevent overflow from chatbot elements */
.gemini-chatbot-button,
.gemini-chatbot-widget,
.gemini-chatbot-widget * {
    box-sizing: border-box;
}

/* Ensure body doesn't overflow due to fixed positioning */
body:has(.gemini-chatbot-button),
body:has(.gemini-chatbot-widget) {
    overflow-x: hidden !important;
}

/* Prevent page scrolling on mobile when chatbot is open */
body.gemini-chatbot-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    body.gemini-chatbot-open {
        touch-action: none;
    }
}

/* Chat Button (Minimized State) */
.gemini-chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--chatbot-primary-color);
    border-radius: 50%;
    box-shadow: var(--chatbot-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: var(--chatbot-transition);
    margin: 0;
}

.gemini-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.gemini-chatbot-button:active {
    transform: scale(0.95);
}

.gemini-chatbot-button-icon {
    width: 30px;
    height: 30px;
    color: #ffffff;
}

.gemini-chatbot-button-icon svg {
    width: 100%;
    height: 100%;
}

.gemini-chatbot-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #ffffff;
}

/* Chat Widget */
.gemini-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    box-sizing: border-box;
}

.gemini-chatbot-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--chatbot-bg-white);
    border-radius: var(--chatbot-border-radius);
    box-shadow: var(--chatbot-shadow);
    overflow: hidden;
}

/* Header */
.gemini-chatbot-header {
    background: var(--chatbot-primary-color);
    color: #ffffff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gemini-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gemini-chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gemini-chatbot-avatar svg {
    width: 24px;
    height: 24px;
}

.gemini-chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.gemini-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

.gemini-chatbot-actions {
    display: flex;
    gap: 8px;
}

.gemini-chatbot-minimize,
.gemini-chatbot-close {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 5px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chatbot-transition);
}

.gemini-chatbot-minimize:hover,
.gemini-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gemini-chatbot-minimize:active,
.gemini-chatbot-close:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.gemini-chatbot-minimize svg,
.gemini-chatbot-close svg {
    width: 20px;
    height: 20px;
}

/* Messages Container */
.gemini-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chatbot-bg-light);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.gemini-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.gemini-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Messages */
.gemini-chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease;
}

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

.gemini-chatbot-message-user {
    align-self: flex-end;
}

.gemini-chatbot-message-bot {
    align-self: flex-start;
}

.gemini-chatbot-message-content {
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 14px;
}

.gemini-chatbot-message-user .gemini-chatbot-message-content {
    background: var(--chatbot-primary-color);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.gemini-chatbot-message-bot .gemini-chatbot-message-content {
    background: var(--chatbot-bg-white);
    color: var(--chatbot-text-color);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gemini-chatbot-message-error .gemini-chatbot-message-content {
    background: #ffe6e6;
    color: #cc0000;
    border: 1px solid #ffcccc;
}

.gemini-chatbot-message-content a {
    color: #0066cc;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.gemini-chatbot-message-content a:hover {
    color: #0052a3;
}

.gemini-chatbot-message-content strong {
    font-weight: 600;
    color: inherit;
}

.gemini-chatbot-message-user .gemini-chatbot-message-content a {
    color: #ffffff;
}

.gemini-chatbot-message-user .gemini-chatbot-message-content a:hover {
    color: #e6f2ff;
}

.gemini-chatbot-message-bot .gemini-chatbot-message-content a {
    color: #0066cc;
}

.gemini-chatbot-message-bot .gemini-chatbot-message-content a:hover {
    color: #0052a3;
}

.gemini-chatbot-message-time {
    font-size: 11px;
    color: #999999;
    margin-top: 4px;
    padding: 0 4px;
}

.gemini-chatbot-message-user .gemini-chatbot-message-time {
    text-align: right;
}

.gemini-chatbot-message-bot .gemini-chatbot-message-time {
    text-align: left;
}

/* Typing Indicator */
.gemini-chatbot-typing {
    padding: 0 20px 10px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.gemini-chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chatbot-primary-color);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

.gemini-chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.gemini-chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input Container */
.gemini-chatbot-input-container {
    padding: 15px 20px;
    background: var(--chatbot-bg-white);
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.gemini-chatbot-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.gemini-chatbot-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: var(--chatbot-transition);
    max-height: 150px;
    min-height: 40px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.gemini-chatbot-input:focus {
    border-color: var(--chatbot-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.gemini-chatbot-send {
    background: var(--chatbot-primary-color);
    color: #ffffff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--chatbot-transition);
}

.gemini-chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gemini-chatbot-send:active {
    transform: scale(0.95);
}

.gemini-chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .gemini-chatbot-widget {
        width: 360px;
        height: 550px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gemini-chatbot-widget {
        width: calc(100% - 30px);
        max-width: calc(100% - 30px);
        height: calc(100% - 80px);
        max-height: calc(100% - 80px);
        bottom: 15px;
        right: 15px;
        left: 15px;
        border-radius: 16px;
        margin: 0 auto;
    }
    
    .gemini-chatbot-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
    
    .gemini-chatbot-button-icon {
        width: 28px;
        height: 28px;
    }
    
    .gemini-chatbot-message {
        max-width: 85%;
    }
    
    .gemini-chatbot-message-content {
        font-size: 15px;
        padding: 12px 16px;
    }
    
    .gemini-chatbot-avatar {
        width: 36px;
        height: 36px;
    }
    
    .gemini-chatbot-avatar svg {
        width: 20px;
        height: 20px;
    }
}

/* Small Mobile Responsive */
@media (max-width: 480px) {
    .gemini-chatbot-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
    }
    
    .gemini-chatbot-container {
        border-radius: 0;
    }
    
    .gemini-chatbot-header {
        padding: 12px 16px;
    }
    
    .gemini-chatbot-header-content {
        gap: 10px;
    }
    
    .gemini-chatbot-avatar {
        width: 32px;
        height: 32px;
    }
    
    .gemini-chatbot-avatar svg {
        width: 18px;
        height: 18px;
    }
    
    .gemini-chatbot-title h3 {
        font-size: 15px;
    }
    
    .gemini-chatbot-status {
        font-size: 11px;
    }
    
    .gemini-chatbot-actions {
        gap: 4px;
    }
    
    .gemini-chatbot-minimize,
    .gemini-chatbot-close {
        width: 28px;
        height: 28px;
    }
    
    .gemini-chatbot-minimize svg,
    .gemini-chatbot-close svg {
        width: 18px;
        height: 18px;
    }
    
    .gemini-chatbot-messages {
        padding: 12px;
        gap: 10px;
    }
    
    .gemini-chatbot-message {
        max-width: 90%;
    }
    
    .gemini-chatbot-message-content {
        font-size: 14px;
        padding: 10px 14px;
        border-radius: 14px;
    }
    
    .gemini-chatbot-input-container {
        padding: 10px 12px;
    }
    
    .gemini-chatbot-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 14px;
        border-radius: 18px;
    }
    
    .gemini-chatbot-send {
        width: 38px;
        height: 38px;
    }
    
    .gemini-chatbot-send svg {
        width: 18px;
        height: 18px;
    }
    
    .gemini-chatbot-button {
        bottom: 12px;
        right: 12px;
        width: 52px;
        height: 52px;
    }
    
    .gemini-chatbot-button-icon {
        width: 26px;
        height: 26px;
    }
    
    .gemini-chatbot-unread-badge {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
}

/* Extra Small Devices */
@media (max-width: 360px) {
    .gemini-chatbot-header {
        padding: 10px 12px;
    }
    
    .gemini-chatbot-title h3 {
        font-size: 14px;
    }
    
    .gemini-chatbot-messages {
        padding: 10px;
    }
    
    .gemini-chatbot-message-content {
        font-size: 13px;
        padding: 9px 12px;
    }
    
    .gemini-chatbot-input-container {
        padding: 8px 10px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .gemini-chatbot-widget {
        width: calc(100% - 20px);
        height: calc(100% - 20px);
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .gemini-chatbot-messages {
        padding: 12px 16px;
    }
    
    .gemini-chatbot-input-container {
        padding: 8px 16px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .gemini-chatbot-button:hover {
        transform: none;
    }
    
    .gemini-chatbot-minimize:hover,
    .gemini-chatbot-close:hover {
        background: none;
    }
    
    .gemini-chatbot-send:hover {
        transform: none;
    }
    
    /* Better touch targets */
    .gemini-chatbot-minimize,
    .gemini-chatbot-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .gemini-chatbot-send {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Prevent text size adjustment on orientation change */
@media screen and (orientation: portrait) {
    html {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

@media screen and (orientation: landscape) {
    html {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --chatbot-text-color: #e0e0e0;
        --chatbot-bg-light: #1e1e1e;
        --chatbot-bg-white: #2d2d2d;
    }
    
    .gemini-chatbot-message-bot .gemini-chatbot-message-content {
        background: #3d3d3d;
        color: #e0e0e0;
    }
    
    .gemini-chatbot-input {
        background: #3d3d3d;
        color: #e0e0e0;
        border-color: #4d4d4d;
    }
}
