/* NepStyle Chatbot Widget - Seller Theme */
:root {
    --chatbot-primary: #7c3aed;
    --chatbot-primary-light: #ede9fe;
    --chatbot-primary-dark: #5b21b6;
    --chatbot-sidebar: #1e293b;
    --chatbot-sidebar-hover: #334155;
    --chatbot-secondary: #f8fafc;
    --chatbot-accent: #f59e0b;
    --chatbot-text-dark: #1e293b;
    --chatbot-text-light: #64748b;
    --chatbot-gradient-primary: linear-gradient(135deg, #1e293b 0%, #334155 50%, #7c3aed 100%);
    --chatbot-gradient-secondary: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    --chatbot-shadow-md: 0 8px 25px rgba(30, 41, 59, 0.15);
    --chatbot-shadow-lg: 0 20px 40px rgba(30, 41, 59, 0.25);
    --chatbot-border-radius: 16px;
    --chatbot-border-radius-lg: 24px;
    --chatbot-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
}

/* Modern Chat Button - Seller Theme */
.chatbot-button {
    width: 64px;
    height: 64px;
    background: var(--chatbot-gradient-primary);
    border-radius: var(--chatbot-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow-lg);
    transition: var(--chatbot-transition);
    position: relative;
    border: none;
    backdrop-filter: blur(10px);
    animation: pulse 3s infinite;
    border: 2px solid rgba(124, 58, 237, 0.3);
}

.chatbot-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 25px 50px rgba(30, 41, 59, 0.35);
    border-color: var(--chatbot-primary);
}

.chatbot-button i {
    color: white;
    font-size: 26px;
    transition: var(--transition);
}

.chatbot-button:hover i {
    transform: scale(1.1);
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

@keyframes pulse {
    0% {
        box-shadow: 0 20px 40px rgba(30, 41, 59, 0.15);
        transform: scale(1);
        border-color: rgba(124, 58, 237, 0.3);
    }
    50% {
        box-shadow: 0 25px 50px rgba(30, 41, 59, 0.25);
        transform: scale(1.02);
        border-color: rgba(124, 58, 237, 0.5);
    }
    100% {
        box-shadow: 0 20px 40px rgba(30, 41, 59, 0.15);
        transform: scale(1);
        border-color: rgba(124, 58, 237, 0.3);
    }
}

/* Modern Chat Window - Seller Theme */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: min(400px, calc(100vw - 48px));
    height: min(600px, calc(100vh - 140px));
    height: min(600px, calc(100dvh - 140px));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--chatbot-border-radius-lg);
    box-shadow: var(--chatbot-shadow-lg);
    border: 1px solid rgba(30, 41, 59, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: var(--chatbot-transition);
    min-width: 320px;
    max-width: calc(100vw - 32px);
    bottom: calc(100px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
}

.chatbot-window-open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Modern Chat Header - Seller Theme */
.chatbot-header {
    background: var(--chatbot-gradient-primary);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.chatbot-avatar i {
    font-size: 18px;
}

.chatbot-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.8;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--chatbot-transition);
    backdrop-filter: blur(10px);
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Messages Area - Seller Theme */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.chatbot-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: var(--chatbot-gradient-primary);
    color: white;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-message .message-avatar {
    background: var(--chatbot-gradient-secondary);
    color: white;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.message-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 14px 18px;
    border-radius: var(--chatbot-border-radius);
    box-shadow: var(--chatbot-shadow-md);
    border: 1px solid rgba(30, 41, 59, 0.1);
    position: relative;
    max-width: 280px;
}

.user-message .message-content {
    background: var(--chatbot-gradient-secondary);
    color: white;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
}

/* Product and Category Buttons - Seller Theme */
.product-btn, .category-btn {
    display: inline-block;
    background: var(--chatbot-gradient-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin: 4px 8px 4px 0;
    transition: var(--chatbot-transition);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.category-btn {
    background: linear-gradient(135deg, var(--chatbot-sidebar) 0%, var(--chatbot-sidebar-hover) 100%);
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.2);
    border: 1px solid rgba(30, 41, 59, 0.3);
}

.product-btn:hover, .category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.category-btn:hover {
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.3);
}

.product-btn:active, .category-btn:active {
    transform: translateY(0);
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

/* Input Area - Seller Theme */
.chatbot-input-area {
    padding: 16px 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid rgba(30, 41, 59, 0.1);
}

.chatbot-suggestions {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    max-height: 80px;
    overflow-y: auto;
}

.suggestion-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #e9ecef;
    border-radius: 18px;
    padding: 8px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: #6c757d;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.suggestion-btn:hover {
    background: var(--gradient-primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.suggestion-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.chatbot-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input-container input {
    flex: 1;
    border: 2px solid rgba(124, 58, 237, 0.1);
    border-radius: var(--border-radius);
    padding: 14px 18px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    font-family: inherit;
    color: var(--text-dark);
    font-weight: 500;
}

.chatbot-input-container input:focus {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    color: var(--text-dark);
    box-shadow: 
        0 0 0 3px rgba(124, 58, 237, 0.15),
        0 4px 20px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.chatbot-input-container input::placeholder {
    color: var(--text-light);
    transition: var(--transition);
}

.chatbot-input-container input:focus::placeholder {
    color: rgba(124, 58, 237, 0.6);
    transform: translateX(2px);
}

.chatbot-input-container input:hover {
    border-color: rgba(124, 58, 237, 0.2);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-0.5px);
}

/* Active state when typing */
.chatbot-input-container input:not(:placeholder-shown) {
    border-color: rgba(124, 58, 237, 0.3);
    background: rgba(255, 255, 255, 0.95);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modern Typing Indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 500;
}

.typing-indicator {
    display: flex;
    gap: 3px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .chatbot-window {
        width: 360px;
        height: 480px;
    }
    
    .chatbot-widget {
        right: calc(15px + env(safe-area-inset-right));
        bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* Mobile Responsive - Clean and Organized */
@media (max-width: 768px) {
    .chatbot-widget {
        right: calc(15px + env(safe-area-inset-right));
        bottom: calc(15px + env(safe-area-inset-bottom));
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100dvh - 120px);
        bottom: calc(75px + env(safe-area-inset-bottom));
        right: calc(15px + env(safe-area-inset-right));
        left: calc(15px + env(safe-area-inset-left));
        border-radius: 12px;
        transform-origin: bottom right;
        margin: 0;
        max-width: calc(100vw - 30px);
    }
    
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-header h4 {
        font-size: 14px;
    }
    
    .chatbot-status {
        font-size: 11px;
    }
    
    .chatbot-messages {
        padding: 15px;
        gap: 12px;
    }
    
    .chatbot-input-area {
        padding: 12px 16px;
    }
    
    .chatbot-suggestions {
        margin-bottom: 8px;
        gap: 4px;
    }
    
    .suggestion-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .chatbot-input-container input {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .chatbot-send-btn {
        width: 36px;
        height: 36px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .chatbot-button {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-button i {
        font-size: 20px;
    }
    
    .chatbot-window {
        height: calc(100dvh - 100px);
        bottom: calc(65px + env(safe-area-inset-bottom));
        border-radius: 8px;
    }
    
    .chatbot-header {
        padding: 10px 12px;
    }
    
    .chatbot-avatar {
        width: 32px;
        height: 32px;
    }
    
    .chatbot-avatar i {
        font-size: 14px;
    }
    
    .chatbot-header h4 {
        font-size: 13px;
    }
    
    .chatbot-status {
        font-size: 10px;
    }
    
    .chatbot-messages {
        padding: 12px;
        gap: 10px;
    }
    
    .chatbot-message {
        max-width: 90%;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .message-content {
        padding: 10px 12px;
        border-radius: 14px;
    }
    
    .message-content p {
        font-size: 13px;
    }
    
    .chatbot-input-area {
        padding: 10px 12px;
    }
    
    .chatbot-suggestions {
        max-height: 60px;
        margin-bottom: 6px;
    }
    
    .suggestion-btn {
        padding: 5px 8px;
        font-size: 9px;
        border-radius: 12px;
    }
    
    .chatbot-input-container input {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 18px;
    }
    
    .chatbot-send-btn {
        width: 32px;
        height: 32px;
    }
    
    .chatbot-send-btn i {
        font-size: 12px;
    }
}

/* Very Small Devices */
@media (max-width: 360px) {
    .chatbot-button {
        width: 45px;
        height: 45px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        right: calc(10px + env(safe-area-inset-right));
        left: calc(10px + env(safe-area-inset-left));
        bottom: calc(60px + env(safe-area-inset-bottom));
        height: calc(100dvh - 80px);
        max-width: calc(100vw - 20px);
    }
    
    .chatbot-header {
        padding: 8px 10px;
    }
    
    .chatbot-messages {
        padding: 10px;
    }
    
    .chatbot-input-area {
        padding: 8px 10px;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chatbot-window {
        height: calc(100dvh - 80px);
        width: min(400px, calc(100vw - 30px));
        max-width: 400px;
        right: calc(15px + env(safe-area-inset-right));
        left: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #2d3748;
    }
    
    .chatbot-messages {
        background: #1a202c;
    }
    
    .message-content {
        background: #4a5568;
        color: white;
    }
    
    .bot-message .message-content {
        background: #2d3748;
        color: white;
    }
    
    .chatbot-input-area {
        background: #2d3748;
        border-top-color: #4a5568;
    }
    
    .chatbot-input-container input {
        background: #4a5568;
        border-color: #4a5568;
        color: white;
    }
    
    .suggestion-btn {
        background: #4a5568;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}
