/* SEO Guruji Chat Plugin - Modern Chat Widget Styles */

/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Chat Icon Button - Bottom Right - Greenish Stylish Design */
.seoguruji-chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.35), 0 2px 8px rgba(37, 211, 102, 0.2);
    z-index: 999998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
}

.seoguruji-chat-icon:hover {
    transform: scale(1.12) translateY(-2px);
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.5), 0 4px 12px rgba(37, 211, 102, 0.3);
    background: #20BA5A;
    border-color: rgba(255, 255, 255, 0.3);
}

.seoguruji-chat-icon:active {
    transform: scale(1.05) translateY(0);
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
}

.seoguruji-chat-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Chat Widget Container */
.seoguruji-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    animation: slideUp 0.3s ease-out;
}

.seoguruji-chat-widget.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header - Redesigned */
.seoguruji-chat-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 10px rgba(37, 211, 102, 0.2);
}

.seoguruji-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.seoguruji-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    flex-shrink: 0;
}

.seoguruji-chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.seoguruji-chat-header-info {
    flex: 1;
}

.seoguruji-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.seoguruji-chat-header-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.seoguruji-chat-header-status-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

/* Header Actions - Dropdown */
.seoguruji-chat-header-actions {
    position: relative;
}

.seoguruji-chat-dropdown-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.seoguruji-chat-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.seoguruji-chat-dropdown-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Dropdown Menu */
.seoguruji-chat-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.seoguruji-chat-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.seoguruji-chat-dropdown-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #303030;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease;
    text-align: left;
    font-family: inherit;
    font-weight: 500;
}

.seoguruji-chat-dropdown-item:hover {
    background: #f5f5f5;
    color: #303030;
}

.seoguruji-chat-dropdown-item:active {
    background: #eeeeee;
}

.seoguruji-chat-dropdown-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    flex-shrink: 0;
}

.seoguruji-chat-dropdown-item span {
    flex: 1;
    font-weight: 500;
}

/* User Info Form */
.seoguruji-chat-user-form {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.seoguruji-chat-user-form h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.seoguruji-chat-user-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.seoguruji-chat-user-form input:focus {
    outline: none;
    border-color: #667eea;
}

.seoguruji-chat-user-form button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.seoguruji-chat-user-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.seoguruji-chat-user-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Chat Messages Area - Fixed Scroll */
.seoguruji-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.seoguruji-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    background: #e5ddd5;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.03) 2px, rgba(0,0,0,.03) 4px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.seoguruji-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.seoguruji-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.seoguruji-chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.seoguruji-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Message Bubbles - Smaller Font */
.seoguruji-chat-message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 7.5px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    font-size: 14.2px;
    animation: messageSlide 0.3s ease-out;
    position: relative;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.seoguruji-chat-message.user {
    align-self: flex-end;
    background: #dcf8c6;
    color: #303030;
    border-bottom-right-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.seoguruji-chat-message.assistant {
    align-self: flex-start;
    background: #ffffff;
    color: #303030;
    border: none;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Message Formatting Styles - Markdown Support */
.seoguruji-chat-message p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.seoguruji-chat-message p:last-child {
    margin-bottom: 0;
}

.seoguruji-chat-message strong,
.seoguruji-chat-message b {
    font-weight: 600;
    color: #303030;
}

.seoguruji-chat-message em,
.seoguruji-chat-message i {
    font-style: italic;
}

.seoguruji-chat-message code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.seoguruji-chat-message pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.seoguruji-chat-message pre code {
    background: none;
    padding: 0;
}

.seoguruji-chat-message blockquote {
    border-left: 3px solid #25D366;
    padding-left: 12px;
    margin: 8px 0;
    color: #666;
    font-style: italic;
}

.seoguruji-chat-message ul,
.seoguruji-chat-message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.seoguruji-chat-message li {
    margin: 4px 0;
    line-height: 1.5;
}

.seoguruji-chat-message a {
    color: #25D366;
    text-decoration: none;
}

.seoguruji-chat-message a:hover {
    text-decoration: underline;
}

.seoguruji-chat-message h1,
.seoguruji-chat-message h2,
.seoguruji-chat-message h3,
.seoguruji-chat-message h4,
.seoguruji-chat-message h5,
.seoguruji-chat-message h6 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.seoguruji-chat-message h1 { font-size: 1.5em; }
.seoguruji-chat-message h2 { font-size: 1.3em; }
.seoguruji-chat-message h3 { font-size: 1.1em; }

/* Featured Post/Video Cards */
.seoguruji-featured-post,
.seoguruji-featured-video {
    margin: 12px 0;
    padding: 12px;
    background: #f0f8ff;
    border-left: 3px solid #25D366;
    border-radius: 6px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.seoguruji-featured-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.seoguruji-featured-content {
    flex: 1;
}

.seoguruji-featured-title {
    font-weight: 600;
    font-size: 14px;
    color: #303030;
    margin-bottom: 6px;
    line-height: 1.4;
}

.seoguruji-featured-link {
    color: #25D366;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
    transition: color 0.2s;
}

.seoguruji-featured-link:hover {
    color: #128C7E;
    text-decoration: underline;
}

/* List Formatting */
.seoguruji-list-container {
    margin: 10px 0;
}

.seoguruji-list-item {
    display: flex;
    gap: 8px;
    margin: 4px 0;
    line-height: 1.5;
}

.seoguruji-list-number,
.seoguruji-list-bullet {
    font-weight: 600;
    color: #25D366;
    flex-shrink: 0;
    min-width: 20px;
}

.seoguruji-list-content {
    flex: 1;
}

/* Typing Indicator */
.seoguruji-chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    align-self: flex-start;
    max-width: 80px;
}

.seoguruji-chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.seoguruji-chat-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.seoguruji-chat-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input Area - Always at Bottom (WhatsApp Style) */
.seoguruji-chat-input-area {
    padding: 8px 12px;
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.seoguruji-chat-input {
    flex: 1;
    padding: 9px 16px;
    border: none;
    border-radius: 21px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
    color: #303030;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
}

.seoguruji-chat-input:focus {
    box-shadow: 0 0 0 1px rgba(37, 211, 102, 0.3);
}

.seoguruji-chat-input::placeholder {
    color: #999;
}

/* WhatsApp Style Send Button - Like Other Plugin */
.seoguruji-chat-send,
.send-button-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin: 0;
}

.seoguruji-chat-send svg,
.send-button-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.seoguruji-chat-send:hover,
.send-button-icon:hover {
    background: linear-gradient(135deg, #20ba5a 0%, #0f7a6e 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.seoguruji-chat-send:active,
.send-button-icon:active {
    transform: scale(0.95);
}

.seoguruji-chat-send:disabled,
.send-button-icon:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #5a5a5a 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .seoguruji-chat-widget {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .seoguruji-chat-header {
        border-radius: 0;
    }
    
    .seoguruji-chat-icon {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
    
    .seoguruji-chat-message {
        font-size: 14px;
        padding: 7px 11px;
    }
    
    .seoguruji-chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Welcome Message */
.seoguruji-chat-welcome {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 400;
}

/* Typing Indicator - Updated */
.seoguruji-chat-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #ffffff;
    border: none;
    border-radius: 7.5px;
    align-self: flex-start;
    max-width: 70px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.seoguruji-chat-typing-dot {
    width: 7px;
    height: 7px;
    background: #999;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}
