/* ============================================
   SUPPORT WIDGET STYLES
   Floating chat widget for support tickets
   ============================================ */

/* Floating Button */
.support-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.support-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.support-fab.has-unread::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

/* Mobile nav spacing */
@media (max-width: 768px) {
    .support-fab {
        bottom: 80px;
        /* Above mobile nav */
    }
}

/* Widget Container */
.support-widget {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 150px);
    background: var(--glass-bg, rgba(255, 255, 255, 0.95));
    border-radius: 1.5rem;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 1049;
    display: none;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="dark"] .support-widget {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.support-widget.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Widget Header */
.support-widget-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.support-widget-header .header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.support-widget-header .header-text {
    flex: 1;
}

.support-widget-header .header-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.support-widget-header .header-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 0;
}

.support-widget-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.support-widget-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.support-widget-header .back-btn {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    margin-right: 0.5rem;
    display: none;
}

.support-widget-header .back-btn.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-widget-header .back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Widget Body */
.support-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Self-Help Flow */
.selfhelp-message {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.selfhelp-message .bot-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 0.75rem;
}

.selfhelp-message p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.5;
}

.selfhelp-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selfhelp-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--card-bg, white);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: var(--text-color);
    font-size: 0.9rem;
}

[data-theme="dark"] .selfhelp-option {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.selfhelp-option:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.selfhelp-option i {
    font-size: 1.1rem;
    color: #6366f1;
}

/* Info Box */
.selfhelp-info {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
    padding: 0.875rem 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-color);
}

/* Action Button */
.selfhelp-action-btn {
    display: block;
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.selfhelp-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Ticket Form */
.ticket-form {
    display: none;
}

.ticket-form.active {
    display: block;
}

.ticket-form .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ticket-form .form-control {
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

[data-theme="dark"] .ticket-form .form-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.ticket-form textarea.form-control {
    min-height: 100px;
    resize: none;
}

/* Widget Footer */
.support-widget-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

[data-theme="dark"] .support-widget-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.support-widget-footer a {
    color: #6366f1;
    text-decoration: none;
}

.support-widget-footer a:hover {
    text-decoration: underline;
}

/* Chat Messages in Widget */
.widget-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
}

.widget-message {
    display: flex;
    gap: 0.5rem;
    max-width: 85%;
}

.widget-message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.widget-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.widget-message-content {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.625rem 0.875rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

[data-theme="dark"] .widget-message-content {
    background: rgba(255, 255, 255, 0.1);
}

.widget-message.own .widget-message-content {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* Widget Input */
.widget-input-container {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 0.5rem;
}

[data-theme="dark"] .widget-input-container {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.widget-input-container input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    outline: none;
}

[data-theme="dark"] .widget-input-container input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.widget-input-container input:focus {
    border-color: #6366f1;
}

.widget-input-container button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.widget-input-container button:hover {
    transform: scale(1.1);
}

/* Success State */
.ticket-success {
    text-align: center;
    padding: 2rem 1rem;
}

.ticket-success .success-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.75rem;
}

.ticket-success h4 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.ticket-success p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.ticket-success .ticket-number {
    background: rgba(99, 102, 241, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: inline-block;
    font-family: monospace;
    font-size: 0.9rem;
    color: #6366f1;
    margin-bottom: 1rem;
}