/* ==================== ADMIN TICKETS CSS - DESIGN MODERNE ==================== */

.tickets-admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-card.stat-open { border-left: 4px solid #f59e0b; }
.stat-card.stat-progress { border-left: 4px solid #3b82f6; }
.stat-card.stat-resolved { border-left: 4px solid #22c55e; }
.stat-card.stat-closed { border-left: 4px solid #6b7280; }
.stat-card.stat-total { border-left: 4px solid #8b5cf6; }

.stat-icon {
    font-size: 2rem;
    opacity: 0.7;
}

.stat-card.stat-open .stat-icon { color: #f59e0b; }
.stat-card.stat-progress .stat-icon { color: #3b82f6; }
.stat-card.stat-resolved .stat-icon { color: #22c55e; }
.stat-card.stat-closed .stat-icon { color: #6b7280; }
.stat-card.stat-total .stat-icon { color: #8b5cf6; }

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Liste des tickets admin */
.tickets-admin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-ticket-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.admin-ticket-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
    transform: translateX(3px);
}

.admin-ticket-card.open { border-left-color: #f59e0b; }
.admin-ticket-card.in_progress { border-left-color: #3b82f6; }
.admin-ticket-card.resolved { border-left-color: #22c55e; }
.admin-ticket-card.closed {
    border-left-color: #6b7280;
    opacity: 0.7;
}

.admin-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-ticket-info {
    flex: 1;
}

.admin-ticket-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.admin-ticket-title strong {
    color: var(--primary);
}

.admin-ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.admin-ticket-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.admin-ticket-priority {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.admin-ticket-priority.priority-low {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.admin-ticket-priority.priority-normal {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.admin-ticket-priority.priority-high {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.admin-ticket-priority.priority-urgent {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ==================== MODAL TICKET - DESIGN MODERNE ==================== */

/* Style de base pour TOUS les modals */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(10px);
    display: none;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
    overflow-y: auto !important;
}

.modal[style*="display: flex"],
.modal[style*="display:flex"] {
    display: flex !important;
}

/* Empêcher le scroll du body quand un modal est ouvert */
body.modal-open {
    overflow: hidden !important;
}

/* S'assurer que le modal est au-dessus de tout */
.modal * {
    pointer-events: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.admin-ticket-modal {
    z-index: 10000 !important;
}

.admin-ticket-modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    max-width: 1000px;
    width: 95%;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.admin-ticket-modal-content .modal-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    color: white;
    padding: 30px 35px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}

.admin-ticket-modal-content .modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerShine 8s linear infinite;
}

@keyframes headerShine {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.admin-ticket-modal-content .modal-header h3 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.admin-ticket-modal-content .modal-header h3 i {
    font-size: 1.4rem;
    background: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.admin-ticket-modal-content .modal-header .ticket-subject {
    margin: 10px 0 0 0;
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
    line-height: 1.5;
}

.modal-close,
.admin-ticket-modal-content .modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 100001;
    backdrop-filter: blur(10px);
}

.modal-close:hover,
.admin-ticket-modal-content .modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Info Bar - Design Moderne */
.admin-ticket-info-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 25px 35px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
}

.admin-ticket-info-bar .info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.admin-ticket-info-bar .info-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.admin-ticket-info-bar .info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-ticket-info-bar .info-label::before {
    content: '';
    width: 4px;
    height: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 2px;
}

.admin-ticket-info-bar .info-value {
    font-size: 1rem;
    color: #1e293b;
    font-weight: 700;
}

.admin-ticket-info-bar .status-select {
    padding: 10px 14px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.admin-ticket-info-bar .status-select:hover {
    border-color: #6366f1;
    background-image: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.admin-ticket-info-bar .status-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Messages - Design Chat Moderne */
.admin-ticket-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px 35px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-ticket-messages::-webkit-scrollbar {
    width: 8px;
}

.admin-ticket-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.admin-ticket-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 4px;
}

.ticket-message {
    padding: 0;
    border: none;
    background: none;
    animation: messageSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ticket-message.admin {
    animation: messageSlideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageSlideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ticket-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.ticket-message-sender {
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-message-sender i {
    font-size: 0.9rem;
    padding: 6px;
    border-radius: 8px;
}

.ticket-message-sender.user {
    color: #3b82f6;
}

.ticket-message-sender.user i {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.ticket-message-sender.admin {
    color: #10b981;
}

.ticket-message-sender.admin i {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.ticket-message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.ticket-message-content {
    background: white;
    padding: 16px 20px;
    border-radius: 16px;
    color: #1e293b;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    transition: all 0.3s ease;
    font-weight: 500;
}

.ticket-message.user .ticket-message-content {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #3b82f6;
    margin-left: 0;
    max-width: 85%;
    color: #1e40af;
}

.ticket-message.admin .ticket-message-content {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-left: 4px solid #10b981;
    margin-left: auto;
    margin-right: 0;
    max-width: 85%;
    color: #065f46;
}

.ticket-message-content:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Reply Form - Design Moderne */
.admin-ticket-reply-form {
    padding: 25px 35px 30px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
    border-top: 2px solid rgba(99, 102, 241, 0.1);
}

.admin-ticket-reply-form textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: white;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.admin-ticket-reply-form textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
    background: white;
}

.admin-ticket-reply-form textarea::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.admin-reply-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.admin-reply-actions button {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-cancel {
    background: #e2e8f0;
    color: #334155;
    border: 2px solid transparent;
}

.btn-cancel:hover {
    background: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-submit {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    color: white;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-submit:hover::before {
    width: 300px;
    height: 300px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

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

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.admin-actions select {
    padding: 10px 15px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.admin-actions select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .tickets-admin-stats {
        grid-template-columns: 1fr;
    }
    
    .admin-ticket-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .admin-actions select {
        width: 100%;
    }
    
    .admin-ticket-modal-content {
        width: 98%;
        max-height: 95vh;
    }
    
    .admin-ticket-modal-content .modal-header {
        padding: 20px 25px;
    }
    
    .admin-ticket-info-bar {
        grid-template-columns: 1fr;
        padding: 20px 25px;
    }
    
    .admin-ticket-messages {
        padding: 20px 25px;
    }
    
    .ticket-message.user .ticket-message-content,
    .ticket-message.admin .ticket-message-content {
        max-width: 90%;
    }
    
    .admin-ticket-reply-form {
        padding: 20px 25px;
    }
    
    .admin-reply-actions {
        flex-direction: column;
    }
    
    .admin-reply-actions button {
        width: 100%;
        justify-content: center;
    }
}
