/* Premium Chat Widget Style with Glassmorphism for ARMA VPN */

#support-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Floating Trigger Button */
#support-widget-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: var(--bg-darker);
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px var(--primary-glow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

#support-widget-trigger:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 12px 40px var(--primary-glow), 0 0 20px rgba(16, 185, 129, 0.6);
}

#support-widget-trigger:active {
    transform: scale(0.95);
}

#support-widget-trigger .close-icon {
    font-size: 1.4rem;
}

/* Pulse trigger animation for attention */
.pulse-trigger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    top: 0;
    left: 0;
    opacity: 0.8;
    animation: trigger-pulse 2.2s infinite;
    pointer-events: none;
}

@keyframes trigger-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Unread Badge */
#support-widget-trigger .unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 50px;
    border: 2px solid var(--bg-dark);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    animation: badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Chat Window */
#support-widget-window {
    width: 380px;
    height: 520px;
    background: rgba(8, 12, 9, 0.82);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(16, 185, 129, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 76px;
    right: 0;
    transform-origin: bottom right;
    animation: window-appear 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transition: opacity 0.3s, transform 0.3s;
}

#support-widget-window.hidden {
    display: none !important;
    opacity: 0;
    transform: scale(0.8) translateY(30px);
    pointer-events: none;
}

@keyframes window-appear {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(40px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Window Header */
.support-window-header {
    padding: 16px 20px;
    background: rgba(16, 26, 19, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.support-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.support-avatar-pulse {
    position: relative;
    width: 40px;
    height: 40px;
}

.support-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--primary);
    background: var(--bg-darker);
    object-fit: cover;
}

.support-avatar-pulse .status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

.status-indicator.online {
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.support-header-text h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}

.support-header-text .status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

#support-widget-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#support-widget-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

/* Messages Body */
.support-messages-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.support-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: message-slide 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes message-slide {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.support-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.support-message.admin {
    align-self: flex-start;
    align-items: flex-start;
}

.support-message.system {
    align-self: center;
    max-width: 90%;
    text-align: center;
}

.support-message .message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.support-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary-dark) 0%, rgba(16, 185, 129, 0.8) 100%);
    color: var(--bg-darker);
    font-weight: 500;
    border-bottom-right-radius: 2px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.support-message.admin .message-bubble {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.support-message.system .message-bubble {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.12);
    color: var(--text-muted);
    font-size: 0.82rem;
    border-radius: 10px;
    padding: 8px 12px;
}

/* Image Message Attachment */
.support-message .message-image-wrapper {
    margin-bottom: 6px;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.support-message .message-image-wrapper:hover {
    transform: scale(1.02);
}

.support-message .message-image {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    display: block;
}

/* File Message Attachment Card */
.support-message .message-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 6px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.support-message .message-file-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.support-message.user .message-file-card {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--bg-darker);
}

.support-message.user .message-file-card:hover {
    background: rgba(0, 0, 0, 0.25);
}

.support-message .message-file-card i {
    font-size: 1.25rem;
}

.support-message .message-file-card .file-info {
    display: flex;
    flex-direction: column;
    max-width: 180px;
}

.support-message .message-file-card .file-name {
    font-size: 0.82rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-message .message-file-card .file-size {
    font-size: 0.7rem;
    opacity: 0.7;
}

.support-message .message-time {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
    padding: 0 4px;
}

/* File Preview Bar */
#support-file-preview-bar {
    padding: 10px 16px;
    background: rgba(16, 26, 19, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: bar-slide-up 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes bar-slide-up {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

#support-file-preview-bar .preview-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--primary);
    max-width: 80%;
}

#support-file-preview-bar .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#support-file-remove {
    background: transparent;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

#support-file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Form Input Area */
#support-widget-form {
    padding: 12px 16px;
    background: rgba(5, 7, 5, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.support-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: all 0.3s ease;
}

.support-input-wrapper:focus-within {
    border-color: var(--primary-glow);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

/* File Input Label */
.support-attach-btn {
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.support-attach-btn:hover {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

/* Textarea input */
#support-message-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 8px 0;
    resize: none;
    max-height: 80px;
    line-height: 1.3;
}

#support-message-input::placeholder {
    color: var(--text-dim);
}

/* Send Button */
.support-send-btn {
    background: var(--primary);
    border: none;
    color: var(--bg-darker);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

.support-send-btn:hover:not(:disabled) {
    transform: scale(1.08) rotate(-15deg);
    background: var(--primary-dark);
}

.support-send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    cursor: not-allowed;
}

/* Custom Scrollbar for Messages */
.support-messages-body::-webkit-scrollbar {
    width: 5px;
}

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

.support-messages-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.support-messages-body::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* Loading Dots Animation inside Chat */
.support-chat-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    align-self: flex-start;
    animation: message-slide 0.3s ease;
}

.support-chat-loading span {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: loading-dots 1.4s infinite ease-in-out both;
}

.support-chat-loading span:nth-child(1) { animation-delay: -0.32s; }
.support-chat-loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading-dots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Fullscreen modal for images */
#support-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#support-image-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#support-image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

#support-image-modal.active img {
    transform: scale(1);
}

#support-image-modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

#support-image-modal-close:hover {
    background: rgba(239, 68, 68, 0.6);
}

/* Mobile Responsive Override */
@media (max-width: 576px) {
    #support-widget-container {
        bottom: 16px;
        right: 16px;
    }
    
    #support-widget-container.window-open #support-widget-trigger {
        display: none !important;
    }
    
    #support-widget-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: -webkit-fill-available; /* Support iOS viewport */
        border-radius: 0;
        border: none;
        background: var(--bg-dark); /* Solid background to overlay website content on mobile */
    }
    
    .support-window-header {
        padding: 16px;
        background: var(--bg-darker);
    }
    
    #support-widget-close {
        font-size: 1.2rem;
    }
    
    #support-widget-close i::before {
        content: "\f00d";
    }
    
    .support-messages-body {
        padding: 16px;
    }
    
    #support-widget-form {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* Safe area support */
    }
}

/* Toast Notification Popup */
.support-toast {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 300px;
    background: rgba(16, 26, 19, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 15px rgba(16, 185, 129, 0.1);
    color: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}

.support-toast.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.support-toast:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(16, 185, 129, 0.2);
}

.support-toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.support-toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    display: flex;
    align-items: center;
}

.support-toast-close:hover {
    color: var(--red);
}

.support-toast-body {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-light);
    line-height: 1.4;
}

/* Neon glow / pulsing unread badge state */
.pulse-badge {
    animation: badge-pop-pulse 1.8s infinite alternate !important;
}

@keyframes badge-pop-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    }
    100% {
        transform: scale(1.15);
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.8), 0 0 8px rgba(239, 68, 68, 0.6);
    }
}

/* Interactive closure block inside chat input container */
.support-closure-block {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    padding: 4px;
    animation: fade-in 0.3s ease-in-out;
}

.support-closure-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}

.support-closure-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.support-closure-btn {
    flex: 1;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.support-closure-btn.yes {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-darker);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.support-closure-btn.yes:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.support-closure-btn.no {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.support-closure-btn.no:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile adjustments for Toast */
@media (max-width: 576px) {
    .support-toast {
        bottom: 84px;
        right: 16px;
        width: calc(100vw - 32px);
    }
}

/* History Screen Overlay & Layout */
.support-history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 12, 9, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 15;
    display: flex;
    flex-direction: column;
    animation: slide-in-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in-left {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.support-history-header {
    padding: 16px 20px;
    background: rgba(16, 26, 19, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
}

.history-back-btn {
    background: rgba(16, 185, 129, 0.1);
    border: none;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.history-back-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: translateX(-2px);
}

.support-history-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Outfit', sans-serif;
}

.support-history-list-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.support-history-list-body::-webkit-scrollbar,
.support-history-detail-body::-webkit-scrollbar {
    width: 5px;
}

.support-history-list-body::-webkit-scrollbar-track,
.support-history-detail-body::-webkit-scrollbar-track {
    background: transparent;
}

.support-history-list-body::-webkit-scrollbar-thumb,
.support-history-detail-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.support-history-list-body::-webkit-scrollbar-thumb:hover,
.support-history-detail-body::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* History cards */
.history-item-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item-card:hover {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
}

.history-card-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.history-card-preview {
    font-size: 0.82rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Detail history body */
.support-history-detail-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(5, 7, 5, 0.3);
}

.support-history-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 40px;
}

/* Inline Video Attachment Styles */
.support-message .message-video-wrapper {
    margin-bottom: 6px;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.support-message .message-video {
    width: 100%;
    max-height: 240px;
    display: block;
    object-fit: contain;
    background: #000;
}


