/* ========================================
   IMPROVED TICKET SYSTEM STYLING
   Modern, Mobile-First Design
   ======================================== */

/* Ticket List - Card Design */
.ticket-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ticket-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #3b82f6, #10b981);
}

.ticket-card.status-open::before {
    background: linear-gradient(to bottom, #10b981, #059669);
}

.ticket-card.status-closed::before {
    background: linear-gradient(to bottom, #6b7280, #4b5563);
}

.ticket-card.status-pending::before {
    background: linear-gradient(to bottom, #f59e0b, #d97706);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ticket-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.ticket-status-badge {
    padding: 0.375rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ticket-status-badge.status-open {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ticket-status-badge.status-closed {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.ticket-status-badge.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.ticket-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ticket-meta-item i {
    color: #3b82f6;
}

.ticket-preview {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ticket-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ticket-priority.high {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.ticket-priority.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.ticket-priority.low {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* ========================================
   TICKET CHAT VIEW - Message Bubbles
   ======================================== */

.ticket-conversation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    max-width: 100%;
}

.message-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-wrapper.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.message-avatar.user-avatar {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: 2px solid rgba(59, 130, 246, 0.3);
}

.message-avatar.admin-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-author {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-wrapper.user-message .message-author {
    color: #3b82f6;
    justify-content: flex-end;
}

.message-wrapper.admin-message .message-author {
    color: #10b981;
}

.admin-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-bubble {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
}

.message-wrapper.user-message .message-bubble {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.message-wrapper.admin-message .message-bubble {
    background: rgba(16, 185, 129, 0.15);
    color: #fff;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.message-wrapper.user-message .message-time {
    justify-content: flex-end;
}

/* Reply Box Improvements */
.ticket-reply-box {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 2rem;
    backdrop-filter: blur(10px);
}

.ticket-reply-box h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ticket-reply-box h3 i {
    color: #3b82f6;
}

.ticket-reply-textarea {
    width: 100%;
    min-height: 120px;
    background: rgba(15, 15, 30, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1rem;
    color: #fff;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.ticket-reply-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ticket-reply-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-send-reply {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-send-reply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-close-ticket {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-close-ticket:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ticket-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .ticket-title {
        font-size: 1rem;
    }

    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .message-content {
        max-width: 85%;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .message-bubble {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .ticket-reply-box {
        padding: 1rem;
    }

    .ticket-reply-textarea {
        min-height: 100px;
    }

    .ticket-reply-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-send-reply,
    .btn-close-ticket {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .ticket-conversation {
        padding: 0.75rem;
    }

    .message-content {
        max-width: 90%;
    }

    .ticket-card {
        margin-bottom: 0.75rem;
    }
}

/* Empty State */
.tickets-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: rgba(255, 255, 255, 0.6);
}

.tickets-empty-state i {
    font-size: 4rem;
    color: rgba(59, 130, 246, 0.3);
    margin-bottom: 1rem;
}

.tickets-empty-state h3 {
    color: #fff;
    margin-bottom: 0.5rem;
}

/* Loading State */
.ticket-skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 16px;
    height: 150px;
    margin-bottom: 1rem;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}
