/* ============================================================
   Contact Admin Floating Widget
   Premium glassmorphism design with smooth animations
   ============================================================ */

/* ── Floating Action Button ── */
.contact-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(139, 92, 246, 0.45), 0 0 0 0 rgba(139, 92, 246, 0.4);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: contact-fab-pulse 2.5s infinite;
}

.contact-fab:hover {
    transform: scale(1.12) rotate(8deg);
    box-shadow: 0 6px 32px rgba(139, 92, 246, 0.6);
}

.contact-fab.active {
    transform: rotate(45deg);
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    animation: none;
}

@keyframes contact-fab-pulse {

    0%,
    100% {
        box-shadow: 0 4px 24px rgba(139, 92, 246, 0.45), 0 0 0 0 rgba(139, 92, 246, 0.4);
    }

    50% {
        box-shadow: 0 4px 24px rgba(139, 92, 246, 0.45), 0 0 0 12px rgba(139, 92, 246, 0);
    }
}

/* ── Badge (notification count) ── */
.contact-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #09090f;
    display: none;
}

/* ── Popup Container ── */
.contact-popup {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    width: 360px;
    max-height: 600px;
    background: rgba(24, 24, 42, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.1);
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.contact-popup.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ── Header ── */
.contact-popup-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 14px;
}

.contact-popup-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
}

.contact-popup-header-info h3 {
    color: #ededf2;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.contact-popup-header-info p {
    color: #8585a0;
    font-size: 12px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact-popup-header-info p .online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    animation: online-blink 2s infinite;
}

@keyframes online-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── Body ── */
.contact-popup-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
}

/* ── Social Buttons ── */
.contact-social-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.contact-social-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.contact-social-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 14px;
}

.contact-social-btn:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.12);
}

.contact-social-btn:hover::before {
    opacity: 1;
}

.contact-social-btn.facebook::before {
    background: linear-gradient(135deg, rgba(24, 119, 242, 0.15), rgba(24, 119, 242, 0.05));
}

.contact-social-btn.line::before {
    background: linear-gradient(135deg, rgba(6, 199, 85, 0.15), rgba(6, 199, 85, 0.05));
}

.contact-social-btn.telegram::before {
    background: linear-gradient(135deg, rgba(38, 165, 229, 0.15), rgba(38, 165, 229, 0.05));
}

.contact-social-btn:hover.facebook {
    border-color: rgba(24, 119, 242, 0.4);
    box-shadow: 0 4px 20px rgba(24, 119, 242, 0.2);
}

.contact-social-btn:hover.line {
    border-color: rgba(6, 199, 85, 0.4);
    box-shadow: 0 4px 20px rgba(6, 199, 85, 0.2);
}

.contact-social-btn:hover.telegram {
    border-color: rgba(38, 165, 229, 0.4);
    box-shadow: 0 4px 20px rgba(38, 165, 229, 0.2);
}

.contact-social-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    z-index: 1;
}

.contact-social-btn.facebook .contact-social-icon {
    background: rgba(24, 119, 242, 0.15);
    color: #1877f2;
}

.contact-social-btn.line .contact-social-icon {
    background: rgba(6, 199, 85, 0.15);
    color: #06c755;
}

.contact-social-btn.telegram .contact-social-icon {
    background: rgba(38, 165, 229, 0.15);
    color: #26a5e4;
}

.contact-social-label {
    font-size: 12px;
    font-weight: 600;
    color: #8585a0;
    position: relative;
    z-index: 1;
    transition: color 0.25s ease;
}

.contact-social-btn:hover .contact-social-label {
    color: #ededf2;
}

/* ── Divider ── */
.contact-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: #50506a;
    font-size: 12px;
    font-weight: 500;
}

.contact-divider::before,
.contact-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

/* ── Feedback Form ── */
.contact-feedback-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-feedback-form textarea {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 13, 22, 0.8);
    color: #ededf2;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.25s ease;
    outline: none;
}

.contact-feedback-form textarea::placeholder {
    color: #50506a;
}

.contact-feedback-form textarea:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.contact-feedback-type {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.contact-type-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: #8585a0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.contact-type-chip:hover {
    border-color: rgba(139, 92, 246, 0.4);
    color: #ededf2;
}

.contact-type-chip.selected {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.1));
    border-color: rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}

.contact-send-btn {
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.contact-send-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.contact-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.contact-send-btn .spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Success Message ── */
.contact-success {
    text-align: center;
    padding: 24px 16px;
    animation: contact-success-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-success-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.contact-success h4 {
    color: #10b981;
    font-size: 16px;
    margin-bottom: 6px;
}

.contact-success p {
    color: #8585a0;
    font-size: 13px;
    line-height: 1.5;
}

@keyframes contact-success-in {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Footer ── */
.contact-popup-footer {
    padding: 12px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    text-align: center;
}

.contact-popup-footer span {
    font-size: 11px;
    color: #50506a;
}

/* ── Tabs ── */
.contact-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.contact-tab {
    flex: 1;
    padding: 12px 0;
    border: none;
    background: transparent;
    color: #50506a;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.contact-tab:hover {
    color: #8585a0;
    background: rgba(255, 255, 255, 0.02);
}

.contact-tab.active {
    color: #a78bfa;
}

.contact-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    border-radius: 2px;
}

.contact-inbox-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 18px;
    text-align: center;
}

/* ── Inbox List ── */
.contact-inbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.contact-inbox-list::-webkit-scrollbar {
    width: 4px;
}

.contact-inbox-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

.contact-inbox-empty {
    text-align: center;
    padding: 40px 16px;
    color: #50506a;
}

.contact-inbox-empty span {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.contact-inbox-empty p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

.contact-inbox-loading {
    text-align: center;
    padding: 40px;
    color: #8585a0;
    font-size: 14px;
}

/* ── Inbox Item ── */
.contact-inbox-item {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
}

.contact-inbox-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.15);
}

.contact-inbox-item.unread {
    background: rgba(139, 92, 246, 0.06);
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.08);
}

.contact-inbox-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
}

.contact-inbox-type {
    font-size: 14px;
}

.contact-inbox-time {
    color: #50506a;
    font-size: 11px;
}

.contact-inbox-new {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    animation: inbox-new-pulse 1.5s infinite;
}

@keyframes inbox-new-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.contact-inbox-replied {
    color: #10b981;
    font-size: 10px;
    font-weight: 600;
    margin-left: auto;
}

.contact-inbox-pending {
    color: #50506a;
    font-size: 10px;
    font-weight: 500;
    margin-left: auto;
}

.contact-inbox-msg {
    color: #8585a0;
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Inbox Detail (chat bubbles) ── */
.contact-inbox-detail {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: inbox-detail-in 0.3s ease;
}

@keyframes inbox-detail-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contact-inbox-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 95%;
}

.contact-inbox-bubble.user-bubble {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.15);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.contact-inbox-bubble.admin-bubble {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.bubble-label {
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 4px;
}

.user-bubble .bubble-label {
    color: #a78bfa;
}

.admin-bubble .bubble-label {
    color: #34d399;
}

.bubble-text {
    color: #d4d4e0;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.bubble-time {
    font-size: 10px;
    color: #50506a;
    margin-top: 4px;
    text-align: right;
}

.contact-inbox-waiting {
    text-align: center;
    padding: 12px;
    color: #50506a;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.06);
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    .contact-popup {
        right: 12px;
        left: 12px;
        bottom: 90px;
        width: auto;
        max-height: 70vh;
    }

    .contact-fab {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
        font-size: 22px;
    }
}