/**
 * Developer: amirhossinbanavand
 * Website: banclub.ir
 */

.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.chat-header {
    padding: 15px 25px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--secondary-purple));
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.chat-details {
    display: flex;
    flex-direction: column;
}

.chat-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-main);
}

.chat-status {
    font-size: 12px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.btn-back {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px 15px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-back svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(142, 45, 226, 0.3);
    border-radius: 10px;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row.admin {
    justify-content: flex-start;
}

.message-row.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-bubble:active {
    transform: scale(0.98);
}

.message-row.admin .message-bubble {
    background: linear-gradient(135deg, var(--secondary-purple), var(--primary-purple));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.2);
}

.message-row.user .message-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.message-reply-box {
    background: rgba(0, 0, 0, 0.2);
    border-right: 3px solid white;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.message-row.user .message-reply-box {
    border-right-color: var(--primary-purple);
}

.message-audio audio {
    height: 35px;
    outline: none;
    max-width: 200px;
}

.message-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    align-self: flex-end;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-row.user .message-meta {
    color: var(--text-muted);
}

.reply-preview-area {
    display: none;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    align-items: center;
    justify-content: space-between;
}

.reply-preview-area.active {
    display: flex;
}

.reply-content {
    border-right: 3px solid var(--primary-purple);
    padding-right: 10px;
    display: flex;
    flex-direction: column;
}

.reply-title {
    font-size: 12px;
    color: var(--primary-purple);
    font-weight: bold;
}

.reply-text {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.close-reply {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.close-reply svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.chat-footer {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    z-index: 10;
}

.chat-input-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 5px 15px;
    transition: all 0.3s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(142, 45, 226, 0.1);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 10px 0;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 24px;
    outline: none;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.action-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.btn-send {
    background: linear-gradient(45deg, var(--primary-purple), var(--secondary-purple));
    color: white;
    box-shadow: 0 4px 10px rgba(142, 45, 226, 0.3);
}

.btn-send:hover {
    background: linear-gradient(45deg, var(--secondary-purple), var(--primary-purple));
    color: white;
    transform: scale(1.05);
}

.recording-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    color: var(--danger);
    font-size: 14px;
    flex: 1;
    padding: 10px 0;
}

.recording-indicator.active {
    display: flex;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 75, 75, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0); }
}