/* Chatbot stili */
.chatbot-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 10000 !important; /* Palielināts, lai būtu virs visiem elementiem */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-toggle {
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: transform 0.3s ease !important;
    color: white !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.chatbot-window.open {
    display: flex;
}

.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 12px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.6;
}

.message p {
    margin: 0;
    white-space: pre-wrap; /* Saglabājam formatējumu */
}

.bot-message {
    background: #f0f0f0;
    align-self: flex-start;
}

.user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
}

.message.loading {
    opacity: 0.7;
    font-style: italic;
}

/* U29: linku/atrako atbilzu pogas */
.chatbot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    max-width: 90%;
}

.chatbot-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    min-height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

.chatbot-action-btn:hover {
    opacity: 0.9;
}

.chatbot-action-btn:active {
    opacity: 0.8;
}

.chatbot-input-container {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
    align-items: center;
    background: white;
    flex-shrink: 0; /* Prevents input container from shrinking */
    /* Safe area support for mobile */
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    position: relative;
    z-index: 10001;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 0; /* Allows flex item to shrink */
}

.chatbot-input:focus {
    outline: none;
    border-color: #667eea;
}

.chatbot-send {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0; /* Prevents button from shrinking */
    min-width: 60px; /* Minimum width for touch target */
}

.chatbot-send:hover {
    opacity: 0.9;
}

.chatbot-send:active {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        max-height: 600px;
        bottom: 80px;
        right: 10px;
        left: 10px;
        max-width: none;
        position: fixed !important;
    }
    
    .chatbot-container {
        bottom: 10px !important;
        right: 10px !important;
        left: auto;
    }
    
    .chatbot-messages {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        min-height: 0; /* Allows flex item to shrink */
        max-height: calc(100% - 120px); /* Space for header and input */
    }
    
    .chatbot-input-container {
        padding: 10px 12px;
        gap: 6px;
        /* Extra padding on mobile for better touch targets */
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        flex-shrink: 0; /* Prevents input from shrinking */
        position: relative;
        z-index: 10001;
        background: white;
        border-top: 1px solid #e0e0e0;
    }
    
    .chatbot-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-width: 0;
        flex: 1;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chatbot-send {
        padding: 12px 16px;
        font-size: 14px;
        min-width: 70px; /* Larger touch target on mobile */
        flex-shrink: 0;
        white-space: nowrap;
    }

    .chatbot-action-btn {
        min-height: 44px; /* Apple/Google ieteiktais minimalais tap izmers */
        padding: 10px 16px;
        font-size: 15px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 10px);
        height: calc(100vh - 100px);
        max-height: 550px;
        right: 5px;
        left: 5px;
        position: fixed !important;
    }
    
    .chatbot-messages {
        max-height: calc(100% - 110px); /* Space for header and input */
    }
    
    .chatbot-input-container {
        padding: 10px 12px;
        gap: 6px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        flex-shrink: 0;
        position: relative;
        z-index: 10001;
        background: white;
    }
    
    .chatbot-input {
        padding: 12px 14px;
        font-size: 16px;
        min-width: 0;
        flex: 1;
    }
    
    .chatbot-send {
        padding: 12px 14px;
        min-width: 65px;
        flex-shrink: 0;
    }
}

