/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* EPocket Shop Exact Color Palette - From the actual website */
    --epocket-green-deep: #0d5016;
    --epocket-green-main: #1b6b20;
    --epocket-green-mid: #2d7d32;
    --epocket-green-light: #388e3c;
    --epocket-orange-deep: #cc6600;
    --epocket-orange-main: #e67300;
    --epocket-orange-mid: #ff8000;
    --epocket-orange-light: #ff9933;
    --epocket-gold: #ffaa00;
    --epocket-yellow: #ffbb33;
    
    /* Exact EPocket Shop gradient matching the website hero section */
    --gradient-primary: linear-gradient(135deg, #0d5016 0%, #1b6b20 8%, #2d7d32 16%, #388e3c 24%, #4caf50 32%, #66bb6a 40%, #7cc142 48%, #92c746 56%, #a8cd4a 64%, #bed34e 72%, #d4d952 80%, #eadf56 88%, #cc6600 92%, #e67300 94%, #ff8000 96%, #ff9933 98%, #ffaa00 100%);
    
    --gradient-secondary: linear-gradient(135deg, #1b6b20 0%, #2d7d32 20%, #388e3c 35%, #4caf50 50%, #66bb6a 65%, #7cc142 75%, #a8cd4a 85%, #d4d952 92%, #e67300 96%, #ff8000 100%);
    
    --gradient-warm: linear-gradient(135deg, #7cc142 0%, #92c746 15%, #a8cd4a 30%, #bed34e 45%, #d4d952 60%, #eadf56 75%, #cc6600 85%, #e67300 92%, #ff8000 96%, #ff9933 100%);
    
    --gradient-cool: linear-gradient(135deg, #0d5016 0%, #1b6b20 25%, #2d7d32 50%, #388e3c 75%, #4caf50 100%);
    
    --gradient-subtle: linear-gradient(135deg, #f1f8e9 0%, #fff8e1 20%, #fff3e0 40%, #ffe0b2 60%, #ffcc02 80%, #ffaa00 100%);
    
    /* Text colors */
    --text-primary: #0d5016;
    --text-secondary: #1b6b20;
    --text-light: #2d7d32;
    --text-white: #ffffff;
    --text-dark: #0a3d0f;
    --text-muted: #66bb6a;
    --text-orange: #cc6600;
    
    /* Background colors */
    --background-main: var(--gradient-primary);
    --background-card: #ffffff;
    --background-light: #f8fdf8;
    --background-dark: #0d5016;
    --background-overlay: rgba(13, 80, 22, 0.05);
    
    /* Border and neutral colors */
    --border-color: #c8e6c9;
    --border-light: #e8f5e8;
    --border-dark: #a5d6a7;
    --border-focus: #4caf50;
    
    /* Status colors matching EPocket theme */
    --success-color: #4caf50;
    --success-light: #e8f5e8;
    --success-border: #c8e6c9;
    --info-color: #2196f3;
    --info-light: #e3f2fd;
    --info-border: #bbdefb;
    --warning-color: #ff8000;
    --warning-light: #fff3e0;
    --error-color: #f44336;
    --error-light: #ffebee;
    
    /* Message colors */
    --message-user-bg: var(--gradient-primary);
    --message-bot-bg: var(--success-light);
    --message-bot-border: var(--success-border);
    --message-welcome-bg: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 10%, #fff8e1 20%, #fff3e0 35%, #ffe0b2 50%, #ffcc02 70%, #ffaa00 85%, #ff9933 100%);
    --message-welcome-border: var(--epocket-orange-light);
    
    /* Shadows with green-orange tint */
    --shadow-sm: 0 1px 2px 0 rgba(13, 80, 22, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(13, 80, 22, 0.12), 0 2px 4px -2px rgba(230, 115, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(13, 80, 22, 0.12), 0 4px 6px -4px rgba(230, 115, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(13, 80, 22, 0.15), 0 8px 10px -6px rgba(230, 115, 0, 0.08);
    --shadow-inner: inset 0 2px 4px 0 rgba(13, 80, 22, 0.06);
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Inter', sans-serif;
    background: var(--gradient-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    position: relative;
}

/* Add subtle pattern overlay like EPocket Shop */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M60 60m-25 0a25 25 0 1 1 50 0a25 25 0 1 1 -50 0'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Add curved bottom element exactly like EPocket Shop */
body::after {
    content: '';
    position: fixed;
    bottom: -200px;
    left: -150px;
    width: 500px;
    height: 400px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    transform: rotate(-20deg);
}

.chat-container {
    background: var(--background-card);
    border-radius: var(--radius-2xl);
    box-shadow: 
        var(--shadow-xl),
        0 0 0 1px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    width: 100%;
    max-width: 480px;
    height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    backdrop-filter: blur(20px);
    z-index: 1;
}

/* Header Section - Exact EPocket Shop gradient */
.chat-header {
    background: var(--gradient-primary);
    color: var(--text-white);
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='50' cy='50' r='8'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 20%, rgba(255,255,255,0.5) 50%, rgba(255,255,255,0.3) 80%, transparent 100%);
}

.chat-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.chat-subtitle {
    font-size: 0.9375rem;
    opacity: 0.95;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

/* Chat Window */
.chat-window {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(248,253,248,0.95) 100%);
    scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar {
    width: 5px;
}

.chat-window::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 3px;
}

.chat-window::-webkit-scrollbar-thumb {
    background: var(--gradient-cool);
    border-radius: 3px;
    transition: background var(--transition-normal);
}

.chat-window::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-warm);
}

/* Chat Messages */
.chat-message {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    animation: messageSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message-content {
    max-width: 75%;
    padding: 1.125rem 1.375rem;
    border-radius: var(--radius-xl);
    font-size: 0.9375rem;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    font-weight: 500;
    backdrop-filter: blur(5px);
}

/* Bot Messages */
.bot-message {
    justify-content: flex-start;
}

.bot-message .message-content {
    background: var(--message-bot-bg);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-md);
    border: 2px solid var(--message-bot-border);
    box-shadow: 
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.bot-message .message-content::before {
    content: '';
    position: absolute;
    left: -9px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 9px 9px 0;
    border-color: transparent var(--message-bot-border) transparent transparent;
}

.bot-message .message-content::after {
    content: '';
    position: absolute;
    left: -7px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7px 7px 0;
    border-color: transparent var(--message-bot-bg) transparent transparent;
}

/* User Messages - EPocket Shop gradient */
.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: var(--gradient-primary);
    color: var(--text-white);
    border-bottom-right-radius: var(--radius-md);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 
        var(--shadow-md),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.user-message .message-content::before {
    content: '';
    position: absolute;
    right: -9px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 9px 9px;
    border-color: transparent transparent var(--epocket-orange-main) transparent;
}

/* Input Container */
.input-container {
    padding: 1.75rem;
    background: var(--background-card);
    border-top: 2px solid var(--border-light);
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    box-shadow: 0 -6px 16px rgba(13, 80, 22, 0.08);
}

/* Input Field */
#user-input {
    flex: 1;
    padding: 1.125rem 1.375rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--background-card);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    resize: none;
    min-height: 52px;
    max-height: 130px;
    line-height: 1.5;
    font-weight: 500;
}

#user-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.12);
    background: var(--background-light);
}

#user-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Send Button - EPocket Shop gradient */
#send-button {
    padding: 1.125rem 1.75rem;
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-xl);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 52px;
    box-shadow: var(--shadow-lg);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#send-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

#send-button:hover {
    background: var(--gradient-secondary);
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

#send-button:hover::before {
    left: 100%;
}

#send-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-lg);
}

#send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: var(--text-light);
}

#send-button:disabled::before {
    display: none;
}

/* Welcome Messages - EPocket Shop inspired */
.welcome-message {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 1.75rem;
    background: var(--message-welcome-bg);
    border: 2px solid var(--message-welcome-border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    position: relative;
}

.welcome-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 1.125rem 1.375rem;
    background: var(--message-bot-bg);
    border: 2px solid var(--message-bot-border);
    border-radius: var(--radius-xl);
    border-bottom-left-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    max-width: 75%;
    box-shadow: var(--shadow-md);
    position: relative;
}

.typing-indicator::before {
    content: '';
    position: absolute;
    left: -9px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 9px 9px 0;
    border-color: transparent var(--message-bot-border) transparent transparent;
}

.typing-indicator::after {
    content: '';
    position: absolute;
    left: -7px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7px 7px 0;
    border-color: transparent var(--message-bot-bg) transparent transparent;
}

.typing-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: var(--gradient-primary);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    body {
        padding: 0.5rem;
    }
    
    .chat-container {
        height: calc(100vh - 1rem);
        max-width: none;
        border-radius: var(--radius-xl);
    }
    
    .chat-header {
        padding: 1.75rem 1.25rem;
    }
    
    .chat-window {
        padding: 1.25rem;
    }
    
    .input-container {
        padding: 1.5rem;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 0.875rem;
        padding: 1rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .chat-title {
        font-size: 1.25rem;
    }
    
    .chat-subtitle {
        font-size: 0.875rem;
    }
    
    .message-content {
        padding: 0.875rem 1.125rem;
        font-size: 0.875rem;
    }
    
    #user-input, #send-button {
        font-size: 0.875rem;
    }
    
    #user-input {
        padding: 1rem 1.25rem;
    }
    
    #send-button {
        padding: 1rem 1.5rem;
        min-width: 85px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Better Accessibility */
#send-button:focus-visible {
    outline: 3px solid var(--border-focus);
    outline-offset: 3px;
}

#user-input:focus-visible {
    outline: 3px solid var(--border-focus);
    outline-offset: -3px;
}

/* Enhanced visual elements matching EPocket Shop */
.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    z-index: 1;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

/* Subtle hover effects for messages */
.message-content:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Loading state for send button */
.send-button-loading {
    position: relative;
}

.send-button-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* EPocket Shop inspired notification styles */
.notification {
    border-left: 5px solid var(--epocket-green-main);
    backdrop-filter: blur(10px);
}

.notification-success {
    background: var(--gradient-cool) !important;
}

.notification-warning {
    background: var(--gradient-warm) !important;
}

.notification-error {
    background: linear-gradient(135deg, #f44336 0%, #e57373 100%) !important;
}

.notification-info {
    background: var(--gradient-secondary) !important;
}

/* Additional EPocket Shop styling touches */
.chat-header {
    background-attachment: fixed;
}

/* Enhanced message styling */
.user-message .message-content {
    background-attachment: fixed;
}

.typing-dot {
    background: var(--gradient-warm);
}

/* Professional polish with curved elements inspired by EPocket Shop */
.chat-container::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 10%;
    width: 80%;
    height: 50px;
    background: var(--gradient-subtle);
    border-radius: 50%;
    opacity: 0.15;
    z-index: -1;
    filter: blur(20px);
    transform: rotate(-3deg);
}

/* Additional curved element for depth matching EPocket Shop */
body::before {
    content: '';
    position: fixed;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 200px;
    background: rgba(255, 170, 0, 0.03);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    transform: rotate(25deg);
}