/* Chat Widget Container */
.yllia-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Exo 2', sans-serif;
}

/* Chat Button */
.yllia-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c3e50, #1e293b);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: pulse 2s infinite;
}

.yllia-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Chat Window */
.yllia-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    height: 560px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    border: 1px solid #cbd5e1;
}

.yllia-chat-window.active {
    display: flex;
}

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

/* Chat Header */
.yllia-chat-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #4a5568 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.yllia-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.yllia-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(226, 232, 240, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid rgba(148, 163, 184, 0.3);
}

.yllia-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
}

.yllia-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
    color: #cbd5e1;
}

.yllia-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.2s;
}

.yllia-close:hover {
    opacity: 0.7;
}

/* Chat Body */
.yllia-chat-body {
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message container */
.yllia-msg {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.yllia-msg-assistant {
    justify-content: flex-start;
}

.yllia-msg-user {
    justify-content: flex-end;
}

.yllia-msg-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.yllia-msg-assistant .yllia-msg-bubble {
    background: white;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.yllia-msg-user .yllia-msg-bubble {
    background: linear-gradient(135deg, #475569, #334155);
    color: white;
    border-bottom-right-radius: 4px;
}

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

/* Legacy single message (for fallback) */
.yllia-message {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
    position: relative;
    animation: fadeIn 0.5s ease;
    border: 1px solid #e2e8f0;
}

.yllia-message p {
    margin: 0;
    color: #334155;
    line-height: 1.6;
}

.yllia-message a {
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.yllia-message a:hover {
    color: #1e293b;
    text-decoration: underline;
}

/* Chat Footer */
.yllia-chat-footer {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.yllia-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.yllia-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
    background: #f8fafc;
}

.yllia-input:focus {
    border-color: #64748b;
    background: white;
}

.yllia-summary-button,
.yllia-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #475569, #334155);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.yllia-summary-button {
    background: linear-gradient(135deg, #6b8cae, #5a7a9a);
    box-shadow: 0 2px 8px rgba(107, 140, 174, 0.35);
    animation: summaryBounce 4s ease-in-out infinite;
    animation-delay: 10s;
}

@keyframes summaryBounce {
    0%, 85%, 100% {
        transform: translateY(0);
    }
    90% {
        transform: translateY(-6px);
    }
    95% {
        transform: translateY(0);
    }
}

.yllia-summary-button:hover {
    background: linear-gradient(135deg, #5a7a9a, #4a6a8a);
    transform: scale(1.1);
    animation: none;
}

.yllia-send-button:hover {
    background: linear-gradient(135deg, #334155, #1e293b);
    transform: scale(1.05);
}

.yllia-summary-button:disabled,
.yllia-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.yllia-restart-button {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.yllia-restart-button:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .yllia-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 70px;
    }
}

/* Typing Indicator */
.yllia-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.yllia-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    animation: typing 1.4s infinite;
}

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

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

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

/* Disabled state for input */
.yllia-input:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
}

/* Markdown content in messages */
.yllia-msg-bubble p {
    margin: 0 0 8px 0;
}

.yllia-msg-bubble p:last-child {
    margin-bottom: 0;
}

.yllia-msg-bubble strong {
    font-weight: 600;
}

.yllia-msg-bubble em {
    font-style: italic;
}

.yllia-msg-bubble ul,
.yllia-msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.yllia-msg-bubble li {
    margin: 4px 0;
}

.yllia-msg-bubble a {
    color: #475569;
    text-decoration: underline;
}

.yllia-msg-user .yllia-msg-bubble a {
    color: #e2e8f0;
}

.yllia-msg-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.yllia-msg-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.yllia-msg-bubble pre code {
    background: none;
    padding: 0;
}

/* Yllia Disclaimer Modal */
.yllia-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.yllia-modal-overlay.hidden {
    display: none;
}

.yllia-modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.yllia-modal-header {
    padding: 20px 24px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.yllia-modal-header h2 {
    color: #e2e8f0;
    font-size: 20px;
    font-weight: 400;
    margin: 0;
}

.yllia-modal-body {
    padding: 20px 24px;
}

.yllia-warning-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border-left: 3px solid #64748b;
}

.yllia-warning-item .yllia-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.yllia-warning-item div {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
}

.yllia-warning-item strong {
    color: #e2e8f0;
    display: block;
    margin-bottom: 2px;
}

.yllia-modal-note {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    margin-top: 16px;
}

.yllia-modal-note a {
    color: #60a5fa;
}

.yllia-modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.yllia-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    color: #e2e8f0;
    font-size: 13px;
}

.yllia-checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.yllia-checkbox-wrapper a {
    color: #60a5fa;
}

#ylliaAcceptButton {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#ylliaAcceptButton:hover:not(:disabled) {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    transform: translateY(-1px);
}

#ylliaAcceptButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}