/**
 * Katika Escrow - Dispute Chat Styles
 * 
 * Styles for the three-party dispute chat interface.
 * 
 * @package KatikaEscrow
 */

/* ==================== Chat Container ==================== */

.ke-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    max-height: 70vh;
    background: var(--wma-bg-primary, #1a1a2e);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
}

.ke-chat-container.ke-chat-fullscreen {
    height: calc(100vh - 200px);
    max-height: none;
}

/* ==================== Chat Header ==================== */

#ke-chat-header {
    padding: 16px;
    background: var(--wma-bg-secondary, #16213e);
    border-bottom: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
}

.ke-chat-service-info h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: var(--wma-text-primary, #ffffff);
}

.ke-chat-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.ke-participant {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--wma-text-secondary, #a0a0a0);
}

.ke-participant i {
    font-size: 0.9rem;
}

.ke-participant-client i {
    color: var(--wma-primary, #e94560);
}

.ke-participant-provider i {
    color: var(--wma-secondary, #0f3460);
}

.ke-chat-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ke-status-disputed {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.ke-status-provider_confirmed {
    background: rgba(33, 150, 243, 0.2);
    color: #2196f3;
}

.ke-status-auto_settled {
    background: rgba(156, 39, 176, 0.2);
    color: #9c27b0;
}

.ke-chat-dispute-reason {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--wma-text-secondary, #a0a0a0);
}

.ke-chat-dispute-reason strong {
    color: #ffc107;
}

/* ==================== Messages Container ==================== */

#ke-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#ke-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#ke-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ke-chat-messages::-webkit-scrollbar-thumb {
    background: var(--wma-border, rgba(255, 255, 255, 0.2));
    border-radius: 3px;
}

/* ==================== Message Bubbles ==================== */

.ke-chat-message {
    display: flex;
    gap: 10px;
    max-width: 80%;
}

.ke-chat-message.ke-msg-own {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.ke-chat-message.ke-msg-other {
    align-self: flex-start;
}

.ke-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.ke-sender-client .ke-msg-avatar {
    background: rgba(233, 69, 96, 0.2);
    color: var(--wma-primary, #e94560);
}

.ke-sender-provider .ke-msg-avatar {
    background: rgba(15, 52, 96, 0.4);
    color: #4fc3f7;
}

.ke-sender-admin .ke-msg-avatar {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.ke-msg-bubble {
    background: var(--wma-bg-secondary, #16213e);
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
}

.ke-msg-own .ke-msg-bubble {
    background: var(--wma-primary, #e94560);
    border-color: transparent;
}

.ke-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.ke-msg-sender {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--wma-text-primary, #ffffff);
}

.ke-msg-role {
    font-size: 0.75rem;
    color: var(--wma-text-secondary, #a0a0a0);
}

.ke-msg-own .ke-msg-role {
    color: rgba(255, 255, 255, 0.7);
}

.ke-msg-content {
    color: var(--wma-text-primary, #ffffff);
    font-size: 0.95rem;
    line-height: 1.4;
}

.ke-msg-content p {
    margin: 0;
}

.ke-msg-content p + p {
    margin-top: 8px;
}

.ke-msg-time {
    font-size: 0.7rem;
    color: var(--wma-text-secondary, #a0a0a0);
    margin-top: 4px;
    text-align: right;
}

.ke-msg-own .ke-msg-time {
    color: rgba(255, 255, 255, 0.6);
}


/* ==================== Attachments ==================== */

.ke-chat-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    margin-bottom: 8px;
}

.ke-chat-image:hover {
    transform: scale(1.02);
}

.ke-chat-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    color: var(--wma-text-primary, #ffffff);
    text-decoration: none;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.ke-chat-file:hover {
    background: rgba(0, 0, 0, 0.3);
    color: var(--wma-text-primary, #ffffff);
}

.ke-chat-file i {
    font-size: 1.5rem;
    color: var(--wma-primary, #e94560);
}

.ke-chat-file span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
}

/* ==================== Chat Form ==================== */

#ke-chat-form {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: var(--wma-bg-secondary, #16213e);
    border-top: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
}

#ke-chat-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--wma-bg-primary, #1a1a2e);
    border: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    color: var(--wma-text-primary, #ffffff);
    font-size: 0.95rem;
    resize: none;
    min-height: 40px;
    max-height: 100px;
}

#ke-chat-input:focus {
    outline: none;
    border-color: var(--wma-primary, #e94560);
}

#ke-chat-input::placeholder {
    color: var(--wma-text-secondary, #a0a0a0);
}

.ke-chat-actions {
    display: flex;
    gap: 8px;
}

#ke-chat-attach-btn,
#ke-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#ke-chat-attach-btn {
    background: var(--wma-bg-primary, #1a1a2e);
    color: var(--wma-text-secondary, #a0a0a0);
    border: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
}

#ke-chat-attach-btn:hover {
    background: var(--wma-border, rgba(255, 255, 255, 0.1));
    color: var(--wma-text-primary, #ffffff);
}

#ke-chat-send-btn {
    background: var(--wma-primary, #e94560);
    color: #ffffff;
}

#ke-chat-send-btn:hover {
    background: var(--wma-primary-dark, #d63850);
}

#ke-chat-send-btn:disabled,
#ke-chat-attach-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#ke-chat-file-input {
    display: none;
}

/* ==================== Upload Progress ==================== */

.ke-upload-progress {
    padding: 8px 16px;
    background: var(--wma-bg-secondary, #16213e);
    border-top: 1px solid var(--wma-border, rgba(255, 255, 255, 0.1));
}

.ke-upload-bar {
    height: 4px;
    background: var(--wma-bg-primary, #1a1a2e);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.ke-upload-fill {
    height: 100%;
    background: var(--wma-primary, #e94560);
    transition: width 0.2s;
}

.ke-upload-text {
    font-size: 0.75rem;
    color: var(--wma-text-secondary, #a0a0a0);
}

/* ==================== Empty & Loading States ==================== */

.ke-chat-empty,
.ke-chat-loading,
.ke-chat-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--wma-text-secondary, #a0a0a0);
    padding: 40px;
}

.ke-chat-empty i,
.ke-chat-loading i,
.ke-chat-error i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ke-chat-error i {
    color: var(--wma-primary, #e94560);
}

.ke-chat-empty p,
.ke-chat-loading p,
.ke-chat-error p {
    margin: 0 0 16px 0;
}

/* ==================== Lightbox ==================== */

.ke-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.ke-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ke-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.ke-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== Toast ==================== */

.ke-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.9rem;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s;
}

.ke-toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.ke-toast-info {
    background: #2196f3;
}

.ke-toast-success {
    background: #4caf50;
}

.ke-toast-error {
    background: var(--wma-primary, #e94560);
}

.ke-toast-warning {
    background: #ff9800;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .ke-chat-container {
        height: calc(100vh - 150px);
        border-radius: 0;
    }

    .ke-chat-message {
        max-width: 90%;
    }

    .ke-chat-participants {
        flex-direction: column;
        gap: 6px;
    }

    #ke-chat-form {
        padding: 10px;
    }

    #ke-chat-input {
        padding: 8px 12px;
    }
}
