/* NWT Conversation - Chat Style CSS */

/* Wrapper */
.nwt-conversation-wrapper {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

/* Conversation Header with Stats */
.nwt-conversation-header {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border-radius: 16px 16px 0 0;
    padding: 20px 24px;
    margin-bottom: 0;
}

.nwt-conversation-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.nwt-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.nwt-stat-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.nwt-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.nwt-stat-value small {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
    margin-left: 2px;
}

.nwt-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.nwt-stat-divider {
    width: 1px;
    height: 50px;
    background: rgba(255,255,255,0.2);
}

/* Reading Controls - Floating Top Right */
.nwt-reading-controls {
    position: fixed !important;
    top: 24px !important;
    right: 24px !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
}

.nwt-reading-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nwt-start-reading {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
}

.nwt-start-reading:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
}

.nwt-pause-reading {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
}

.nwt-pause-reading:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
}

.nwt-reading-icon {
    font-size: 12px;
}

.nwt-reading-progress {
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    white-space: nowrap;
}

/* Active message highlight during reading */
.nwt-message.nwt-reading-active .nwt-bubble {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.5), 0 4px 20px rgba(0,0,0,0.15);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* Container */
.nwt-conversation-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #e8e4f0 0%, #d4cce3 100%);
    border-radius: 0 0 16px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Standalone container (admin preview) */
.nwt-preview-container .nwt-conversation-container {
    border-radius: 12px;
}

/* Message Row */
.nwt-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 12px;
}

.nwt-message-left {
    justify-content: flex-start;
}

.nwt-message-right {
    justify-content: flex-end;
}

/* Avatar */
.nwt-avatar {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
}

.nwt-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nwt-avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nwt-avatar-placeholder.nwt-avatar-nwt {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Message Wrapper */
.nwt-message-wrapper {
    max-width: 70%;
    min-width: 280px;
}

/* Bubble Styles */
.nwt-bubble {
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    position: relative;
}

/* NWT Bubble (Right Side - Purple Gradient) */
.nwt-bubble-nwt {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.nwt-bubble-nwt .nwt-sender-name {
    color: #ffffff;
}

.nwt-bubble-nwt .nwt-sender-role {
    color: rgba(255,255,255,0.8);
}

.nwt-bubble-nwt .nwt-message-content {
    color: #ffffff;
}

.nwt-bubble-nwt .nwt-message-time {
    color: rgba(255,255,255,0.7);
}

/* Audience Bubble (Left Side - White) */
.nwt-bubble-audience {
    background: #ffffff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.nwt-bubble-audience .nwt-sender-name {
    color: #1f2937;
}

.nwt-bubble-audience .nwt-sender-role {
    color: #6b7280;
}

.nwt-bubble-audience .nwt-message-content {
    color: #374151;
}

.nwt-bubble-audience .nwt-message-time {
    color: #9ca3af;
}

/* Sender Info */
.nwt-sender-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.nwt-sender-info.nwt-sender-right {
    justify-content: flex-end;
}

.nwt-sender-name {
    font-weight: 600;
    font-size: 15px;
}

.nwt-sender-badge {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.nwt-sender-role {
    font-size: 12px;
    margin-bottom: 12px;
}

.nwt-bubble-nwt .nwt-sender-role {
    text-align: right;
}

/* Message Content */
.nwt-message-content {
    font-size: 14px;
    line-height: 1.6;
}

.nwt-message-content p {
    margin: 0 0 12px 0;
}

.nwt-message-content p:last-child {
    margin-bottom: 0;
}

.nwt-message-content ul,
.nwt-message-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.nwt-message-content li {
    margin-bottom: 8px;
}

/* Highlighted items (like Manual, Scheduled, Real-time) */
.nwt-message-content .nwt-highlight {
    background: rgba(0,0,0,0.2);
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    margin-right: 4px;
}

.nwt-bubble-audience .nwt-message-content .nwt-highlight {
    background: #e5e7eb;
}

/* Checkmark list */
.nwt-message-content .nwt-checklist {
    list-style: none;
    padding-left: 0;
}

.nwt-message-content .nwt-checklist li {
    position: relative;
    padding-left: 28px;
}

.nwt-message-content .nwt-checklist li::before {
    content: "✓";
    position: absolute;
    left: 0;
    width: 20px;
    height: 20px;
    background: rgba(34, 197, 94, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #22c55e;
}

.nwt-bubble-nwt .nwt-message-content .nwt-checklist li::before {
    background: rgba(255,255,255,0.2);
    color: #86efac;
}

/* Message Time */
.nwt-message-time {
    font-size: 11px;
    margin-top: 12px;
    text-align: right;
}

/* Images in messages - Thumbnails */
.nwt-message-content img {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    border-radius: 8px;
    margin: 8px 4px 8px 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.nwt-message-content img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.nwt-bubble-audience .nwt-message-content img {
    border-color: rgba(0,0,0,0.1);
}

/* Lightbox Overlay */
.nwt-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.nwt-lightbox.active {
    display: flex;
}

.nwt-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nwt-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

/* Lightbox Close Button */
.nwt-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    z-index: 1000000;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transition: background 0.2s;
}

.nwt-lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Lightbox Navigation */
.nwt-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    color: #fff;
    cursor: pointer;
    z-index: 1000000;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transition: background 0.2s;
    user-select: none;
}

.nwt-lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
}

.nwt-lightbox-prev {
    left: 30px;
}

.nwt-lightbox-next {
    right: 30px;
}

.nwt-lightbox-nav.disabled {
    opacity: 0.3;
    cursor: default;
}

.nwt-lightbox-nav.disabled:hover {
    background: rgba(255,255,255,0.1);
}

/* Lightbox Counter */
.nwt-lightbox-counter {
    color: #fff;
    font-size: 14px;
    margin-top: 20px;
    text-align: center;
}

/* Lightbox Caption */
.nwt-lightbox-caption {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
    max-width: 80%;
}

/* Links */
.nwt-bubble-nwt .nwt-message-content a {
    color: #c4b5fd;
    text-decoration: underline;
}

.nwt-bubble-audience .nwt-message-content a {
    color: #7c3aed;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .nwt-conversation-header {
        padding: 16px;
        border-radius: 12px 12px 0 0;
    }
    
    .nwt-conversation-stats {
        gap: 16px;
    }
    
    .nwt-stat-icon {
        font-size: 20px;
    }
    
    .nwt-stat-value {
        font-size: 20px;
    }
    
    .nwt-stat-label {
        font-size: 10px;
    }
    
    .nwt-stat-divider {
        height: 40px;
    }
    
    .nwt-conversation-container {
        padding: 12px;
        border-radius: 0 0 12px 12px;
    }
    
    .nwt-reading-controls {
        top: 16px;
        right: 16px;
        padding: 10px 16px;
        gap: 8px;
    }
    
    .nwt-reading-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .nwt-reading-progress {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .nwt-message-wrapper {
        max-width: 85%;
        min-width: auto;
    }
    
    .nwt-avatar {
        width: 36px;
        height: 36px;
    }
    
    .nwt-avatar img,
    .nwt-avatar-placeholder {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
    
    .nwt-bubble {
        padding: 12px 14px;
    }
}

/* Preview specific styles */
.nwt-preview-container .nwt-conversation-container {
    min-height: 400px;
    border-radius: 12px;
}

.nwt-preview-empty {
    text-align: center;
    color: #9ca3af;
    padding: 40px 20px;
    font-style: italic;
}
