/**
 * Fhemistry Coach Chatbot Styles
 */

/* Chat Widget Container */
.coach-chat-widget {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Spartan', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 380px;
    margin-left: auto;
}

/* Chat Header */
.coach-chat-header {
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.coach-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    flex-shrink: 0;
}

.coach-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.coach-chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.coach-chat-name {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
}

.coach-chat-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.coach-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Chat Messages Area */
.coach-chat-messages {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

.coach-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.coach-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

/* Chat Messages */
.coach-chat-message {
    display: flex;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

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

.coach-msg-bot {
    align-self: flex-start;
}

.coach-msg-user {
    align-self: flex-end;
}

.coach-msg-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.coach-msg-bot .coach-msg-content {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.coach-msg-user .coach-msg-content {
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.coach-msg-typing .coach-msg-content {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 20px;
}

.coach-typing-dot {
    width: 8px;
    height: 8px;
    background: #e97a9c;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.coach-typing-dot:nth-child(1) { animation-delay: 0s; }
.coach-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.coach-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Input */
.coach-chat-input {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    align-items: center;
}

.coach-chat-input input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.coach-chat-input input:focus {
    border-color: #e97a9c;
    box-shadow: 0 0 0 3px rgba(233, 122, 156, 0.1);
}

.coach-chat-input input::placeholder {
    color: #999;
}

.coach-chat-input button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.coach-chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(233, 122, 156, 0.4);
}

.coach-chat-input button:active {
    transform: scale(0.95);
}

.coach-chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Conversation Limit Reached State */
.coach-limit-reached .coach-chat-input {
    background: #fef2f2;
    border-top-color: #fecaca;
}

.coach-limit-reached .coach-chat-input input {
    background: #fff5f5;
    border-color: #fca5a5;
    color: #991b1b;
}

.coach-limit-reached .coach-chat-input input::placeholder {
    color: #dc2626;
    font-weight: 500;
}

.coach-limit-reached .coach-chat-input button {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Article Reference Marker */
.coach-article-ref {
    color: #e97a9c;
    font-weight: 600;
    cursor: default;
}

/* Article Carousel */
.coach-article-carousel {
    position: relative;
    background: #fff;
    border-top: 1px solid #eee;
}

/* Toggle Button */
.coach-carousel-toggle {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 28px;
    padding: 0 12px;
    border: none;
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(233, 122, 156, 0.4);
    transition: all 0.2s;
    z-index: 10;
}

.coach-carousel-toggle:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(233, 122, 156, 0.5);
}

.coach-toggle-arrow {
    font-size: 10px;
    transition: transform 0.3s;
}

.coach-carousel-open .coach-toggle-arrow {
    transform: rotate(180deg);
}

.coach-toggle-count {
    background: rgba(255,255,255,0.25);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
}

/* Sliding Panel */
.coach-carousel-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

.coach-carousel-open .coach-carousel-panel {
    max-height: 200px;
    padding: 20px 16px 12px;
}

.coach-carousel-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    margin-bottom: 10px;
}

.coach-carousel-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coach-carousel-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coach-carousel-btn:hover {
    background: #e97a9c;
    color: #fff;
}

.coach-carousel-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    flex: 1;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
}

.coach-carousel-track::-webkit-scrollbar {
    display: none;
}

.coach-article-card {
    flex: 0 0 auto;
    max-width: 200px;
    background: linear-gradient(135deg, #fdf2f5 0%, #fff 100%);
    border: 1px solid #f0e0e5;
    border-radius: 8px;
    padding: 10px 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
}

.coach-article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 122, 156, 0.2);
    border-color: #e97a9c;
}

/* New card animation */
.coach-card-new {
    animation: cardPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardPopIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

.coach-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #53242C;
    line-height: 1.4;
    display: block;
}

/* Legacy Sources (hidden) */
.coach-msg-sources {
    display: none;
}

/* ===================================
   Coach Landing Page Styles
   =================================== */

.coach-hero {
    padding: 80px 0 60px;
    background: linear-gradient(180deg, #fff 0%, #fdf2f5 100%);
}

.coach-hero-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 60px;
    align-items: center;
}

.coach-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #e97a9c;
    margin-bottom: 16px;
}

.coach-hero-content h1 {
    font-family: 'Beautiful Bloom', cursive;
    font-size: 12.5rem;
    font-weight: 400;
    color: #53242C;
    line-height: 1.2;
    margin-bottom: 20px;
}

.coach-hero-content h1 em {
    font-style: normal;
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.coach-hero-content > p {
    font-size: 18px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 30px;
}

.coach-features {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.coach-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.coach-feature i {
    color: #e97a9c;
    font-size: 16px;
}

/* Topics Section */
.coach-topics {
    padding: 80px 0;
    background: #fff;
}

.coach-topics-header {
    text-align: center;
    margin-bottom: 50px;
}

.coach-topics-header h2 {
    font-family: 'Beautiful Bloom', cursive;
    font-size: 2.5rem;
    color: #53242C;
}

.coach-topics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.coach-topic-card {
    background: #fdf2f5;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.coach-topic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(233, 122, 156, 0.15);
}

.coach-topic-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.coach-topic-card h3 {
    font-size: 18px;
    color: #53242C;
    margin-bottom: 10px;
}

.coach-topic-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* How It Works Section */
.coach-how-it-works {
    padding: 80px 0;
    background: linear-gradient(180deg, #fdf2f5 0%, #fff 100%);
}

.coach-how-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.coach-how-content h2 {
    font-family: 'Beautiful Bloom', cursive;
    font-size: 2.5rem;
    color: #53242C;
    margin-bottom: 20px;
}

.coach-how-content > p {
    font-size: 16px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 30px;
}

.coach-how-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.coach-how-list li {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.coach-how-num {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.coach-how-list strong {
    display: block;
    color: #53242C;
    margin-bottom: 4px;
}

.coach-how-list p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.coach-testimonial {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    position: relative;
}

.coach-testimonial::before {
    content: '"';
    position: absolute;
    top: 20px;
    left: 30px;
    font-size: 80px;
    color: #e97a9c;
    opacity: 0.2;
    font-family: Georgia, serif;
    line-height: 1;
}

.coach-testimonial p {
    font-size: 18px;
    color: #333;
    line-height: 1.7;
    font-style: italic;
    margin-bottom: 20px;
}

.coach-testimonial span {
    color: #e97a9c;
    font-weight: 600;
}

/* CTA Section */
.coach-cta {
    padding: 80px 0;
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    text-align: center;
}

.coach-cta-content h2 {
    font-family: 'Beautiful Bloom', cursive;
    font-size: 3rem;
    color: #fff;
    margin-bottom: 16px;
}

.coach-cta-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
}

.coach-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #e97a9c;
    padding: 16px 32px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
}

.coach-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    color: #d4687f;
}

/* Responsive Styles */
@media (max-width: 991px) {
    .coach-hero-grid,
    .coach-how-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .coach-hero-content {
        text-align: center;
    }

    .coach-features {
        justify-content: center;
    }

    .coach-topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .coach-hero-content h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 767px) {
    .coach-hero {
        padding: 60px 0 40px;
    }

    .coach-topics-grid {
        grid-template-columns: 1fr;
    }

    .coach-hero-content h1 {
        font-size: 2rem;
    }

    .coach-chat-widget {
        border-radius: 12px;
    }

    .coach-chat-messages {
        height: 350px !important;
    }

    .coach-features {
        flex-direction: column;
        align-items: center;
    }
}

/* Widget in Sidebar */
.widget-fc-coach-widget .coach-chat-widget {
    border-radius: 12px;
}

.widget-fc-coach-widget .coach-chat-header {
    padding: 12px 16px;
}

.widget-fc-coach-widget .coach-chat-avatar {
    width: 36px;
    height: 36px;
}

.widget-fc-coach-widget .coach-chat-name {
    font-size: 14px;
}

.widget-fc-coach-widget .coach-msg-content {
    font-size: 13px;
    padding: 10px 14px;
}

.widget-fc-coach-widget .coach-chat-input {
    padding: 12px 16px;
}

.widget-fc-coach-widget .coach-chat-input input {
    padding: 10px 16px;
    font-size: 13px;
}

.widget-fc-coach-widget .coach-chat-input button {
    width: 38px;
    height: 38px;
}

/* ===================================
   Chat History Panel
   =================================== */

/* Hamburger Menu Button */
.coach-menu-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: auto;
}

.coach-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.coach-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: all 0.3s;
}

/* Hamburger animation when open */
.coach-history-open .coach-menu-btn span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.coach-history-open .coach-menu-btn span:nth-child(2) {
    opacity: 0;
}

.coach-history-open .coach-menu-btn span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* History Panel Overlay */
.coach-history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 50;
}

.coach-history-open .coach-history-overlay {
    opacity: 1;
    visibility: visible;
}

/* History Panel */
.coach-history-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 85%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.coach-history-open .coach-history-panel {
    transform: translateX(0);
}

/* History Header */
.coach-history-header {
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.coach-history-header h4 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.coach-history-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

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

/* New Chat Button */
.coach-new-chat-btn {
    margin: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #e97a9c 0%, #d4687f 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.coach-new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 122, 156, 0.4);
}

/* History List */
.coach-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
}

.coach-history-list::-webkit-scrollbar {
    width: 4px;
}

.coach-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.coach-history-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.coach-history-loading,
.coach-history-empty {
    padding: 30px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Conversation Item */
.coach-conv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.coach-conv-item:hover {
    background: #fdf2f5;
}

.coach-conv-item.coach-conv-active {
    background: linear-gradient(135deg, #fdf2f5 0%, #fce8ed 100%);
    border: 1px solid #e97a9c;
}

.coach-conv-content {
    flex: 1;
    min-width: 0;
}

.coach-conv-preview {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.coach-conv-date {
    font-size: 11px;
    color: #999;
}

/* Delete Button */
.coach-conv-delete {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.coach-conv-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Widget needs relative positioning for panel */
.coach-chat-widget {
    position: relative;
}

/* Responsive adjustments for history panel */
@media (max-width: 480px) {
    .coach-history-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* ===================================
   Expert Knowledge Section
   =================================== */

.coach-expertise {
    padding: 80px 0;
    background: #fff;
}

.coach-expertise-grid {
    max-width: 800px;
    margin: 0 auto;
}

.coach-expertise-content h2 {
    font-family: 'Beautiful Bloom', cursive;
    font-size: 2.5rem;
    color: #53242C;
    margin-bottom: 20px;
}

.coach-expertise-content > p {
    font-size: 18px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 40px;
}

.coach-expertise-highlights {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 30px;
}

.coach-expertise-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: #fdf2f5;
    padding: 24px;
    border-radius: 16px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.coach-expertise-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(233, 122, 156, 0.15);
}

.coach-expertise-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.coach-expertise-item strong {
    display: block;
    font-size: 16px;
    color: #53242C;
    margin-bottom: 6px;
}

.coach-expertise-item p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.coach-articles-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e97a9c;
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
    transition: gap 0.3s;
}

.coach-articles-link:hover {
    gap: 12px;
    color: #d4687f;
}

@media (max-width: 767px) {
    .coach-expertise {
        padding: 60px 0;
    }

    .coach-expertise-content h2 {
        font-size: 2rem;
    }

    .coach-expertise-item {
        padding: 20px;
    }
}
