/**
 * Pro Coaching Chatbot - Production-Grade Styles
 * Professional, mobile-first, conversion-focused UI
 */

/* Chat Container */
#pro-coaching-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-sizing: border-box;
}

/* Fix for all zoom levels - ensure chatbot is always visible */
@media screen {
    .pro-coaching-chatbot-box {
        max-width: min(350px, calc(100vw - 20px)) !important;
        max-height: 80vh !important;
    }
}

/* Chat Icon */
.pro-coaching-chatbot-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
}

.pro-coaching-chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.pro-coaching-chatbot-icon-hidden {
    display: none;
}

/* Chat Box */
.pro-coaching-chatbot-box {
    width: 350px;
    max-width: calc(100vw - 20px);
    
    height: auto;
    max-height: 80vh;
    
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    
    position: fixed;
    bottom: 90px;
    right: 20px;
    
    z-index: 10000;
    box-sizing: border-box;
}

.pro-coaching-chatbot-box-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.pro-coaching-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    
    padding: 16px;
    display: flex;
    align-items: center;      /* 🔥 FIX */
    justify-content: space-between;
    
    flex-shrink: 0;
    position: relative;
    z-index: 10001;
    box-sizing: border-box;
    width: 100%;
    min-height: 70px;
}

.pro-coaching-chatbot-header-content h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.pro-coaching-chatbot-header-content p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Ensure header content and close button are properly aligned */
.pro-coaching-chatbot-header-content {
    flex: 1;
    min-width: 0;
}

.pro-coaching-chatbot-header .pro-coaching-chatbot-close {
    margin-left: 15px;
    margin-top: -2px;
}

/* Close button in footer (desktop) */
.pro-coaching-chatbot-footer .pro-coaching-chatbot-close {
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    box-sizing: border-box;
    min-width: auto;
    min-height: auto;
    width: auto;
    height: auto;
}

/* Close button in header (mobile - hidden on desktop) */
.pro-coaching-chatbot-header .pro-coaching-chatbot-close {
    display: none;
}

/* Footer close button hover */
.pro-coaching-chatbot-footer .pro-coaching-chatbot-close:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.pro-coaching-chatbot-footer .pro-coaching-chatbot-close:active {
    transform: translateY(0);
}

/* Force SVG visibility (VERY IMPORTANT) */
.pro-coaching-chatbot-close svg {
    width: 14px;
    height: 14px;
    
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}

/* Messages Area */
.pro-coaching-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.pro-coaching-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.pro-coaching-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.pro-coaching-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.pro-coaching-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Message Bubbles */
.pro-coaching-chatbot-message {
    display: flex;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pro-coaching-chatbot-message-bot {
    justify-content: flex-start;
}

.pro-coaching-chatbot-message-user {
    justify-content: flex-end;
}

.pro-coaching-chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.pro-coaching-chatbot-message-bot .pro-coaching-chatbot-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pro-coaching-chatbot-message-user .pro-coaching-chatbot-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.pro-coaching-chatbot-message-content strong {
    font-weight: 600;
    color: #667eea;
}

.pro-coaching-chatbot-message-user .pro-coaching-chatbot-message-content strong {
    color: white;
}

/* Typing Indicator */
.pro-coaching-chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pro-coaching-chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

.pro-coaching-chatbot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.pro-coaching-chatbot-typing-indicator 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;
    }
}

/* Input Area */
.pro-coaching-chatbot-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pro-coaching-chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.pro-coaching-chatbot-input:focus {
    border-color: #667eea;
}

.pro-coaching-chatbot-send {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.pro-coaching-chatbot-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.pro-coaching-chatbot-send:active {
    transform: translateY(0);
}

/* Buttons Area */
.pro-coaching-chatbot-buttons {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
}

/* Single button - full width */
.pro-coaching-chatbot-buttons .pro-coaching-chatbot-btn:only-child {
    grid-column: 1 / -1;
}

/* Better button text display - ensure text is fully visible */
.pro-coaching-chatbot-btn {
    word-break: break-word;
    hyphens: auto;
    overflow-wrap: break-word;
    text-overflow: ellipsis;
}

.pro-coaching-chatbot-buttons::-webkit-scrollbar {
    width: 4px;
}

.pro-coaching-chatbot-buttons::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.pro-coaching-chatbot-btn {
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    font-family: inherit;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
    overflow: visible;
    hyphens: auto;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.pro-coaching-chatbot-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.pro-coaching-chatbot-btn:active {
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #pro-coaching-chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .pro-coaching-chatbot-icon {
        width: 56px;
        height: 56px;
    }
    
    .pro-coaching-chatbot-box {
        width: calc(100vw - 20px);
        max-height: 85vh;
        
        bottom: 80px;
        right: 10px;
        left: 10px;
        
        border-radius: 16px;
    }
    
    .pro-coaching-chatbot-buttons {
        grid-template-columns: 1fr;
        max-height: 150px;
    }
    
    .pro-coaching-chatbot-btn {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    /* On mobile, close button stays in footer */
    .pro-coaching-chatbot-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .pro-coaching-chatbot-main-menu-btn,
    .pro-coaching-chatbot-footer .pro-coaching-chatbot-close {
        width: 100%;
    }
    
    .pro-coaching-chatbot-message-content {
        max-width: 85%;
    }
    
    .pro-coaching-chatbot-input-area {
        padding: 10px 12px;
    }
}

/* Footer with Main Menu Button */
.pro-coaching-chatbot-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.pro-coaching-chatbot-main-menu-btn {
    flex: 1;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pro-coaching-chatbot-main-menu-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.pro-coaching-chatbot-main-menu-btn:active {
    transform: translateY(0);
}

/* Accessibility */
.pro-coaching-chatbot-btn:focus,
.pro-coaching-chatbot-close:focus,
.pro-coaching-chatbot-icon:focus,
.pro-coaching-chatbot-input:focus,
.pro-coaching-chatbot-send:focus,
.pro-coaching-chatbot-main-menu-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading State */
.pro-coaching-chatbot-message-loading {
    opacity: 0.7;
}
