/* Messenger Review-Specific Styles for Human Agent Permission Application */

/* ==================== Review Instructions Panel ==================== */
.review-instructions {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #0084ff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.15);
}

.review-instructions.collapsed {
    padding: 1rem 1.5rem;
}

.review-instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.review-instructions-header h3 {
    margin: 0;
    color: #0084ff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-instructions-header .toggle-icon {
    color: #0084ff;
    transition: transform 0.3s;
}

.review-instructions.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.review-instructions-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.review-instructions.collapsed .review-instructions-content {
    display: none;
}

.review-instructions ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.review-instructions li {
    margin: 0.5rem 0;
    color: #495057;
    line-height: 1.6;
}

.review-instructions .note {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #856404;
}

/* ==================== Human Agent Badge ==================== */
.human-agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.human-agent-badge i {
    font-size: 0.85rem;
}

/* ==================== Header Enhancements ==================== */
.messenger-header-enhanced {
    position: relative;
    overflow: hidden;
}

.messenger-header-enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.messenger-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.messenger-header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* ==================== Status Badges ==================== */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.new {
    background: #dc3545;
    color: white;
}

.status-badge.replied {
    background: #28a745;
    color: white;
}

.status-badge.pending {
    background: #ffc107;
    color: #333;
}

/* ==================== Conversation Item Enhancements ==================== */
.conversation-item-enhanced {
    position: relative;
}

.conversation-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.conversation-item .name-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conversation-item .agent-icon {
    color: #28a745;
    font-size: 0.9rem;
}

.conversation-item .unread-count {
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* ==================== Message Enhancements ==================== */
.message-bubble-enhanced {
    position: relative;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

.message-sender-label {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.message-bubble.sent .message-sender-label {
    background: rgba(40, 167, 69, 0.2);
    color: #155724;
}

.message-bubble.received .message-sender-label {
    background: rgba(108, 117, 125, 0.2);
    color: #495057;
}

.message-status {
    font-size: 0.7rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.message-status i {
    font-size: 0.8rem;
}

.message-status.sent {
    color: #6c757d;
}

.message-status.delivered {
    color: #0084ff;
}

.message-status.read {
    color: #28a745;
}

/* ==================== Tooltips ==================== */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.custom-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.tooltip-wrapper:hover .custom-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ==================== Empty State Enhancements ==================== */
.empty-state-enhanced {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 3rem 2rem;
}

.empty-state-enhanced .icon-wrapper {
    background: white;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.empty-state-enhanced i {
    font-size: 2.5rem;
    color: #0084ff;
}

.empty-state-enhanced h3 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.empty-state-enhanced p {
    color: #6c757d;
    margin-bottom: 1rem;
}

.empty-state-enhanced .test-instructions {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: left;
}

.empty-state-enhanced .test-instructions h4 {
    margin: 0 0 0.75rem 0;
    color: #0084ff;
    font-size: 1rem;
}

.empty-state-enhanced .test-instructions ol {
    margin: 0;
    padding-left: 1.5rem;
}

.empty-state-enhanced .test-instructions li {
    margin: 0.5rem 0;
    color: #495057;
    font-size: 0.9rem;
}

/* ==================== Loading States ==================== */
.loading-enhanced {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.loading-enhanced .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0084ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-enhanced .loading-text {
    color: #6c757d;
    font-size: 0.95rem;
}

/* ==================== Action Buttons ==================== */
.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-button.primary {
    background: linear-gradient(135deg, #0084ff 0%, #0063cc 100%);
    color: white;
}

.action-button.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

/* ==================== Typing Indicator ==================== */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #e4e6eb;
    border-radius: 18px;
    max-width: 80px;
    margin-bottom: 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .review-instructions {
        padding: 1rem;
    }

    .messenger-header-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .messenger-main {
        flex-direction: column;
        height: auto;
    }

    .conversations-panel {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #f0f0f0;
        max-height: 300px;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .review-instructions {
        border: 2px solid #000;
        page-break-inside: avoid;
    }

    .messenger-controls {
        display: none;
    }

    .message-input-area {
        display: none;
    }
}

/* ==================== Accessibility ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
.conversation-item:focus,
.action-button:focus,
.message-input-area input:focus,
.message-input-area button:focus {
    outline: 3px solid #0084ff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .status-badge,
    .human-agent-badge {
        border: 2px solid currentColor;
    }
}

/* ==================== 24-Hour Rule Indicators ==================== */

/* Time badges for conversation list */
.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.time-badge.warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
}

.time-badge.normal {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.time-badge i {
    font-size: 0.8rem;
}

/* Human agent warning panel */
.human-agent-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
}

.human-agent-warning i {
    font-size: 1.5rem;
    color: #ff9800;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.human-agent-warning .warning-content {
    flex: 1;
}

.human-agent-warning strong {
    display: block;
    color: #e65100;
    margin-bottom: 0.3rem;
    font-size: 1rem;
}

.human-agent-warning p {
    margin: 0;
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Conditional message sender labels */
.message-sender-label.human-agent-required {
    background: rgba(255, 152, 0, 0.2);
    color: #e65100;
    border: 1px solid rgba(255, 152, 0, 0.4);
}

.message-sender-label.standard-reply {
    background: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.4);
}

/* 24h rule explanation in instructions */
.rule-explanation {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 4px;
}

.rule-explanation h4 {
    margin: 0 0 0.5rem 0;
    color: #1565c0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rule-explanation ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.rule-explanation li {
    margin: 0.3rem 0;
    color: #0d47a1;
    font-size: 0.85rem;
}

.rule-explanation code {
    background: rgba(33, 150, 243, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #1565c0;
}