/* Pan Kafánek Chatbot Widget Styles */
#kafanek-chatbot-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 8px 24px rgba(76, 52, 58, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 4px solid #4C343A;
    animation: floatPulse 3s infinite ease-in-out;
    overflow: hidden;
    padding: 5px;
}

.chat-button:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 15px 40px rgba(76, 52, 58, 0.7);
}

.chat-button img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
}

@keyframes floatPulse {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.05) translateY(-4px); }
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    display: none;
    flex-direction: column;
}

.chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.chat-header {
    background: linear-gradient(135deg, #4C343A 0%, #6e4f57 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 20px 20px 0 0;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

.chat-avatar {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    grid-column: 1;
    grid-row: 1;
    align-self: center;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
    transition: opacity 0.3s ease;
}

.header-buttons-group {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px;
    border-radius: 25px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.chat-header-info {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: center;
    padding: 10px 0 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-header-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    opacity: 0.9;
}

.chat-header-info p {
    font-size: 14px;
    opacity: 0.95;
    margin: 0;
    transition: opacity 0.3s ease;
    line-height: 1.3;
}

.tts-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 18px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
    margin: 0;
}

.tts-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.tts-toggle.active {
    background: rgba(255, 255, 255, 0.4);
}

.settings-button,
.header-icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 18px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
    margin: 0;
}

.settings-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Hamburger Menu Dropdown */
.header-dropdown-menu {
    position: absolute;
    top: 70px;
    right: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.header-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.menu-item:first-child {
    border-radius: 12px 12px 0 0;
}

.menu-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.menu-toggle {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
}

.menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

.chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 28px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
    margin: 0;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fa;
}

.chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

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

.message-user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 15px;
    max-width: 75%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.typing-content::after {
    content: '|';
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.message-user .message-content {
    background: #697077;
    color: white;
}

.typing-indicator {
    padding: 10px 15px;
    background: white;
    border-radius: 15px;
    width: fit-content;
    margin-bottom: 10px;
    display: none;
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

.chat-input-wrapper {
    padding: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
}

/* Quick Actions */
.quick-actions-container {
    display: flex;
    gap: 8px;
    padding: 12px 15px 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.quick-actions-container::-webkit-scrollbar {
    display: none;
}

.quick-action-btn {
    background: #4C343A;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 52, 58, 0.5);
    background: #3d2a2f;
}

.quick-action-btn:active {
    transform: translateY(0);
    background: #2e2024;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 15px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #4C343A;
}

.chat-send {
    background: #4C343A;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    background: #3d2a2f;
    transform: scale(1.1);
}

.chat-mic-button {
    background: transparent;
    color: #4C343A;
    border: 2px solid #4C343A;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-mic-button:hover {
    background: #697077;
    color: white;
    transform: scale(1.1);
}

.chat-mic-button.recording {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999999;
    align-items: center;
    justify-content: center;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.settings-header h2 {
    color: #697077;
    margin: 0;
    font-size: 24px;
}

.settings-close {
    background: #e5e7eb;
    border: none;
    color: #697077;
    font-size: 24px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.settings-close:hover {
    background: #697077;
    color: white;
    transform: rotate(90deg);
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    color: #697077;
    margin-bottom: 12px;
    font-size: 18px;
}

.settings-section label {
    display: block;
    color: #666;
    margin-bottom: 8px;
    font-size: 14px;
}

.settings-section input[type="text"],
.settings-section select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.settings-section input[type="text"]:focus,
.settings-section select:focus {
    border-color: #697077;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 10px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #697077;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.settings-save-button {
    width: 100%;
    padding: 14px;
    background: #697077;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-save-button:hover {
    background: #545a60;
    transform: translateY(-2px);
}

/* Dark Mode */
#kafanek-chatbot-widget.dark-mode .chat-window {
    background: #1a1a1a;
}

#kafanek-chatbot-widget.dark-mode .chat-header {
    background: #2d2d2d;
}

#kafanek-chatbot-widget.dark-mode .chat-messages {
    background: #0f0f0f;
}

#kafanek-chatbot-widget.dark-mode .message-content {
    background: #2d2d2d;
    color: #e5e5e5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

#kafanek-chatbot-widget.dark-mode .message-user .message-content {
    background: #4a5568;
    color: white;
}

#kafanek-chatbot-widget.dark-mode .typing-indicator {
    background: #2d2d2d;
}

#kafanek-chatbot-widget.dark-mode .chat-input-wrapper {
    background: #1a1a1a;
    border-top-color: #2d2d2d;
}

#kafanek-chatbot-widget.dark-mode .chat-input {
    background: #2d2d2d;
    color: #e5e5e5;
    border-color: #4a4a4a;
}

#kafanek-chatbot-widget.dark-mode .chat-input::placeholder {
    color: #999;
}

#kafanek-chatbot-widget.dark-mode .chat-input:focus {
    border-color: #667eea;
}

#kafanek-chatbot-widget.dark-mode .chat-send {
    background: #667eea;
}

#kafanek-chatbot-widget.dark-mode .chat-send:hover {
    background: #5568d3;
}

#kafanek-chatbot-widget.dark-mode .chat-mic-button {
    color: #e5e5e5;
    border-color: #4a4a4a;
}

#kafanek-chatbot-widget.dark-mode .chat-mic-button:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

#kafanek-chatbot-widget.dark-mode .quick-action-btn {
    background: #5d424a;
}

#kafanek-chatbot-widget.dark-mode .quick-action-btn:hover {
    background: #6e4f57;
}

/* Update Notification */
.update-notification {
    position: fixed;
    bottom: 120px;
    right: 30px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.update-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation for Refresh Button */
.header-icon-btn.loading {
    animation: rotate 1s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Ensure icons stay visible */
.header-icon-btn,
.settings-button,
.tts-toggle,
.chat-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-button {
        width: 70px;
        height: 70px;
        bottom: 15px;
        right: 15px;
    }
    
    .chat-window {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        right: 0;
        bottom: 0;
    }
    
    /* Header buttons responsive */
    .header-buttons-group {
        gap: 4px;
    }
    
    .header-icon-btn,
    .settings-button,
    .tts-toggle {
        width: 32px;
        height: 32px;
        font-size: 16px;
        padding: 0;
    }
    
    .chat-close {
        width: 32px;
        height: 32px;
        font-size: 24px;
    }
    
    /* Quick actions scroll on mobile */
    .quick-actions-container {
        padding: 10px 12px 6px;
    }
    
    .quick-action-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}
