/* ——— Chat Bubble (floating button) ——— */
.aipress-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 999999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aipress-bubble:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.aipress-bubble img {
    height: 60px;
    background-color: transparent;
}

.aipress-powered {
    padding: 8px 16px;
    text-align: center;
    font-size: 11px;
    color: #a0aec0;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
}

.aipress-powered a {
    color: #667eea;
    text-decoration: none;
}

.aipress-powered a:hover {
    text-decoration: underline;
}

/* ——— Chat Panel ——— */
.aipress-panel {
    position: fixed;
    bottom: 110px;
    right: 25px;
    width: 350px;
    height: 500px;
    background: #ffffff;
    /* border: 1px solid #e1e5e9; */
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 999999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    overflow: hidden;
}

/* ——— Header ——— */
.aipress-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #CC5500 0%, #4682B4 100%);
    color: #fff;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    height: 60px;
    position: relative;
}

.aipress-header img {
    height: 40px;
    margin-right: 12px;
    border-radius: 6px;
}

.aipress-header .aipress-title {
    font-weight: 600;
    font-size: 16px;
    flex: 1;
}

.aipress-close {
    position: absolute;
    top: 12px;
    right: 16px;
    cursor: pointer;
    font-size: 24px;
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aipress-clear-btn {
    margin-right: 40px;
    background:white;
    border-radius:50%;
    padding:5px 8px;
    border:none;
}

.aipress-close:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* ——— Proactive Messages ——— */
.aipress-proactive-message {
    position: fixed;
    bottom: 95px;
    right: 25px;
    max-width: 280px;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 999998;
    cursor: pointer;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.aipress-proactive-message.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.aipress-proactive-message.hide {
    transform: translateY(10px) scale(0.95);
    opacity: 0;
}

.aipress-proactive-content {
    padding: 16px 40px 16px 16px;
    font-size: 14px;
    line-height: 1.4;
    color: #2d3748;
    position: relative;
}

.aipress-proactive-content::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
}

.aipress-proactive-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #a0aec0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aipress-proactive-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

.aipress-proactive-message:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

/* Pulse animation for extra attention */
.aipress-proactive-message::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0.3;
    z-index: -1;
    animation: proactivePulse 2s ease-in-out infinite;
}

@keyframes proactivePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.1;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .aipress-proactive-message {
        bottom: 85px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
    
    .aipress-proactive-content::before {
        right: 30px;
    }
}

@media (max-width: 480px) {
    .aipress-proactive-message {
        bottom: 80px;
        right: 15px;
        left: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .aipress-proactive-message {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .aipress-proactive-content {
        color: #e2e8f0;
    }
    
    .aipress-proactive-content::before {
        border-top-color: #2d3748;
    }
    
    .aipress-proactive-close:hover {
        background: #4a5568;
        color: #e2e8f0;
    }
}

/* ——— Chat Log ——— */
.aipress-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 14px;
    line-height: 1.5;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.aipress-log::-webkit-scrollbar {
    width: 4px;
}

.aipress-log::-webkit-scrollbar-track {
    background: transparent;
}

.aipress-log::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.aipress-log::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ——— Message Bubbles ——— */
.aipress-message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

.aipress-message.user {
    flex-direction: row-reverse;
}

.aipress-message.user .aipress-bubble-msg {
    background: linear-gradient(135deg, #CC5500 0%, #4682B4 100%);
    color: white;
    margin-left: 40px;
    margin-right: 0;
}

.aipress-message.bot .aipress-bubble-msg {
    background: #ffffff;
    color: #2d3748;
    margin-right: 40px;
    margin-left: 0;
    border: 1px solid #e2e8f0;
}

.aipress-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 4px;
}

.aipress-message.user .aipress-avatar {
    background: #e2e8f0;
    margin-left: 8px;
}

.aipress-message.bot .aipress-avatar {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    margin-right: 8px;
}

.aipress-message.bot .aipress-avatar img {
    height: 25px;
    border-radius: 4px;
}

.aipress-bubble-msg {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    position: relative;
}

.aipress-message.user .aipress-bubble-msg {
    border-bottom-right-radius: 4px;
}

.aipress-message.bot .aipress-bubble-msg {
    border-bottom-left-radius: 4px;
}

/* ——— Input Container ——— */
.aipress-input-container {
    display: flex;
    align-items: flex-end;
    padding: 16px;
    background: #ffffff;
    /* border-top: 1px solid #e2e8f0; */
    gap: 12px;
}

.aipress-input {
    flex: 1;
    resize: none;
    min-height: 20px;
    max-height: 80px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background-color: #f7fafc;
    padding: 10px 16px;
    font-size: 14px;
    line-height: 20px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.aipress-input:focus {
    border-color: #4682B4;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.aipress-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.aipress-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #CC5500, #4682B4);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.aipress-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.aipress-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ——— Typing Animation ——— */
@keyframes aipress-blink {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

.aipress-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    align-items: center;
}

.aipress-typing span {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    border-radius: 50%;
    animation: aipress-blink 1.5s infinite ease-in-out;
}

.aipress-typing span:nth-child(1) {
    animation-delay: 0s;
}

.aipress-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.aipress-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-indicator .aipress-bubble-msg {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

/* ——— Message Animation ——— */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ——— Mobile Responsive ——— */
@media (max-width: 768px) {
    .aipress-panel {
        bottom: 90px;
        right: 20px;
        left: 20px;
        width: auto;
        height: 60vh;
        max-height: 500px;
    }
    
    .aipress-bubble-msg {
        max-width: 85%;
    }
    
    .aipress-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .aipress-bubble {
        bottom: 15px;
        right: 15px;
    }
    
    .aipress-panel {
        bottom: 85px;
        right: 15px;
        left: 15px;
        height: 65vh;
        max-height: 450px;
    }
    
    .aipress-header {
        padding: 12px 16px;
        height: 50px;
    }
    
    .aipress-log {
        padding: 12px;
    }
    
    .aipress-input-container {
        padding: 12px;
    }
}

/* ——— Dark Mode Support ——— */
@media (prefers-color-scheme: dark) {
    .aipress-panel {
        background: #1a202c;
        border-color: #2d3748;
    }
    
    .aipress-log {
        background: #2d3748;
    }
    
    .aipress-message.bot .aipress-bubble-msg {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .aipress-message.bot .aipress-avatar {
        background: #4a5568;
        border-color: #4a5568;
    }
    
    .aipress-input-container {
        background: #1a202c;
        border-color: #2d3748;
    }
    
    .aipress-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .aipress-input:focus {
        background: #4a5568;
        border-color: #667eea;
    }
}