/**
 * KhataJi AI Coach - Premium Chat Widget Styles
 * Clean, modern, mobile-first design with martial arts inspired aesthetics.
 * No external dependencies. Fully responsive.
 *
 * @package KhataJi_AI_Coach
 */

:root {
    --khataji-primary: #C41E3A;      /* Energetic red matching martial arts energy */
    --khataji-dark: #1a1a2e;
    --khataji-light: #f8f9fa;
    --khataji-text: #1f2937;
    --khataji-border: #e5e7eb;
    --khataji-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --khataji-radius: 18px;
}

/* Widget Container */
#khataji-chat-widget {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Position variants */
.khataji-position-right {
    right: 24px;
}

.khataji-position-left {
    left: 24px;
}

/* Floating Action Button */
.khataji-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--khataji-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.khataji-chat-button:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

.khataji-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.khataji-chat-button:hover .khataji-button-icon {
    transform: rotate(5deg);
}

/* Clean Professional Tooltip on Hover */
.khataji-chat-button::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.khataji-chat-button:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Chat Window */
.khataji-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: var(--khataji-radius);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    animation: khataji-slide-up 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.khataji-position-left .khataji-chat-window {
    left: 0;
}

.khataji-position-right .khataji-chat-window {
    right: 0;
}

@keyframes khataji-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.khataji-chat-window.khataji-open {
    display: flex;
}

/* Header */
.khataji-chat-header {
    padding: 16px 20px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.khataji-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.khataji-header-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.khataji-header-info h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.khataji-status {
    font-size: 12px;
    opacity: 0.85;
    display: block;
    margin-top: 2px;
}

.khataji-close-button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.khataji-close-button:hover {
    background: rgba(255,255,255,0.35);
}

.khataji-restart-button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-right: 6px;
}

.khataji-restart-button:hover {
    background: rgba(255,255,255,0.35);
}

/* Messages Area */
.khataji-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.khataji-message {
    max-width: 85%;
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    position: relative;
    animation: khataji-message-pop 0.2s ease;
}

@keyframes khataji-message-pop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.khataji-message.user {
    align-self: flex-end;
    background: var(--khataji-primary);
    color: #ffffff;
    border-bottom-right-radius: 6px;
}

.khataji-message.assistant {
    align-self: flex-start;
    background: #ffffff;
    color: var(--khataji-text);
    border: 1px solid var(--khataji-border);
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Typing Indicator */
.khataji-typing {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid var(--khataji-border);
    padding: 14px 18px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
}

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

.khataji-typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: khataji-typing-bounce 1.2s infinite ease-in-out;
}

.khataji-typing-dots span:nth-child(1) { animation-delay: 0s; }
.khataji-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.khataji-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes khataji-typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

/* Quick Replies */
.khataji-quick-replies {
    padding: 12px 16px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8fafc;
    border-top: 1px solid var(--khataji-border);
}

.khataji-quick-reply-btn {
    background: #ffffff;
    border: 1px solid var(--khataji-border);
    color: var(--khataji-text);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.khataji-quick-reply-btn:hover {
    background: var(--khataji-primary);
    color: #ffffff;
    border-color: var(--khataji-primary);
    transform: translateY(-1px);
}

/* Input Area */
.khataji-input-area {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid var(--khataji-border);
    flex-shrink: 0;
}

.khataji-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.khataji-user-input {
    flex: 1;
    border: 1px solid var(--khataji-border);
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.khataji-user-input:focus {
    border-color: var(--khataji-primary);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.khataji-send-button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.khataji-send-button:hover {
    transform: scale(1.05);
}

.khataji-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Connect to Human Button */
.khataji-connect-human {
    margin-top: 12px;
    width: 100%;
    background: #f1f5f9;
    border: 1px solid var(--khataji-border);
    color: #475569;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.khataji-connect-human:hover {
    background: #e0e7ff;
    border-color: #6366f1;
    color: #4338ca;
}

/* Compact Action Row (Space Saving) */
.khataji-action-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.khataji-connect-human.compact,
.khataji-show-quick-questions.compact {
    flex: 1;
    margin-top: 0;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.khataji-connect-human.compact {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.khataji-show-quick-questions.compact {
    background: transparent;
    border: 1px dashed #cbd5e1;
    color: #64748b;
}

.khataji-connect-human.compact:hover {
    background: #e0e7ff;
    border-color: #6366f1;
    color: #4338ca;
}

.khataji-show-quick-questions.compact:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #475569;
}

/* Footer Note */
.khataji-footer-note {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    padding: 8px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--khataji-border);
}

/* Human Contact Modal (Clean & Minimal) */
.khataji-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--khataji-radius);
}

.khataji-modal-content {
    background: white;
    width: 94%;
    max-width: 270px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin: 0 auto;
}

.khataji-modal-header {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.khataji-modal-header h4 {
    margin: 0;
    font-size: 16px;
}

.khataji-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
}

.khataji-modal-body {
    padding: 20px;
}

.khataji-contact-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.khataji-contact-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.khataji-contact-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.khataji-contact-card .contact-info {
    margin-bottom: 10px;
}

.khataji-contact-card .contact-name {
    font-weight: 600;
    color: #1e2937;
    font-size: 15px;
}

.khataji-contact-card .contact-number {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.khataji-contact-card .contact-actions {
    display: flex;
    gap: 8px;
}

.khataji-action-btn {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.khataji-action-btn.whatsapp-btn {
    background: #25D366;
    color: white;
}

.khataji-action-btn.whatsapp-btn:hover {
    background: #128C7E;
}

.khataji-action-btn.call-btn {
    background: #3b82f6;
    color: white;
}

.khataji-action-btn.call-btn:hover {
    background: #2563eb;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .khataji-position-right,
    .khataji-position-left {
        right: 16px;
        left: 16px;
        bottom: 16px;
    }

    .khataji-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 110px);
        bottom: 72px;
        max-height: none;
    }

    .khataji-position-left .khataji-chat-window,
    .khataji-position-right .khataji-chat-window {
        left: 0;
        right: 0;
    }

    .khataji-chat-button {
        width: 54px;
        height: 54px;
    }
}

/* Accessibility & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .khataji-chat-button,
    .khataji-chat-window,
    .khataji-message {
        animation: none;
        transition: none;
    }
}

/* Screen Reader Only */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}