/**
 * SD Chat — Styles
 * Conversation list + chat window, responsive, BEM
 */

/* ========================================
   Chat App Container
   ======================================== */
.sd-chat {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--sd-gray-100, #f5f5f5);
    min-height: calc(100vh - var(--sd-header-height, 60px) - 40px);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ========================================
   Conversation List View
   ======================================== */
.sd-chat__list-view {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sd-chat__list-header {
    padding: 20px 20px 12px;
    background: var(--sd-white, #fff);
    border-bottom: 1px solid var(--sd-gray-200, #eee);
}

.sd-chat__title {
    font-size: 24px;
    font-weight: 700;
    color: var(--sd-gray-800, #424242);
    margin: 0;
}

.sd-chat__conversations {
    flex: 1;
    overflow-y: auto;
}

/* ── Loading Spinner ── */
.sd-chat__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.sd-chat__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--sd-gray-200, #eee);
    border-top-color: var(--sd-primary, #ff4081);
    border-radius: 50%;
    animation: sd-chat-spin 0.8s linear infinite;
}

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

/* ── Empty State ── */
.sd-chat__empty {
    text-align: center;
    padding: 80px 40px;
    color: var(--sd-gray-500, #9e9e9e);
}

.sd-chat__empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
}

.sd-chat__empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--sd-gray-800, #424242);
    margin: 0 0 8px;
}

.sd-chat__empty p {
    font-size: 14px;
    margin: 0;
}

/* ── Conversation Item ── */
.sd-chat__conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--sd-white, #fff);
    border-bottom: 1px solid var(--sd-gray-200, #eee);
    cursor: pointer;
    transition: background 0.15s ease;
}

.sd-chat__conv-item:hover {
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-chat__conv-item--unread {
    background: #fff5f8;
}

.sd-chat__conv-item--unread:hover {
    background: #ffebf0;
}

/* ── Avatar ── */
.sd-chat__avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.sd-chat__avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--sd-gray-200, #eee);
}

.sd-chat__online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: #00c853;
    border: 2px solid var(--sd-white, #fff);
    border-radius: 50%;
}

.sd-chat__unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ff6d00;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Conversation Info ── */
.sd-chat__conv-info {
    flex: 1;
    min-width: 0;
}

.sd-chat__conv-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--sd-gray-800, #424242);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-chat__conv-preview {
    font-size: 13px;
    color: var(--sd-gray-500, #9e9e9e);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-chat__conv-item--unread .sd-chat__conv-preview {
    color: var(--sd-gray-800, #424242);
    font-weight: 500;
}

/* ── Time ── */
.sd-chat__conv-time {
    font-size: 12px;
    color: var(--sd-gray-500, #9e9e9e);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

/* ========================================
   Chat Window View
   ======================================== */
.sd-chat__window {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: calc(100vh - var(--sd-header-height, 60px) - 40px);
    background: var(--sd-gray-100, #f5f5f5);
}

/* ── Window Header ── */
.sd-chat__window-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--sd-white, #fff);
    border-bottom: 1px solid var(--sd-gray-200, #eee);
    min-height: 60px;
}

.sd-chat__back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--sd-gray-800, #424242);
    border-radius: 50%;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.sd-chat__back-btn:hover {
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-chat__partner-info {
    flex: 1;
    min-width: 0;
}

.sd-chat__partner-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--sd-primary, #ff4081);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-chat__partner-status {
    display: block;
    font-size: 12px;
    color: var(--sd-gray-500, #9e9e9e);
}

.sd-chat__partner-status--online {
    color: #00c853;
}

.sd-chat__partner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--sd-gray-200, #eee);
}

/* ── Messages Area ── */
.sd-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
}

/* ── Date Separator ── */
.sd-chat__date-sep {
    text-align: center;
    padding: 12px 0;
}

.sd-chat__date-sep span {
    background: var(--sd-gray-200, #eee);
    color: var(--sd-gray-500, #9e9e9e);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 14px;
    border-radius: 12px;
}

/* ── Message Bubble ── */
.sd-chat__msg {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: sd-chat-msg-in 0.2s ease-out;
}

@keyframes sd-chat-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sd-chat__msg--received {
    align-self: flex-start;
}

.sd-chat__msg--sent {
    align-self: flex-end;
}

.sd-chat__msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.sd-chat__msg--received .sd-chat__msg-bubble {
    background: var(--sd-white, #fff);
    color: var(--sd-gray-800, #424242);
    border-bottom-left-radius: 4px;
    border-left: 3px solid var(--sd-gray-200, #eee);
}

.sd-chat__msg--sent .sd-chat__msg-bubble {
    background: var(--sd-primary, #ff4081);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ── Image Message ── */
.sd-chat__msg-image {
    max-width: 240px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    min-height: 80px;
    background: var(--sd-gray-200, #eee);
}

.sd-chat__msg-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s;
    opacity: 0;
}

.sd-chat__msg-image--loaded img {
    opacity: 1;
}

.sd-chat__msg-image img:hover {
    opacity: 0.9;
}

/* Spinner inside image bubble while thumbnail loads from server */
.sd-chat__img-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid var(--sd-gray-200, #ddd);
    border-top-color: var(--sd-primary, #ff4081);
    border-radius: 50%;
    animation: sd-chat-spin 0.7s linear infinite;
    z-index: 1;
}

.sd-chat__msg-image--loaded .sd-chat__img-spinner {
    display: none;
}

/* Upload in progress: dark scrim + spinner + "Uploading..." label */
.sd-chat__msg-image--uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2;
}

.sd-chat__upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 3;
    pointer-events: none;
}

.sd-chat__upload-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sd-chat-spin 0.7s linear infinite;
}

.sd-chat__upload-label {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Progress bar at bottom of uploading image */
.sd-chat__upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--sd-primary, #ff4081);
    border-radius: 0 0 12px 12px;
    z-index: 4;
    animation: sd-chat-upload-bar 3s ease-out forwards;
}

@keyframes sd-chat-upload-bar {
    0%   { width: 0; }
    30%  { width: 40%; }
    60%  { width: 65%; }
    80%  { width: 80%; }
    100% { width: 92%; }
}

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

/* ── Gift Message ── */
.sd-chat__msg-gift {
    text-align: center;
    padding: 16px;
}

.sd-chat__msg-gift-emoji {
    font-size: 48px;
    display: block;
    margin-bottom: 6px;
}

.sd-chat__msg-gift-text {
    font-size: 13px;
    opacity: 0.8;
}

/* ── Message Meta ── */
.sd-chat__msg-time {
    font-size: 11px;
    color: var(--sd-gray-500, #9e9e9e);
    margin-top: 3px;
    padding: 0 4px;
}

.sd-chat__msg--sent .sd-chat__msg-time {
    text-align: right;
}

/* ── Read Receipt Ticks ── */
.sd-chat__msg-status {
    font-size: 12px;
    color: var(--sd-gray-500, #9e9e9e);
    margin-left: 4px;
    letter-spacing: -2px;
}

.sd-chat__msg-status--read {
    color: var(--sd-primary, #ff4081);
}

/* ── Pending/Failed Status ── */
.sd-chat__msg--pending .sd-chat__msg-bubble {
    opacity: 0.7;
}

.sd-chat__msg--failed .sd-chat__msg-bubble {
    opacity: 0.6;
    border: 1px dashed #f44336;
}

.sd-chat__msg-retry {
    font-size: 11px;
    color: #f44336;
    cursor: pointer;
    padding: 2px 4px;
    text-align: right;
}

.sd-chat__msg-retry:hover {
    text-decoration: underline;
}

/* ── Typing Indicator ── */
.sd-chat__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
}

.sd-chat__typing-text {
    font-size: 13px;
    color: var(--sd-gray-500, #9e9e9e);
    font-style: italic;
}

.sd-chat__typing-dots {
    display: flex;
    align-items: center;
    gap: 3px;
}

.sd-chat__typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--sd-gray-500, #9e9e9e);
    border-radius: 50%;
    animation: sd-chat-typing-dot 1.4s infinite both;
}

.sd-chat__typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.sd-chat__typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes sd-chat-typing-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ── Input Bar ── */
.sd-chat__input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--sd-white, #fff);
    border-top: 1px solid var(--sd-gray-200, #eee);
}

.sd-chat__input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--sd-gray-500, #9e9e9e);
    border-radius: 50%;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sd-chat__input-icon:hover {
    background: var(--sd-gray-100, #f5f5f5);
    color: var(--sd-primary, #ff4081);
}

.sd-chat__input {
    flex: 1;
    border: 1px solid var(--sd-gray-200, #eee);
    border-radius: 20px;
    padding: 9px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--sd-gray-100, #f5f5f5);
    min-width: 0;
}

.sd-chat__input:focus {
    border-color: var(--sd-primary, #ff4081);
    background: var(--sd-white, #fff);
}

.sd-chat__send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--sd-primary, #ff4081);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sd-chat__send-btn:hover {
    background: var(--sd-primary-dark, #c51162);
    transform: scale(1.05);
}

.sd-chat__send-btn:active {
    transform: scale(0.95);
}

.sd-chat__send-btn--disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* ── Load More (older messages) ── */
.sd-chat__load-more {
    text-align: center;
    padding: 8px;
}

.sd-chat__load-more-btn {
    background: none;
    border: none;
    color: var(--sd-primary, #ff4081);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 16px;
    transition: background 0.15s;
}

.sd-chat__load-more-btn:hover {
    background: rgba(255, 64, 129, 0.08);
}

/* ========================================
   Responsive — Desktop (>1024px)
   ======================================== */
@media (min-width: 1025px) {
    .sd-chat {
        max-width: 600px;
        border-radius: var(--sd-radius-lg, 16px);
        overflow: hidden;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
        min-height: auto;
        height: calc(100vh - var(--sd-header-height, 60px) - 80px);
    }

    .sd-chat__window {
        min-height: auto;
        height: 100%;
    }

    .sd-chat__messages {
        flex: 1;
        min-height: 0;
    }
}

/* ========================================
   Responsive — Tablet (769-1024px)
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .sd-chat {
        max-width: 100%;
        border-radius: 0;
    }
}

/* ========================================
   Responsive — Mobile (<769px)
   ======================================== */
@media (max-width: 768px) {
    .sd-chat {
        max-width: 100%;
        min-height: calc(100vh - var(--sd-header-height, 60px) - var(--sd-mobile-nav-height, 56px));
        border-radius: 0;
    }

    .sd-chat__window {
        position: fixed;
        top: var(--sd-header-height, 60px);
        left: 0;
        right: 0;
        bottom: var(--sd-mobile-nav-height, 56px);
        z-index: 999;
        min-height: auto;
        background: var(--sd-gray-100, #f5f5f5);
    }

    .sd-chat__window-header {
        padding-top: 12px;
    }

    .sd-chat__input-bar {
        padding-bottom: 10px;
    }

    .sd-chat__msg {
        max-width: 85%;
    }

    .sd-chat__list-header {
        padding-top: 12px;
    }
}

/* ========================================
   Context Menu (Delete Message)
   ======================================== */
.sd-chat__context-menu {
    background: var(--sd-white, #fff);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    min-width: 160px;
    overflow: hidden;
    animation: sd-chat-ctx-in 0.15s ease-out;
}

@keyframes sd-chat-ctx-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.sd-chat__context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--sd-gray-800, #424242);
    transition: background 0.15s;
}

.sd-chat__context-menu-item:hover {
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-chat__context-menu-item--delete {
    color: #f44336;
}

.sd-chat__context-menu-item--delete:hover {
    background: #fff5f5;
}

.sd-chat__context-menu-item svg {
    flex-shrink: 0;
}

/* ========================================
   Image Lightbox
   ======================================== */
.sd-chat__lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: sd-chat-lightbox-in 0.2s ease-out;
}

@keyframes sd-chat-lightbox-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sd-chat__lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
    opacity: 0;
    transition: opacity 0.2s;
}

.sd-chat__lightbox--loaded .sd-chat__lightbox-img {
    opacity: 1;
}

/* Lightbox spinner — visible until image loads */
.sd-chat__lightbox-spinner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sd-chat-spin 0.7s linear infinite;
}

.sd-chat__lightbox--loaded .sd-chat__lightbox-spinner {
    display: none;
}

.sd-chat__lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: #fff;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.sd-chat__lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ========================================
   Translate Button & Ribbon
   ======================================== */

/* ── Translate button in header ── */
.sd-chat__translate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--sd-gray-500, #9e9e9e);
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.sd-chat__translate-btn:hover {
    background: var(--sd-gray-100, #f5f5f5);
    color: var(--sd-gray-800, #424242);
}

.sd-chat__translate-btn--active {
    color: var(--sd-primary, #ff4081);
    background: rgba(255, 64, 129, 0.08);
}

.sd-chat__translate-btn--active:hover {
    background: rgba(255, 64, 129, 0.15);
}

.sd-chat__translate-btn--loading {
    animation: sd-chat-translate-pulse 1s infinite;
}

@keyframes sd-chat-translate-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ── Translated indicator inside bubble ── */
.sd-chat__msg-translated {
    display: block;
    font-size: 10px;
    color: var(--sd-gray-500, #9e9e9e);
    margin-top: 4px;
    font-style: italic;
    opacity: 0.8;
}

.sd-chat__msg--sent .sd-chat__msg-translated {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Different language ribbon ── */
.sd-chat__lang-ribbon {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(90deg, #fff0f3 0%, #ffe8ec 100%);
    border-top: 1px solid rgba(255, 64, 129, 0.15);
    font-size: 12px;
    color: var(--sd-primary-dark, #c51162);
}

.sd-chat__lang-ribbon-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sd-chat__lang-ribbon-icon svg {
    color: var(--sd-primary, #ff4081);
}

.sd-chat__lang-ribbon-text {
    line-height: 1.3;
}

/* ========================================
   Profile Detail View (inline)
   ======================================== */
.sd-chat .sd-profile-detail {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    background: var(--sd-white, #fff);
    border-radius: var(--sd-radius-xl, 20px);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.sd-profile-detail--entering {
    animation: sd-chat-slide-up 0.3s ease-out;
}

@keyframes sd-chat-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.sd-profile-detail__close-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sd-profile-detail__close-btn:hover {
    background: rgba(0, 0, 0, 0.65);
}

.sd-profile-detail__hero {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
}

.sd-profile-detail__hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.sd-profile-detail__hero-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.4));
    pointer-events: none;
}

.sd-profile-detail__info {
    padding: 20px;
    position: relative;
}

.sd-profile-detail__name {
    font-size: 26px;
    font-weight: 700;
    color: var(--sd-gray-800, #424242);
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sd-profile-detail__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--sd-primary, #ff4081);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 14px;
}

.sd-profile-detail__location {
    font-size: 14px;
    color: var(--sd-gray-500, #9e9e9e);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sd-profile-detail__menu-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--sd-gray-200, #eee);
    background: var(--sd-white, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 18px;
    color: var(--sd-gray-500, #9e9e9e);
}

.sd-profile-detail__menu-btn:hover {
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-profile-detail__section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--sd-gray-800, #424242);
    margin: 20px 0 8px;
    padding: 0 20px;
}

.sd-profile-detail__bio {
    font-size: 14px;
    line-height: 1.6;
    color: var(--sd-gray-800, #424242);
    margin: 0;
    padding: 0 20px 12px;
}

.sd-profile-detail__photos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 0 20px 12px;
}

.sd-profile-detail__photo-item {
    aspect-ratio: 1;
    border-radius: var(--sd-radius-sm, 8px);
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.sd-profile-detail__photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.sd-profile-detail__photo-item:hover img {
    transform: scale(1.05);
}

.sd-profile-detail__lock-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.7), rgba(156, 39, 176, 0.7));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sd-radius-sm, 8px);
}

.sd-profile-detail__lock-overlay svg {
    width: 28px;
    height: 28px;
    color: #fff;
    opacity: 0.9;
}

.sd-profile-detail__back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 40px);
    margin: 12px 20px 20px;
    height: 50px;
    border: none;
    border-radius: var(--sd-radius-lg, 16px);
    background: linear-gradient(135deg, #ff4081, #f50057);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sd-profile-detail__back-btn:hover {
    box-shadow: 0 4px 20px rgba(255, 64, 129, 0.4);
    transform: translateY(-1px);
}

/* Desktop profile detail */
@media (min-width: 1025px) {
    .sd-chat .sd-profile-detail {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--sd-gray-200, #eee) transparent;
    }

    .sd-chat .sd-profile-detail::-webkit-scrollbar {
        width: 6px;
    }

    .sd-chat .sd-profile-detail::-webkit-scrollbar-thumb {
        background: var(--sd-gray-200, #eee);
        border-radius: 3px;
    }
}

/* Mobile profile detail */
@media (max-width: 768px) {
    .sd-chat .sd-profile-detail {
        position: fixed;
        inset: 0;
        z-index: 1000;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sd-profile-detail__photos-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sd-profile-detail__back-btn {
        position: sticky;
        bottom: 0;
        margin: 0;
        width: 100%;
        border-radius: 0;
        height: 56px;
        flex-shrink: 0;
    }
}

/* ── Action Sheet (Report / Block) ── */
.sd-action-sheet {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: sd-chat-fade-in 0.2s ease;
}

@keyframes sd-chat-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sd-action-sheet__menu {
    background: var(--sd-white, #fff);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation: sd-chat-sheet-up 0.3s ease-out;
}

@keyframes sd-chat-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.sd-action-sheet__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    font-size: 16px;
    color: var(--sd-gray-800, #424242);
    cursor: pointer;
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sd-action-sheet__item:hover {
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-action-sheet__divider {
    height: 6px;
    background: var(--sd-gray-100, #f5f5f5);
}

.sd-action-sheet__cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--sd-gray-500, #9e9e9e);
    cursor: pointer;
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
}

.sd-action-sheet__cancel:hover {
    background: var(--sd-gray-100, #f5f5f5);
}

@media (min-width: 1025px) {
    .sd-action-sheet {
        align-items: center;
        justify-content: center;
    }

    .sd-action-sheet__menu {
        border-radius: var(--sd-radius-lg, 16px);
        max-width: 320px;
        animation: sd-chat-fade-scale-in 0.2s ease-out;
    }

    @keyframes sd-chat-fade-scale-in {
        from { transform: scale(0.95); opacity: 0; }
        to   { transform: scale(1); opacity: 1; }
    }
}

/* ── Profile Photo Lightbox ── */
.sd-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sd-lightbox--visible {
    opacity: 1;
}

.sd-lightbox__img {
    max-width: calc(100% - 120px);
    max-height: calc(100% - 100px);
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}

.sd-lightbox__header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    z-index: 2;
}

.sd-lightbox__counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
}

.sd-lightbox__close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sd-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sd-lightbox__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.sd-lightbox__arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.sd-lightbox__prev { left: 16px; }
.sd-lightbox__next { right: 16px; }

@media (max-width: 768px) {
    .sd-lightbox__img {
        max-width: 100%;
        max-height: calc(100% - 80px);
        border-radius: 0;
    }
    .sd-lightbox__arrow {
        width: 36px;
        height: 36px;
    }
    .sd-lightbox__prev { left: 8px; }
    .sd-lightbox__next { right: 8px; }
}

/* ========================================
   Remove WP Theme Interference
   ======================================== */
.sd-page .sd-chat a {
    text-decoration: none;
    color: inherit;
}

.sd-page .sd-chat ul,
.sd-page .sd-chat ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sd-page .sd-chat input {
    box-shadow: none;
}
