#zippy-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.zippy-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 24px;
}

.zippy-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.zippy-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 480px;
    max-width: 700px;
    min-width: 480px;
    height: auto;
    max-height: calc(100vh - 120px);
    min-height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, width 0.3s ease-out, height 0.3s ease-out;
    overflow: hidden;
}

/* Desktop: allow width to expand based on content */
@media (min-width: 481px) {
    .zippy-window {
        width: auto;
        min-width: 480px;
        max-width: min(700px, calc(100vw - 40px));
    }
}

.zippy-window[style*="flex"] {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.zippy-window.zippy-opening {
    animation: zippySlideUp 0.3s ease-out;
    pointer-events: auto;
}

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

.zippy-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.zippy-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
}

.zippy-icon {
    font-size: 20px;
}

.zippy-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.zippy-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zippy-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0; /* Allows flex item to shrink below content size */
}

.zippy-messages:empty {
    padding: 8px 20px;
}

.zippy-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zippy-message-user {
    align-items: flex-end;
}

.zippy-message-bot {
    align-items: flex-start;
}

.zippy-message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.zippy-message-content {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
}

.zippy-message-user .zippy-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.zippy-message-bot .zippy-message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* Markdown styling */
.zippy-message-content p {
    margin: 0.5em 0;
}

.zippy-message-content p:first-child {
    margin-top: 0;
}

.zippy-message-content p:last-child {
    margin-bottom: 0;
}

.zippy-message-content strong {
    font-weight: 600;
    color: #111827;
}

.zippy-message-content em {
    font-style: italic;
}

.zippy-message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.zippy-message-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    transition: border-color 0.2s;
}

.zippy-message-content a:hover {
    border-bottom-color: #667eea;
}

.zippy-message-content ul,
.zippy-message-content ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
    list-style-position: outside;
}

.zippy-message-content ul {
    list-style-type: disc;
}

.zippy-message-content ol {
    list-style-type: decimal;
}

.zippy-message-content li {
    margin: 0.4em 0;
    line-height: 1.6;
    padding-left: 0.25em;
}

.zippy-message-content li.zippy-list-item {
    margin: 0.4em 0;
}

.zippy-message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75em 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.75em 0;
    font-size: 0.9em;
}

.zippy-message-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.zippy-message-content h1,
.zippy-message-content h2,
.zippy-message-content h3 {
    margin: 0.75em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.3;
}

.zippy-message-content h1:first-child,
.zippy-message-content h2:first-child,
.zippy-message-content h3:first-child {
    margin-top: 0;
}

.zippy-message-content h1 {
    font-size: 1.25em;
    color: #111827;
}

.zippy-message-content h2 {
    font-size: 1.15em;
    color: #374151;
}

.zippy-message-content h3 {
    font-size: 1.05em;
    color: #4b5563;
}

.zippy-message-error .zippy-message-content {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
}

.zippy-suggestions {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.zippy-suggestion-btn {
    padding: 16px 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.zippy-suggestion-btn:hover {
    background: #f0f4ff;
    border-color: #764ba2;
    color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.zippy-suggestion-btn.zippy-ask-else {
    background: #f9fafb;
    border: 2px dashed #667eea;
    color: #6b7280;
    font-style: italic;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.1);
}

.zippy-suggestion-btn.zippy-ask-else:hover {
    background: #f0f4ff;
    border-color: #764ba2;
    border-style: solid;
    color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.zippy-input-container {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    background: white;
}

.zippy-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.zippy-input:focus {
    border-color: #667eea;
}

.zippy-send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.zippy-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.zippy-send-btn:active {
    transform: translateY(0);
}

.zippy-message-ad .zippy-message-content {
    background: transparent;
    padding: 0;
    max-width: 100%;
    border-radius: 0;
}

.zippy-message-ad .zippy-message-header {
    margin-bottom: 0;
}

.zippy-adsense-container {
    margin-top: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    width: 100%;
    display: block;
    min-height: 0;
}

.zippy-adsense-container > div {
    max-width: 100%;
    width: 100%;
    display: block;
    min-height: 0;
}

/* Ensure AdSense iframes are visible */
.zippy-adsense-container iframe {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Resize handle styling - invisible but functional */
.zippy-resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    z-index: 1000;
    background: transparent;
    pointer-events: auto;
}

.zippy-resize-tl {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.zippy-resize-tr {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.zippy-resize-bl {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.zippy-resize-br {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

/* Prevent resize on mobile */
@media (max-width: 768px) {
    .zippy-resize-handle {
        display: none;
    }
}

/* Responsive design */
@media (max-width: 480px) {
    #zippy-chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    .zippy-window {
        position: fixed;
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 80px;
        height: auto;
        max-height: calc(100vh - 90px);
        min-width: unset;
        min-height: 60vh;
    }
    
    .zippy-toggle {
        width: 56px;
        height: 56px;
    }
}

/* Safari-specific fixes for viewport issues */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 480px) {
        /* Position window from top on Safari to prevent cutoff */
        .zippy-window {
            position: fixed;
            top: auto;
            bottom: 80px;
            left: 10px;
            right: 10px;
            width: auto;
            height: auto;
            max-height: calc(100vh - 90px);
            max-height: calc(100dvh - 90px); /* Use dynamic viewport height if supported */
            min-height: 60vh;
        }
    }
}

/* Scrollbar styling */
.zippy-messages::-webkit-scrollbar {
    width: 6px;
}

.zippy-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.zippy-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.zippy-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

