/* Support Chat Popup Styles */

/* Header Support Button - Matches site .btn style (slanted with gradient) */
.header-support-btn {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #1a1d29;
    border: none;
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    /* Slanted shape - matches site buttons */
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    padding: 0 20px;
    height: 42px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gradient glow effect */
.header-support-btn::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;
    background: linear-gradient(180deg, 
        rgba(96, 165, 250, 0.12) 0%, 
        rgba(96, 165, 250, 0.03) 50%,
        rgba(96, 165, 250, 0.06) 100%);
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    z-index: 0;
    transition: all 0.3s ease;
}

/* Top inner glow */
.header-support-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(147, 197, 253, 0.2) 0%, 
        transparent 35%);
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    z-index: 0;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.header-support-btn:hover {
    background: #252a38;
    transform: translateY(-2px);
}

.header-support-btn:hover::before {
    background: linear-gradient(180deg, 
        rgba(96, 165, 250, 0.2) 0%, 
        rgba(96, 165, 250, 0.06) 50%,
        rgba(96, 165, 250, 0.12) 100%);
}

.header-support-btn:hover::after {
    opacity: 1;
}

.header-support-btn.active {
    background: #252a38;
}

.header-support-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    position: relative;
    z-index: 1;
}

/* Unread Badge */
.header-support-btn .unread-badge {
    position: absolute;
    top: -4px;
    right: 10px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    z-index: 2;
}

.header-support-btn .unread-badge:empty {
    display: none;
}

/* Chat Window - Uses site colors */
.support-chat-window {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 100px);
    background: #1a1d2e;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a2e42;
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

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

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

/* Chat Header */
.support-chat-header {
    background: #212538;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2a2e42;
}

.support-chat-header h4 {
    color: #fff;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.support-chat-header .back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #8b8fa3;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    transition: all 0.2s;
}

.support-chat-header .back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.support-chat-header .back-btn.visible {
    display: flex;
}

.support-chat-header .new-ticket-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #8b8fa3;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.support-chat-header .new-ticket-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Chat Body */
.support-chat-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background: #151829;
    display: flex;
    flex-direction: column;
}

.support-chat-body::-webkit-scrollbar {
    width: 6px;
}

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

.support-chat-body::-webkit-scrollbar-thumb {
    background: #2a2e42;
    border-radius: 3px;
}

/* Tickets List View */
.support-tickets-container {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.support-tickets-container.active {
    display: flex;
}

.support-tickets-list {
    padding: 12px;
    flex: 1;
}

.support-ticket-item {
    background: #1a1d2e;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #2a2e42;
}

.support-ticket-item:hover {
    background: #212538;
    border-color: #3a3e52;
}

.support-ticket-item.unread {
    border-left: 3px solid #e86376;
}

.support-ticket-item .ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.support-ticket-item .ticket-subject {
    color: #fff;
    font-weight: 500;
    font-size: 13px;
    flex: 1;
    margin-right: 10px;
}

.support-ticket-item .ticket-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.support-ticket-item .ticket-status.open { background: #28a745; color: white; }
.support-ticket-item .ticket-status.pending { background: #ffc645; color: #000; }
.support-ticket-item .ticket-status.in_progress { background: #17a2b8; color: white; }
.support-ticket-item .ticket-status.resolved { background: #6c757d; color: white; }
.support-ticket-item .ticket-status.closed { background: #dc3545; color: white; }

.support-ticket-item .ticket-preview {
    color: #8b8fa3;
    font-size: 12px;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.support-ticket-item .ticket-time {
    color: #6c7293;
    font-size: 11px;
}

/* Empty State */
.support-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #8b8fa3;
}

.support-empty-state svg {
    width: 50px;
    height: 50px;
    fill: #2a2e42;
    margin-bottom: 14px;
}

.support-empty-state h5 {
    color: #fff;
    margin-bottom: 6px;
    font-size: 14px;
}

.support-empty-state p {
    font-size: 13px;
    margin-bottom: 16px;
}

/* Messages View */
.support-messages-container {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.support-messages-container.active {
    display: flex;
}

.support-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

.support-message {
    display: flex;
    margin-bottom: 14px;
    animation: fadeIn 0.2s ease;
}

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

.support-message.user {
    flex-direction: row-reverse;
}

.support-message .message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin: 0 8px;
    flex-shrink: 0;
}

.support-message .message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.support-message.admin .message-bubble {
    background: #1a1d2e;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    border: 1px solid #2a2e42;
}

/* Alert/System messages (e.g., withdrawal on hold) */
.support-message.admin.alert-message .message-bubble {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #fca5a5;
}

.support-message.admin.alert-message .message-bubble strong {
    color: #ef4444;
}

.support-message.user .message-bubble {
    background: #4986f5;
    color: white;
    border-bottom-right-radius: 4px;
}

.support-message .message-time {
    font-size: 10px;
    color: #6c7293;
    margin-top: 4px;
    padding: 0 8px;
}

.support-message.user .message-time {
    text-align: right;
}

/* Chat Input */
.support-chat-input {
    padding: 14px;
    background: #1a1d2e;
    border-top: 1px solid #2a2e42;
}

.support-chat-input form {
    display: flex;
    gap: 8px;
}

.support-chat-input textarea {
    flex: 1;
    background: #151829;
    border: 1px solid #2a2e42;
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    resize: none;
    min-height: 40px;
    max-height: 80px;
    font-family: inherit;
}

.support-chat-input textarea:focus {
    outline: none;
    border-color: #4986f5;
}

.support-chat-input textarea::placeholder {
    color: #6c7293;
}

.support-chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #4986f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.support-chat-input button:hover {
    background: #5a96ff;
}

.support-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.support-chat-input button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* New Ticket Form */
.support-new-ticket-form {
    display: none;
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

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

.support-new-ticket-form .form-group {
    margin-bottom: 14px;
}

.support-new-ticket-form label {
    display: block;
    color: #8b8fa3;
    font-size: 12px;
    margin-bottom: 6px;
}

.support-new-ticket-form input,
.support-new-ticket-form select,
.support-new-ticket-form textarea {
    width: 100%;
    background: #151829;
    border: 1px solid #2a2e42;
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
}

.support-new-ticket-form input:focus,
.support-new-ticket-form select:focus,
.support-new-ticket-form textarea:focus {
    outline: none;
    border-color: #4986f5;
}

.support-new-ticket-form textarea {
    min-height: 80px;
    resize: vertical;
}

.support-new-ticket-form .submit-btn {
    width: 100%;
    padding: 12px;
    background: #4986f5;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.support-new-ticket-form .submit-btn:hover {
    background: #5a96ff;
}

.support-new-ticket-form .cancel-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid #2a2e42;
    border-radius: 8px;
    color: #8b8fa3;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

.support-new-ticket-form .cancel-btn:hover {
    background: #212538;
    color: #fff;
}

/* Loading State */
.support-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.support-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #2a2e42;
    border-top-color: #4986f5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Closed Ticket Notice */
.ticket-closed-notice {
    text-align: center;
    padding: 14px;
    background: #1a1d2e;
    color: #8b8fa3;
    font-size: 12px;
}

.ticket-closed-notice a {
    color: #4986f5;
    text-decoration: none;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .header-support-btn {
        padding: 0 16px;
        height: 36px;
        margin-left: 8px;
    }
    
    .header-support-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .header-support-btn {
        padding: 0 14px;
        height: 32px;
        margin-left: 6px;
    }
    
    .header-support-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .support-chat-window {
        top: 55px;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: calc(100vh - 55px);
        border-radius: 12px 12px 0 0;
    }
    
    .support-chat-header {
        padding: 14px 16px;
    }
    
    .support-message .message-bubble {
        max-width: 85%;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .support-chat-window {
        width: 340px;
        height: 460px;
    }
}
