/**
 * COFIS CZ Chatbot - Widget Styles
 *
 * @author COFIS CZ (www.cofis.cz)
 * @copyright 2025 COFIS CZ, s.r.o.
 * @license Proprietary
 */

.cofisczchatbot-widget {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.cofisczchatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

.cofisczchatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Floating bubble */
.cofisczchatbot-bubble {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbot-color, #E41F47);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cofisczchatbot-bottom-left .cofisczchatbot-bubble {
    right: auto;
    left: 0;
}

.cofisczchatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

/* Chat window */
.cofisczchatbot-window {
    position: absolute;
    bottom: 76px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cofisczchatbot-bottom-right .cofisczchatbot-window {
    right: 0;
}

.cofisczchatbot-bottom-left .cofisczchatbot-window {
    left: 0;
}

/* Header */
.cofisczchatbot-header {
    background: var(--chatbot-color, #E41F47);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cofisczchatbot-title {
    font-weight: 600;
    font-size: 16px;
}

.cofisczchatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cofisczchatbot-newchat,
.cofisczchatbot-expand,
.cofisczchatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.8;
}

.cofisczchatbot-newchat:hover,
.cofisczchatbot-expand:hover,
.cofisczchatbot-close:hover {
    opacity: 1;
}

/* Messages area */
.cofisczchatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cofisczchatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cofisczchatbot-msg-bot {
    background: #f1f5f9;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.cofisczchatbot-msg-user {
    background: var(--chatbot-color, #E41F47);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.cofisczchatbot-msg-typing {
    background: #f1f5f9;
    color: #94a3b8;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    font-style: italic;
}

/* Input area */
.cofisczchatbot-input-area {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
    flex-shrink: 0;
}

.cofisczchatbot-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.cofisczchatbot-input:focus {
    border-color: var(--chatbot-color, #E41F47);
}

.cofisczchatbot-send {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--chatbot-color, #E41F47);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.cofisczchatbot-send:hover {
    opacity: 0.9;
}

.cofisczchatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Markdown in bot messages */
.cofisczchatbot-msg-bot p {
    margin: 0 0 4px 0;
}

.cofisczchatbot-msg-bot p:last-child {
    margin-bottom: 0;
}

.cofisczchatbot-msg-bot strong {
    font-weight: 600;
}

.cofisczchatbot-msg-bot ul,
.cofisczchatbot-msg-bot ol {
    margin: 4px 0;
    padding-left: 20px;
}

.cofisczchatbot-msg-bot li {
    margin-bottom: 2px;
}

.cofisczchatbot-msg-bot br {
    display: block;
    content: "";
    margin-top: 4px;
}

/* Product carousel */
.cofisczchatbot-carousel-wrap {
    width: 100%;
    position: relative;
    padding: 0 20px;
    box-sizing: border-box;
}

.cofisczchatbot-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0 8px;
}

.cofisczchatbot-carousel::-webkit-scrollbar {
    display: none;
}

.cofisczchatbot-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 0;
    color: #64748b;
    transition: background 0.2s, color 0.2s;
}

.cofisczchatbot-carousel-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.cofisczchatbot-carousel-btn.left {
    left: -2px;
}

.cofisczchatbot-carousel-btn.right {
    right: -2px;
}

.cofisczchatbot-product-card {
    flex: 0 0 140px;
    scroll-snap-align: start;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.cofisczchatbot-product-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.cofisczchatbot-product-img-wrap {
    width: 100%;
    height: 120px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cofisczchatbot-product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cofisczchatbot-product-info {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cofisczchatbot-product-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 31px;
}

.cofisczchatbot-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--chatbot-color, #E41F47);
    margin-top: 4px;
}

.cofisczchatbot-product-btn {
    display: block;
    text-align: center;
    padding: 7px 10px;
    margin: 6px 10px 10px;
    background: #ff335d !important;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none !important;
    transition: opacity 0.2s;
}

.cofisczchatbot-product-btn:hover {
    opacity: 0.9;
    color: #fff !important;
    text-decoration: none !important;
}

/* CMS page links */
.cofisczchatbot-cms-links {
    padding: 8px 12px;
    margin: 4px 48px 4px 36px;
    font-size: 13px;
    background: #f8fafc;
    border-radius: 8px;
    color: #334155;
}

.cofisczchatbot-cms-label {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
}

.cofisczchatbot-widget .cofisczchatbot-cms-links a.cofisczchatbot-cms-link,
.cofisczchatbot-widget .cofisczchatbot-cms-links a.cofisczchatbot-cms-link:visited,
.cofisczchatbot-widget .cofisczchatbot-cms-links a.cofisczchatbot-cms-link:link {
    display: inline-block;
    color: var(--chatbot-color, #E41F47) !important;
    text-decoration: underline;
    margin-right: 12px;
    font-size: 13px;
}

.cofisczchatbot-widget .cofisczchatbot-cms-links a.cofisczchatbot-cms-link:hover {
    text-decoration: none;
    color: var(--chatbot-color, #E41F47) !important;
}

/* Bot avatar */
.cofisczchatbot-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    flex-shrink: 0;
}

.cofisczchatbot-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.cofisczchatbot-msg-row-bot {
    align-self: flex-start;
    max-width: 90%;
}

.cofisczchatbot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-bottom: 2px;
}

/* Expanded window */
.cofisczchatbot-window.cofisczchatbot-expanded {
    width: 760px;
    height: 80vh;
    max-height: calc(100vh - 100px);
}

/* Mobile fullscreen */
@media (max-width: 480px) {
    .cofisczchatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}
