/* Styling for modern floating chat widget */
.chat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.chat-widget-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.6);
}

.chat-widget-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--bg-card, #ffffff);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid var(--border-color, #eaeaea);
}

[data-theme="dark"] .chat-widget-window {
    background: #1e1e2d;
    border-color: #2b2b40;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.chat-widget-window.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header span {
    font-size: 12px;
    opacity: 0.8;
}

.close-chat {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-chat:hover {
    opacity: 1;
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-body, #f8f9fa);
}

[data-theme="dark"] .chat-body {
    background: #151521;
}

.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

.bot-message {
    align-self: flex-start;
    background: var(--bg-card, #ffffff);
    color: var(--text-color, #333);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color, #eaeaea);
}

[data-theme="dark"] .bot-message {
    background: #1e1e2d;
    color: #fff;
    border-color: #2b2b40;
}

.user-message {
    align-self: flex-end;
    background: var(--primary-color, #6366f1);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-footer {
    display: flex;
    padding: 12px 15px;
    background: var(--bg-card, #ffffff);
    border-top: 1px solid var(--border-color, #eaeaea);
    align-items: center;
    gap: 10px;
}

[data-theme="dark"] .chat-footer {
    background: #1e1e2d;
    border-color: #2b2b40;
}

.chat-footer input {
    flex: 1;
    border: none;
    background: var(--bg-body, #f1f1f1);
    padding: 10px 15px;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    color: var(--text-color, #333);
}

[data-theme="dark"] .chat-footer input {
    background: #151521;
    color: #fff;
}

.btn-send, .btn-open-ticket {
    background: transparent;
    border: none;
    color: var(--primary-color, #6366f1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.btn-send:hover, .btn-open-ticket:hover {
    transform: scale(1.1);
}

/* Ticket form styles */
.chat-ticket-form {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card, #ffffff);
    padding: 20px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    animation: slideUp 0.3s ease;
}

[data-theme="dark"] .chat-ticket-form {
    background: #1e1e2d;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

.chat-ticket-form h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color, #333);
}

[data-theme="dark"] .chat-ticket-form h5 { color: #fff; }

.chat-ticket-form input, .chat-ticket-form textarea {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    background: var(--bg-body, #fff);
    color: var(--text-color, #333);
    font-family: inherit;
    box-sizing: border-box;
}

[data-theme="dark"] .chat-ticket-form input, [data-theme="dark"] .chat-ticket-form textarea {
    background: #151521;
    border-color: #2b2b40;
    color: #fff;
}

.ticket-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.ticket-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel {
    background: var(--bg-body, #eee);
    color: var(--text-color, #333);
}

[data-theme="dark"] .btn-cancel { background: #2b2b40; color: #fff; }

.btn-submit {
    background: var(--primary-color, #6366f1);
    color: white;
}

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chat-widget-window {
        width: calc(100vw - 40px);
        height: 60vh;
        bottom: 70px;
        right: 20px;
    }
}
