/**
 * eDestiny Chat Widget v2.2 - Complete Styles with Theme Customization
 */



/* CSS Variables for Theme Customization */
:root {
    --edestiny-primary-color: #007AFF;
    --edestiny-secondary-color: #1a1a1a;
    --edestiny-accent-color: #0066CC;
    --edestiny-border-color: #2a2a2a;
    --edestiny-input-bg: #2a2a2a;
    --edestiny-input-focus: #333;
    --edestiny-text-muted: #888;
    --edestiny-button-hover: #555;
}

/* Reset and Base */
.edestiny-chat-launcher,
.edestiny-widget-container,
.edestiny-chat-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Floating Chat Button */
.edestiny-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--edestiny-primary-color), var(--edestiny-secondary-color));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    /* Shadow applied dynamically via PHP */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
    padding: 0;
    outline: none;
    overflow: hidden;
}

.edestiny-chat-launcher:hover {
    transform: scale(1.1);
    /* Shadow and background applied dynamically via PHP */
}

.edestiny-chat-launcher:active {
    transform: scale(0.95);
}

.edestiny-chat-launcher.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.edc-launcher-icon {
    width: 32px;
    height: 32px;
    color: white;
    fill: white;
    stroke: white;
    transition: all 0.3s ease;
    pointer-events: none;
}

.edc-launcher-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
}

.edc-launcher-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--edestiny-primary-color), var(--edestiny-secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 24px;
    pointer-events: none;
}

/* Widget Container */
.edestiny-widget-container {
    position: fixed;
    bottom: 24px; /* Alinhado com o launcher */
    right: 24px; /* Alinhado com o launcher */
    width: 495px; /* Custom width */
    height: 600px;
    z-index: 9998;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right; /* Ponto de origem para animação no canto inferior direito */
}

#eDestinyWidgetContainer {
    width: 495px; /* Custom style */
}

.edestiny-widget-container.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.edestiny-widget-container.expanded {
    width: 90vw;
    height: 90vh;
    bottom: 5vh;
    right: 5vw;
    max-width: 1200px;
    max-height: 800px;
}

/* Chat Widget */
.edestiny-chat-widget {
    width: 100%;
    height: 100%;
    background: var(--edestiny-secondary-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Edestiny chat widget height fix */
#eDestinyWidgetContainer .edestiny-chat-widget {
    height: 100%;
}

/* Fullscreen mode - remove rounded borders and shadows */
.edestiny-widget-container.expanded .edestiny-chat-widget {
    border-radius: 0 !important;
    box-shadow: none !important;
}

.edestiny-widget-container.expanded {
    border-radius: 0 !important;
}

/* Chat Header */
.edc-header {
    background: var(--edestiny-secondary-color);
    padding: 16px 20px;
    border-bottom: 1px solid var(--edestiny-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.edc-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.edc-agent-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--edestiny-primary-color), var(--edestiny-secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.edc-agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.edc-agent-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
}

.edc-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Menu System */
.edc-menu-container {
    position: relative;
}

.edc-menu-button {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edc-menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--edestiny-hover-color);
}

.edc-menu-button svg {
    width: 16px;
    height: 16px;
}

.edc-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--edestiny-border-color);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.edc-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.edc-menu-item {
    padding: 12px 16px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}

.edc-menu-item:hover {
    /* Background applied dynamically via PHP */
    color: var(--edestiny-hover-color);
}

.edc-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.edc-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.edc-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Submenu */
.menu-submenu {
    position: relative;
}

.submenu-arrow {
    margin-left: auto;
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.menu-submenu:hover .submenu-arrow {
    transform: rotate(180deg);
}

.submenu-dropdown {
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--edestiny-border-color);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

/* Submenu that opens downward */
.submenu-dropdown.submenu-down {
    left: 0;
    top: 100%;
    transform: translateY(-10px);
}

.menu-submenu.active .submenu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.menu-submenu.active .submenu-dropdown.submenu-down {
    transform: translateY(0);
}

.submenu-item {
    padding: 10px 14px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.submenu-item:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--edestiny-primary-color);
}

.submenu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.submenu-item:last-child {
    border-radius: 0 0 8px 8px;
}

.submenu-item svg {
    width: 14px;
    height: 14px;
}

/* Navigation Tabs */
.edc-navigation-tabs {
    display: flex;
    background: var(--edestiny-secondary-color);
    border-bottom: 1px solid var(--edestiny-border-color);
    padding: 0 20px;
}

/* Custom Navigation tabs */
#eDestinyWidgetContainer .edestiny-chat-widget .edc-navigation-tabs {
    padding-left: 0px;
    padding-right: 0px;
}

.edc-nav-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    color: var(--edestiny-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.edc-nav-tab svg {
    width: 16px;
    height: 16px;
}

.edc-nav-tab:hover {
    color: var(--edestiny-hover-color);
    /* Background applied dynamically via PHP */
}

.edc-nav-tab.active {
    color: var(--edestiny-primary-color);
    border-bottom-color: var(--edestiny-primary-color);
    /* Background applied dynamically via PHP */
}

/* Content Panels */
.edc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.edc-content-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.edc-content-panel.active {
    display: flex;
}

/* Chat Messages */
.edc-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #0f0f0f;
    scroll-behavior: smooth;
}

/* Custom Destiny chat messages */
#eDestinyChatMessages {
    padding-left: 0px;
    padding-right: 0px;
    padding-top: 10px;
    padding-bottom: 20px;
}

#eDestinyChatMessages .edc-message {
    padding-right: 16px; /* Custom style */
    margin-bottom: 0px; /* Custom style */
    padding-bottom: 0px; /* Custom style */
}

.edc-messages::-webkit-scrollbar {
    width: 6px;
}

.edc-messages::-webkit-scrollbar-track {
    background: transparent;
}

.edc-messages::-webkit-scrollbar-thumb {
    background: var(--edestiny-scrollbar-color);
    border-radius: 3px;
}

.edc-messages::-webkit-scrollbar-thumb:hover {
    background: var(--edestiny-hover-color);
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
    animation: messageSlideIn 0.3s ease-out;
    opacity: 0;
    animation-fill-mode: forwards;
}

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

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--edestiny-primary-color), var(--edestiny-secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#eDestinyChatMessages .message {
    background-color: transparent;
    margin-bottom: 0px;
    padding-right: 16px;
}

.welcome-message {
    display: block;
    opacity: 1;
    visibility: visible;
}

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

.message-bubble {
    max-width: 75%;
    padding: 12px 16px 30px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.message.agent .message-bubble {
    background: var(--edestiny-border-color);
    color: #ffffff;
    border-bottom-left-radius: 6px;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--edestiny-primary-color), var(--edestiny-secondary-color));
    color: white;
    border-bottom-right-radius: 6px;
}

.message.system .message-bubble {
    background: var(--edestiny-accent-color);
    color: white;
    text-align: center;
    font-size: 13px;
    max-width: 90%;
    margin: 0 auto;
}

.message-timestamp {
    position: absolute;
    bottom: 4px;
    right: 12px;
    font-size: 11px;
    opacity: 0.6;
    color: inherit;
}

/* Message Status Indicators */
.message-status {
    position: absolute;
    bottom: 4px;
    right: 50px;
    font-size: 12px;
    opacity: 0.7;
    color: #999;
    transition: all 0.3s ease;
}

.message-status.sent {
    color: #999;
}

.message-status.delivered {
    color: #999;
}

.message-status.read {
    color: #4CAF50;
}

.message-status .check {
    display: inline-block;
    margin-left: 1px;
}

.message-status .check:first-child {
    margin-left: 0;
}

/* Animation for status changes */
.message-status.updating {
    transform: scale(1.1);
    opacity: 1;
}

/* Reply Reference (WhatsApp style) */
.reply-reference {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--edestiny-primary-color);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    opacity: 0.8;
    position: relative;
}

.reply-reference .reply-author {
    color: var(--edestiny-primary-color);
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 2px;
}

.reply-reference .reply-text {
    color: inherit;
    opacity: 0.9;
    line-height: 1.3;
    max-height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Reply reference animation */
.reply-reference.fade-in {
    animation: replyFadeIn 0.3s ease-out;
}

@keyframes replyFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* Link Buttons */
.message-links {
    margin-top: 12px;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--edestiny-primary-color);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    max-width: fit-content;
    line-height: 1.2;
}

.link-button:hover {
    background: var(--edestiny-primary-hover, var(--edestiny-primary-color));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: white;
}

.link-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Link button animation */
.link-button.fade-in {
    animation: linkButtonFadeIn 0.3s ease-out;
}

@keyframes linkButtonFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive link buttons */
@media (max-width: 480px) {
    .link-button {
        padding: 12px 16px;
        font-size: 15px;
        border-radius: 16px;
        max-width: 100%;
        justify-content: center;
    }
}

/* External Links (outside message bubbles) */
.external-link-container {
    margin: 6px 0;
    padding: 0 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
}

/* Links-only messages (no bubble, just links) */
.message.links-only {
    display: block;
    margin: 8px 0;
    padding: 0;
}

.message.links-only .external-link-container {
    padding: 0 20px;
}

.external-link-container.show {
    opacity: 1;
    transform: translateY(0);
}

.external-link-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--edestiny-primary-color);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    max-width: fit-content;
    line-height: 1.3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.external-link-button:hover {
    background: var(--edestiny-primary-hover, var(--edestiny-primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: white;
}

.external-link-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.external-link-button .link-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Responsive external links */
@media (max-width: 480px) {
    .external-link-container {
        padding: 0 16px;
        margin: 6px 0;
    }

    .external-link-button {
        padding: 14px 18px;
        font-size: 15px;
        border-radius: 20px;
    }

    .external-link-button .link-icon {
        font-size: 18px;
    }
}

/* Typing Indicator */
.typing-indicator {
    animation: typingIndicatorSlideIn 0.2s ease-out;
    opacity: 1;
    visibility: visible;
}

.typing-indicator .message-bubble {
    padding: 12px 16px;
    animation: typingPulse 2s ease-in-out infinite;
    background: var(--edestiny-border-color) !important;
    opacity: 1;
}

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

@keyframes typingPulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    opacity: 1;
    visibility: visible;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    opacity: 1;
    display: block;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots 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;
    }
}

/* Chat Input */
.edc-input-container {
    padding: 16px 20px;
    background: var(--edestiny-secondary-color);
    border-top: 1px solid var(--edestiny-border-color);
    position: relative;
    flex-shrink: 0;
}

/* Mobile viewport fixes for fullscreen mode */
@media screen and (max-width: 768px) {
    .edestiny-widget-container.expanded {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for modern browsers */
        bottom: 0 !important;
        right: 0 !important;
        top: 0 !important;
        left: 0 !important;
        max-width: none !important;
        max-height: none !important;
        position: fixed !important;
        z-index: 999999 !important;
    }
    
    .edestiny-widget-container.expanded .edestiny-chat-widget {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height */
        min-height: -webkit-fill-available; /* iOS Safari fallback */
        display: flex;
        flex-direction: column;
    }
    
    /* Fixed header in fullscreen */
    .edestiny-widget-container.expanded .chat-header {
        flex-shrink: 0;
        position: relative;
        z-index: 1;
    }
    
    /* Flexible content area */
    .edestiny-widget-container.expanded .edc-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Navigation tabs */
    .edestiny-widget-container.expanded .edc-navigation-tabs {
        flex-shrink: 0;
    }
    
    /* Fixed input at bottom */
    .edestiny-widget-container.expanded .edc-input-container {
        flex-shrink: 0;
        position: relative;
        bottom: 0;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        background: var(--edestiny-secondary-color);
        z-index: 1;
    }
    
    /* Additional iOS Safari fixes */
    @supports (-webkit-touch-callout: none) {
        .edestiny-widget-container.expanded {
            height: -webkit-fill-available !important;
        }
        
        .edestiny-widget-container.expanded .edestiny-chat-widget {
            height: -webkit-fill-available;
        }
    }
    
    /* Ensure input wrapper is always accessible */
    .edestiny-widget-container.expanded .edc-input-wrapper {
        min-height: 44px;
        margin-bottom: env(safe-area-inset-bottom, 0px);
    }
}

.edc-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--edestiny-border-color);
    border-radius: 24px;
    padding: 8px 8px 8px 16px;
    transition: all 0.2s ease;
}

#chat-panel .edc-input-wrapper {
    align-items: center; /* Custom style */
}

.edc-input-wrapper:focus-within {
    background: var(--edestiny-input-focus);
    /* Shadow applied dynamically via PHP */
}

.edc-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--edestiny-text-color);
    font-size: 16px; /* Minimum 16px to prevent iOS zoom */
    line-height: 1.4;
    resize: none;
    outline: none;
    max-height: 120px;
    min-height: 20px;
    font-family: inherit;
    -webkit-appearance: none;
    -webkit-border-radius: 0;
    border-radius: 0;
}

.edc-input::placeholder {
    color: var(--edestiny-text-muted);
}

.edc-send-button {
    width: 32px;
    height: 32px;
    background: var(--edestiny-primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.5;
    transform: scale(0.9);
}

.send-button.active {
    opacity: 1;
    transform: scale(1);
}

.send-button:hover.active {
    background: var(--edestiny-secondary-color);
    transform: scale(1.05);
}

.send-button svg {
    width: 16px;
    height: 16px;
    color: white;
    stroke: white;
    fill: none;
}

/* Conversations Panel */
.edc-conversations-header {
    padding: 20px;
    border-bottom: 1px solid var(--edestiny-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edc-conversations-header h3 {
    color: var(--edestiny-text-color);
    font-size: 18px;
    font-weight: 600;
}

.edc-btn-new-conversation {
    background: var(--edestiny-primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.edc-btn-new-conversation:hover {
    background: var(--edestiny-hover-color);
    transform: translateY(-1px);
}

.edc-btn-new-conversation svg {
    width: 14px;
    height: 14px;
}

.edc-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

#eDestinyConversationsList {
    padding-top: 20px; /* Custom style */
}

.conversation-item {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--edestiny-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-item:hover {
    background: var(--edestiny-input-focus);
    transform: translateY(-1px);
}

.conversation-item.active {
    background: rgba(0, 122, 255, 0.2);
    border: 1px solid rgba(0, 122, 255, 0.3);
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-title {
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    color: var(--edestiny-text-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.conversation-time {
    color: #666;
    font-size: 11px;
}

.conversation-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.delete-conversation {
    background: transparent;
    border: none;
    color: var(--edestiny-accent-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.delete-conversation:hover {
    background: rgba(255, 59, 48, 0.1);
}

.delete-conversation svg {
    width: 14px;
    height: 14px;
}

.no-conversations {
    text-align: center;
    padding: 40px 20px;
    color: var(--edestiny-text-muted);
}

.no-conversations p {
    margin-bottom: 16px;
    font-size: 14px;
}

.no-conversations .hint {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.btn-primary {
    background: var(--edestiny-primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--edestiny-secondary-color);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .edestiny-widget-container {
        right: 16px;
        left: 16px;
        width: auto;
        bottom: 100px;
        height: 70vh;
        max-height: 600px;
    }
    
    #eDestinyWidgetContainer {
        width: auto;
    }
    
    .edestiny-widget-container.expanded {
        right: 0px;
        left: 0px;
        bottom: 0px;
        top: 0px;
        height: 100vh;
        width: 100vw;
        border-radius: 0;
    }
    
    .edestiny-chat-launcher {
        right: 20px;
        bottom: 20px;
        width: 56px;
        height: 56px;
    }
    
    .edc-launcher-icon,
    .edc-launcher-image {
        width: 28px;
        height: 28px;
    }
    
    .edc-navigation-tabs {
        padding: 0 12px;
    }
    
    .edc-nav-tab {
        font-size: 12px;
        padding: 10px 6px;
    }
    
    .edc-messages {
        padding: 16px;
    }
    
    .edc-conversations-header,
    .edc-conversations-list {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .edc-menu-dropdown {
        right: -10px;
        min-width: 180px;
    }
    
    .submenu-dropdown {
        left: -180px;
        top: 0;
    }
    
    .submenu-dropdown.submenu-down {
        left: 0;
        top: 100%;
    }
}

/* Light Theme Support */
.edestiny-chat-widget[data-theme="light"] {
    background: #ffffff;
}

.edestiny-chat-widget[data-theme="light"] .chat-header {
    background: #ffffff;
    border-bottom-color: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .agent-name {
    color: #1d1d1f;
}

.edestiny-chat-widget[data-theme="light"] .menu-button {
    color: #1d1d1f;
}

.edestiny-chat-widget[data-theme="light"] .menu-dropdown {
    background: #ffffff;
    border-color: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .menu-item {
    color: #1d1d1f;
}

.edestiny-chat-widget[data-theme="light"] .submenu-dropdown {
    background: #ffffff;
    border-color: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .submenu-item {
    color: #1d1d1f;
}

.edestiny-chat-widget[data-theme="light"] .edc-navigation-tabs {
    background: #ffffff;
    border-bottom-color: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .edc-nav-tab {
    color: #666;
}

.edestiny-chat-widget[data-theme="light"] .edc-nav-tab:hover {
    background: var(--edestiny-input-bg);
}

.edestiny-chat-widget[data-theme="light"] .edc-nav-tab.active {
    background: var(--edestiny-input-focus);
}

.edestiny-chat-widget[data-theme="light"] .edc-messages {
    background: #f5f5f7;
}

.edestiny-chat-widget[data-theme="light"] .edc-message.agent .edc-message-bubble {
    background: #ffffff;
    color: #1d1d1f;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.edestiny-chat-widget[data-theme="light"] .edc-input-container {
    background: #ffffff;
    border-top-color: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .edc-input-wrapper {
    background: #f5f5f7;
}

.edestiny-chat-widget[data-theme="light"] .edc-input {
    color: #1d1d1f;
}

.edestiny-chat-widget[data-theme="light"] .edc-conversations-header {
    border-bottom-color: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .edc-conversations-header h3 {
    color: #1d1d1f;
}

.edestiny-chat-widget[data-theme="light"] .conversation-item {
    background: #f5f5f7;
}

.edestiny-chat-widget[data-theme="light"] .conversation-item:hover {
    background: #e5e5e7;
}

.edestiny-chat-widget[data-theme="light"] .conversation-title {
    color: #1d1d1f;
}

/* Custom Styles - Send Button SVG */
#eDestinySendButton svg {
    padding: 10px;
}

/* Custom Styles - Message Bubble Min Width */
#eDestinyChatMessages .message .message-bubble {
    min-width: 70px;
}

/* iOS Safari Zoom Prevention */
@supports (-webkit-touch-callout: none) {
    .edc-input, .edc-input:focus {
        font-size: 16px !important;
        transform: scale(1) !important;
        -webkit-text-size-adjust: 100% !important;
        -webkit-transform: scale(1) !important;
        -webkit-transform-origin: left top !important;
    }
}

/* Additional iOS fixes */
.edc-input {
    -webkit-user-select: text;
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on all iOS devices */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    select, textarea, input[type="text"], input[type="password"], 
    input[type="datetime"], input[type="datetime-local"], 
    input[type="date"], input[type="month"], input[type="time"], 
    input[type="week"], input[type="number"], input[type="email"], 
    input[type="url"], input[type="search"], input[type="tel"], 
    input[type="color"], .edc-input {
        font-size: 16px !important;
        -webkit-appearance: none;
        border-radius: 0;
    }
}

/* Mobile Responsive - Widget Max Width */
@media (max-width: 768px) {
    #eDestinyWidgetContainer .edestiny-chat-widget {
        max-width: 100%;
    }
    
    /* Additional iOS zoom prevention for mobile */
    .edc-input {
        font-size: 16px !important;
        -webkit-text-size-adjust: none;
        -webkit-user-select: text;
    }
    
    .edc-input:focus {
        font-size: 16px !important;
        -webkit-transform: scale(1) !important;
        transform: scale(1) !important;
    }
}