/* 
    OrgaPress Concierge - Bulletproof CSS 
    Uses #opc-widget-container as a namespace boundary
*/

/* Reset & Container */
#opc-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.5;
    color: #333;
}

/* Aggressive Reset for children to prevent theme bleed */
#opc-widget-container * {
    box-sizing: border-box;
margin:0;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
}

/* Bubble */
#opc-bubble {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0073aa, #005177);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 115, 170, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

#opc-bubble:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 32px rgba(0, 115, 170, 0.5);
}

#opc-bubble svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Chat Window */
.opc-hidden {
    display: none !important;
}

#opc-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: opcSlideIn 0.3s ease-out;
}

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

/* Header */
.opc-header {
    background: linear-gradient(135deg, #0073aa, #005177);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    z-index: 10;
}

#opc-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    padding:0;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.2s;
}

#opc-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages Area */
.opc-messages {
    flex: 1;
    padding: 25px;
    padding-bottom: 30px; /* More space at bottom */
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 18px; /* Increased Gap between messages */
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.opc-messages::-webkit-scrollbar {
    width: 6px;
}
.opc-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.opc-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Message Bubbles */
.opc-msg {
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.opc-ai {
    background: #ffffff;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #f1f5f9;
}

.opc-user {
    background: #0073aa;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.opc-system {
    align-self: center;
    background: none;
    box-shadow: none;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    max-width: 100%;
    padding: 8px 0;
}

.opc-typing {
    background: transparent;
    color: #94a3b8;
    font-style: italic;
    box-shadow: none;
    padding: 5px 10px;
    border: none;
    font-size: 13px;
}

/* Input Area */
.opc-input-area {
    padding: 20px 25px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 15px; /* Reduced to make space for branding */
}

.opc-branding {
    background: white;
    font-size: 10px !important;
    color: #94a3b8;
    text-align: center;
    padding-bottom: 10px;
    margin-top: -5px;
}

.opc-branding a {
    color: inherit;
    text-decoration: none;
}

.opc-branding a:hover {
    text-decoration: underline;
color: #ccc;
}

#opc-input {
    flex: 1;
    height: 42px;
    padding: 0 16px;
    border: 1px solid #e2e8f0;
    border-radius: 21px;
    outline: none;
    font-size: 15px;
    background: #f8fafc;
    color: #333;
    transition: all 0.2s ease;
}

#opc-input:focus {
    border-color: #0073aa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

#opc-send {
    background: #0073aa;
    color: white;
    border: none;
    /* Force Circle Dimensions */
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    margin: 0 !important;
    
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.25);
    transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
    line-height: 0; /* Fix vertical alignment of SVG */
}

#opc-send:focus {
    outline: none;
}

#opc-send:hover {
    background: #005177;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.35);
}

#opc-send:active {
    transform: scale(0.95);
}

#opc-send svg {
    margin-left: -2px; /* Visual center adjustment */
    margin-top: 2px;
}

/* Suggestion Chips */
.opc-suggestions {
    padding: 8px 15px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap; /* Allow wrapping to next line */
    overflow-y: auto; /* Vertical scroll */
    max-height: 46px; /* Height for approx 1 row */
    border-top: 1px solid #f1f5f9;
    background: #fff;
    margin-bottom: 0;
    margin-top: auto;
    scrollbar-width: thin;
}

/* Vertical Scrollbar Styling */
.opc-suggestions::-webkit-scrollbar {
    width: 4px; /* Thin vertical scrollbar */
}
.opc-suggestions::-webkit-scrollbar-track {
    background: transparent;
}
.opc-suggestions::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.opc-chip {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 4px 10px !important; /* Smaller padding */
    margin: 0 !important;
    font-size: 11px; /* Smaller font */
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
    flex: 0 0 auto;
}

.opc-chip:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #opc-widget-container {
        bottom: 0;
        right: 0;
    }
    
    #opc-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 100000;
    }
    
    #opc-bubble {
        bottom: 20px;
        right: 20px;
        position: absolute;
    }
}
