#esim-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 20px 0;
}

#esim-chat-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.esim-chat-header {
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.esim-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.esim-chat-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.esim-chat-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#esim-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 300px;
    max-height: 500px;
}

.esim-chat-messages ul, .esim-chat-messages ol {
    padding-left: 20px;
}

.esim-chat-messages li {
    margin-bottom: 5px;
}

.esim-chat-message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

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

.esim-chat-message.user {
    justify-content: flex-end;
}

.esim-chat-message.assistant {
    justify-content: flex-start;
}

.esim-chat-message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.2;
    white-space: pre-wrap;
}

.esim-chat-message-bubble p {
    margin: 0 0 5px;
    line-height: 1.2;
    color: inherit;
}

.esim-chat-message-bubble p:last-child {
    margin-bottom: 0;
}

.esim-chat-message-bubble p:first-child {
    margin-top: 0;
}

.esim-chat-message-bubble ul,
.esim-chat-message-bubble ol {
    margin: 0 6px;
    padding-left: 18px;
    line-height: 1.2;
}

.esim-chat-message-bubble ul {
    list-style-type: disc;
}

.esim-chat-message-bubble ol {
    list-style-type: decimal;
}

.esim-chat-message-bubble li {
    margin:  0 5px;
    line-height: 1.2;
    padding-left: 4px;
}

.esim-chat-message-bubble li::marker {
    color: inherit;
    opacity: 0.7;
}

.esim-chat-message-bubble strong {
    font-weight: 600;
    color: inherit;
}

.esim-chat-message-bubble em {
    font-style: italic;
    color: inherit;
}

.esim-chat-message-bubble h3,
.esim-chat-message-bubble h4 {
    margin: 0 0 5px;
    font-weight: 600;
    line-height: 1.2;
    color: inherit;
}

.esim-chat-message-bubble h3 {
    font-size: 1.1em;
}

.esim-chat-message-bubble h4 {
    font-size: 1em;
}

.esim-chat-message-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
    color: inherit;
}

.esim-chat-message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px 14px;
    border-radius: 6px;
    overflow-x: auto;
    margin:  0 0 5px;
    border-left: 3px solid rgba(0, 0, 0, 0.1);
}

.esim-chat-message-bubble pre code {
    background: transparent;
    padding: 0;
    font-size: 0.9em;
}

.esim-chat-message-bubble blockquote {
    margin:  0 0 5px;
    padding: 10px 14px;
    border-left: 3px solid rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    font-style: italic;
    color: inherit;
}

.esim-chat-message-bubble hr {
    margin: 0 0 5px;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    height: 0;
}

.esim-chat-message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin:  0 0 5px;
    font-size: 0.95em;
}

.esim-chat-message-bubble table th,
.esim-chat-message-bubble table td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.esim-chat-message-bubble table th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.esim-chat-message-bubble table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.esim-chat-message-bubble a {
    color: inherit;
    text-decoration: underline;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.esim-chat-message-bubble a:hover {
    opacity: 1;
}

.esim-chat-message.user .esim-chat-message-bubble a {
    color: rgba(255, 255, 255, 0.9);
}

.esim-chat-message.user .esim-chat-message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.esim-chat-message.assistant .esim-chat-message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.esim-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.esim-chat-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.esim-chat-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 15px;
    background: white;
}

.esim-chat-fields {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.esim-chat-fields input {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.esim-chat-fields input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.esim-chat-input-wrapper {
    display: flex;
    gap: 10px;
}

#esim-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
     border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#esim-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.esim-chat-send-btn {
    padding: 12px 24px;
    background: rgb(96 165 250);
    color: white;
    border: none;
     border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.esim-chat-send-btn:hover:not(:disabled) {
    background: #5568d3;
}

.esim-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.esim-chat-widget.collapsed #esim-chat-messages,
.esim-chat-widget.collapsed .esim-chat-input-area {
    display: none;
}

.esim-chat-widget.collapsed {
    height: auto;
}

/* Плавающая кнопка */
.esim-chat-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background:rgb(96 165 250);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.esim-chat-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.esim-chat-floating-btn svg {
    width: 28px;
    height: 28px;
}

/* Модальное окно */
.esim-chat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.esim-chat-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.esim-chat-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.esim-chat-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
}

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

.esim-chat-floating #esim-chat-widget {
    height: 600px;
    max-height: 80vh;
}

.esim-chat-close-btn {
    position: relative;
    display: block;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.esim-chat-close-btn::after, 
.esim-chat-close-btn::before {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: rgb(19, 19, 19);
    opacity: 0.5;
}
.esim-chat-close-btn::before {
    background: rgb(19, 19, 19);
    opacity: 0.5;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.esim-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.esim-chat-shortcode {
    position: relative;
}

/* Адаптивность */
@media (max-width: 768px) {
    .esim-chat-fields {
        flex-direction: column;
    }
    
    .esim-chat-fields input {
        width: 100%;
    }
    
    .esim-chat-message-bubble {
        max-width: 85%;
    }
    
    .esim-chat-floating-btn {
        width: 56px;
        height: 56px;
        bottom: 15px;
        right: 15px;
    }
    
    .esim-chat-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .esim-chat-floating #esim-chat-widget {
        height: 500px;
        max-height: 85vh;
    }
}

