/**
 * Chat Widget CSS
 */

.chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    font-family: 'Kanit', sans-serif;
    display: block !important;
    visibility: visible !important;
}

.chat-widget-button {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background-color: var(--primary-color, #007bff) !important;
    color: white !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: all 0.3s ease !important;
    position: relative !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.chat-widget-button:hover {
    background-color: var(--primary-color-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-widget-button-active {
    background-color: var(--primary-color-active);
}

.chat-widget-button i {
    font-size: 24px;
}

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

.chat-widget-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    max-height: calc(100vh - 100px);
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.chat-widget-header {
    flex: 0 0 auto;
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-header-info {
    flex: 1;
}

.chat-widget-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-widget-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chat-widget-close:hover {
    opacity: 0.7;
}

.chat-widget-messages {
    flex: 1 1 auto;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 20px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 15px;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    overscroll-behavior: contain;
    min-height: 0;
    max-height: 100%;
    position: relative;
}

/* Vynutíme scrollování */
.chat-widget-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Zajistíme, že všechny děti mají flex-shrink: 0 */
.chat-widget-messages > * {
    flex-shrink: 0;
}

.chat-widget-loading {
    text-align: center;
    color: #999;
    padding: 20px;
}

.chat-widget-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 12px;
    word-wrap: break-word;
    flex-shrink: 0;
    width: fit-content;
}

.chat-widget-message-visitor {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-widget-message-admin {
    align-self: flex-start;
    background-color: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-widget-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.chat-widget-message-time {
    font-size: 11px;
    margin-left: 10px;
}

.chat-widget-message-text {
    font-size: 14px;
    line-height: 1.4;
}

.chat-widget-input-container {
    flex: 0 0 auto;
    display: flex;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

.chat-widget-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-widget-input:focus {
    border-color: var(--primary-color);
}

.chat-widget-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chat-widget-send:hover {
    background-color: var(--primary-color-hover);
}

.chat-widget-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Responzivní design */
@media (max-width: 768px) {
    .chat-widget-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        max-width: 380px;
        max-height: 500px;
        bottom: 80px;
        right: 0;
    }
    
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-widget-button {
        width: 56px;
        height: 56px;
    }
    
    .chat-widget-button i {
        font-size: 22px;
    }
}

/* Scrollbar styling */
.chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Nedostupný chat */
.chat-widget-button-unavailable {
    cursor: pointer;
}

.chat-widget-button-unavailable:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.chat-widget-unavailable .chat-widget-header {
    background-color: #999;
}

.chat-widget-unavailable-message {
    padding: 20px;
    text-align: center;
    color: #666;
}

.chat-widget-opening-hours {
    margin-top: 15px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    font-size: 14px;
    text-align: left;
    display: inline-block;
}

