/**
 * Ticket View Page Styles - SocialPowerHub
 * Modern WhatsApp-inspired ticket messaging interface
 * Last Updated: October 28, 2025
 */

/* Ticket Header Card - Modern Design */
.ticket-header-card {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: white;
}

.ticket-header-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    color: white;
}

.ticket-id-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ticket-subject {
    color: white;
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ticket-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9rem;
}

.meta-item i {
    opacity: 0.8;
    font-size: 0.875rem;
}

/* Status Badge - Modern with Dot */
.status-badge-container {
    display: flex;
    align-items: flex-start;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-badge.status-open .status-dot { background: #3b82f6; }
.status-badge.status-open { color: #3b82f6; }

.status-badge.status-in_progress .status-dot { background: #f59e0b; }
.status-badge.status-in_progress { color: #f59e0b; }

.status-badge.status-waiting_user .status-dot { background: #8b5cf6; }
.status-badge.status-waiting_user { color: #8b5cf6; }

.status-badge.status-waiting_admin .status-dot { background: #ec4899; }
.status-badge.status-waiting_admin { color: #ec4899; }

.status-badge.status-resolved .status-dot { background: #10b981; }
.status-badge.status-resolved { color: #10b981; }

.status-badge.status-closed .status-dot { background: #6b7280; }
.status-badge.status-closed { color: #6b7280; }

/* WhatsApp-Style Chat Background */
.chat-background {
    background: linear-gradient(to bottom, #e5ddd5 0%, #f0ebe5 100%);
    background-image:
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d9d9d9' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    min-height: 400px;
    padding: 0 !important;
}

.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Messages Container */
.messages-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

/* Custom Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Message Wrapper */
.message-wrapper {
    clear: both;
    animation: fadeInUp 0.3s ease-in;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Avatar Circle Small */
.avatar-circle-small {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Message Bubble Base */
.message-bubble {
    max-width: 65%;
    min-width: 120px;
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Admin Message Bubble - Left (Like WhatsApp Received) */
.admin-bubble {
    background: #ffffff;
    border-bottom-left-radius: 4px;
    border: 1px solid #e0e0e0;
}

.admin-bubble::before {
    content: '';
    position: absolute;
    left: -6px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #ffffff transparent transparent;
    filter: drop-shadow(-1px 1px 0px rgba(224, 224, 224, 0.5));
}

/* User Message Bubble - Right (Like WhatsApp Sent) */
.user-bubble {
    background: linear-gradient(135deg, #dcf8c6 0%, #d4f1c0 100%);
    border-bottom-right-radius: 4px;
    border: 1px solid #c8e6c9;
}

.user-bubble::after {
    content: '';
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 10px 10px;
    border-color: transparent transparent #dcf8c6 transparent;
    filter: drop-shadow(1px 1px 0px rgba(200, 230, 201, 0.5));
}

/* Message Text */
.message-text {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #303030;
    margin-bottom: 5px;
}

/* Message Time */
.message-time {
    font-size: 0.7rem;
    color: #667781;
    text-align: right;
    margin-top: 3px;
}

.admin-bubble .message-time {
    color: #999;
}

.user-bubble .message-time {
    color: #5a8f4a;
}

/* Left/Right Alignment */
.message-wrapper.left {
    float: left;
    clear: both;
    width: 100%;
}

.message-wrapper.right {
    float: right;
    clear: both;
    width: 100%;
}

/* Modern Reply Form */
.reply-form-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
}

.modern-reply-form {
    margin: 0;
}

.reply-form-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-input-wrapper {
    flex: 1;
}

.modern-textarea {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    resize: none;
    min-height: 60px;
}

.modern-textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    outline: none;
}

.modern-textarea::placeholder {
    color: #9ca3af;
}

.btn-send-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-send-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-send-message:active {
    transform: translateY(0);
}

.btn-send-message:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Ticket Closed Notice */
.ticket-closed-notice {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.closed-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.ticket-closed-notice h5 {
    color: #374151;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ticket-closed-notice p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.ticket-closed-notice .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Clearfix for message container */
.messages-container::after {
    content: "";
    display: table;
    clear: both;
}

/* Back Button - Modern Style */
.btn-back-modern {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-back-modern:hover {
    background: #f9fafb;
    border-color: #667eea;
    color: #667eea;
    transform: translateX(-4px);
    text-decoration: none;
}

.btn-back-modern i {
    transition: transform 0.3s ease;
}

.btn-back-modern:hover i {
    transform: translateX(-3px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 85%;
    }

    .avatar-circle-small {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .ticket-header-gradient {
        padding: 1.5rem;
    }

    .ticket-subject {
        font-size: 1.35rem;
    }

    .ticket-meta-info {
        flex-direction: column;
        gap: 0.75rem;
    }

    .reply-form-container {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-send-message {
        width: 100%;
        justify-content: center;
    }

    .status-badge-container {
        margin-top: 1rem;
    }
}

/* Toast Notification */
.custom-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
}

.custom-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.custom-toast i {
    font-size: 1.1rem;
}
