/* Chatbot Component Styles */

/* Chip Container & Chips */
.chip-container {
    margin-top: 10px;
}

.chip-title {
    margin-bottom: 8px;
    font-weight: 600;
    color: #343a40;
    font-size: 0.95rem;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-item {
    border-width: 1px;
    border-style: solid;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

/* Default Chip Style (Gray) */
.chip-default {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #495057;
}

.chip-default:hover {
    background-color: #e9ecef;
}

/* Highlighted Chip Style (Green/Product Available) */
.chip-highlighted {
    background-color: #d1e7dd;
    border-color: #a3cfbb;
    color: #0f5132;
    font-weight: 600;
}

.chip-highlighted:hover {
    background-color: #badbcc;
}

/* Product Cards */
.product-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.chatbot-product-card {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.chatbot-product-card:hover {
    background-color: #f8f9fa;
    border-color: #ced4da;
}

.product-card-image-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
    border: 1px solid #eee;
}

.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-details {
    margin-left: 12px;
    flex: 1;
    min-width: 0;
}

.product-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.product-card-price {
    font-weight: 700;
    color: #ff6b00;
    font-size: 0.95rem;
}

.product-card-stock {
    font-size: 0.75rem;
}

.stock-in {
    color: #28a745;
}

.stock-out {
    color: #dc3545;
}

.product-card-arrow {
    color: #999;
    margin-left: 8px;
}

/* Quick Replies */
.dynamic-quick-replies {
    margin-top: 10px;
}

/* ========================================
   CHATBOT MOBILE RESPONSIVE
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
    .chatbot-window {
        position: fixed !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw;
        max-height: 100vh;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
        z-index: 99999 !important;
        display: flex;
        flex-direction: column;
    }

    /* Hide floating button when chat is open on mobile */
    .chatbot-window~.chatbot-button,
    #chatbot-container:has(.chatbot-window) .chatbot-button {
        display: none !important;
    }

    .chatbot-button {
        width: 56px;
        height: 56px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;
        z-index: 9990;
    }

    .chatbot-header {
        padding: 15px 18px;
        border-radius: 0;
        flex-shrink: 0;
    }

    .chatbot-messages {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .message-content {
        max-width: calc(100% - 50px);
        padding: 12px 16px;
        font-size: 14px;
    }

    .chatbot-input-area,
    .chatbot-input {
        flex-shrink: 0;
    }

    /* Override any inline styles */
    #chatbot-window {
        width: 100vw !important;
        height: 100vh !important;
    }

    /* Chips on mobile */
    .chip-item {
        padding: 8px 14px;
        font-size: 13px;
    }

    .chip-list {
        gap: 6px;
        flex-wrap: wrap;
    }

    /* Product cards on mobile */
    .chatbot-product-card {
        padding: 12px;
    }

    .product-card-image-wrapper {
        width: 55px;
        height: 55px;
        flex-shrink: 0;
    }

    .product-card-title {
        font-size: 13px;
    }

    .product-card-price {
        font-size: 14px;
    }
}


/* Mobile Phones */
@media (max-width: 576px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        position: fixed;
        display: flex;
        flex-direction: column;
    }

    .chatbot-button {
        width: 54px;
        height: 54px;
        font-size: 22px;
        bottom: 12px;
        right: 12px;
        box-shadow: 0 4px 20px rgba(255, 107, 0, 0.4);
        z-index: 9990;
    }

    .chatbot-header {
        padding: 14px 16px;
        border-radius: 0;
        flex-shrink: 0;
    }

    .chatbot-header-info h3 {
        font-size: 16px;
    }

    .chatbot-header-info span {
        font-size: 12px;
    }

    .chatbot-header-actions button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .chatbot-search-bar {
        padding: 10px 15px;
        flex-shrink: 0;
    }

    .chatbot-search-input {
        padding: 10px 40px 10px 14px;
        font-size: 14px;
    }

    .chatbot-messages {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .message-content {
        max-width: calc(100% - 40px);
        padding: 10px 14px;
        font-size: 14px;
        line-height: 1.5;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .chatbot-input-area {
        padding: 10px 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid #eee;
        flex-shrink: 0;
    }

    .chatbot-input {
        padding: 14px 50px 14px 14px;
        font-size: 16px;
        border-radius: 25px;
    }

    .chatbot-send-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
        right: 5px;
    }

    .input-hint {
        font-size: 11px;
        padding-top: 6px;
    }

    /* Chips mobile */
    .chip-container {
        margin-top: 8px;
    }

    .chip-title {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .chip-item {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 20px;
    }

    .chip-list {
        gap: 5px;
        flex-wrap: wrap;
    }

    /* Product cards mobile */
    .product-cards-container {
        gap: 6px;
    }

    .chatbot-product-card {
        padding: 10px;
    }

    .product-card-image-wrapper {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
    }

    .product-card-details {
        margin-left: 10px;
        min-width: 0;
    }

    .product-card-title {
        font-size: 13px;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-card-price {
        font-size: 14px;
    }

    .product-card-stock {
        font-size: 11px;
    }

    /* Quick actions */
    .quick-actions {
        gap: 6px;
        flex-wrap: wrap;
    }

    .quick-action-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}


/* Very small phones */
@media (max-width: 375px) {
    .chatbot-header-info h3 {
        font-size: 15px;
    }

    .chatbot-messages {
        padding: 10px;
    }

    .message-content {
        padding: 10px 12px;
        font-size: 13px;
    }

    .chip-item {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-window {
        height: 100vh;
    }

    .chatbot-messages {
        height: calc(100vh - 160px);
    }

    .chatbot-header {
        padding: 10px 15px;
    }

    .chatbot-input-area {
        padding: 8px 12px 15px;
    }
}