/* =============================================================================
   CSS VARIABLES - Centralisation des couleurs et valeurs
   ============================================================================= */
:root {
    /* Couleurs principales */
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --secondary: #6c757d;
    --success: #198754;
    --success-dark: #146c43;
    --danger: #dc3545;
    --danger-dark: #b02a37;
    --warning: #ffc107;
    --warning-dark: #e0a800;
    --info: #0dcaf0;
    
    /* Couleurs ticketing */
    --ticket-primary: #667eea;
    --ticket-secondary: #764ba2;
    --ticket-success: #10b981;
    --ticket-danger: #ef4444;
    
    /* Couleurs de texte */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #6c757d;
    
    /* Couleurs de fond */
    --bg-light: #f9fafb;
    --bg-gray: #f8f9fa;
    --bg-gray-dark: #e9ecef;
    --border-color: #e5e7eb;
    --border-light: #dee2e6;
    
    /* Ombres */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease-out;
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-2xl: 15px;
}

/* =============================================================================
   ANIMATIONS GLOBALES
   ============================================================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes progress-bar-stripes {
    0% { background-position-x: 1rem; }
}

.animate-fade-in {
    animation: fadeIn var(--transition-base);
}

/* =============================================================================
   STEP INDICATOR
   ============================================================================= */
.step-indicator {
    position: relative;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-gray-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--secondary);
    position: relative;
    z-index: 2;
}

.step-item.active .step-circle {
    background-color: var(--primary);
    color: white;
}

.step-label {
    margin-top: 8px;
    font-size: 12px;
    color: var(--secondary);
    text-align: center;
}

.step-item.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.step-line {
    position: absolute;
    top: 20px;
    left: 60%;
    right: -40%;
    height: 2px;
    background-color: var(--bg-gray-dark);
    z-index: 1;
}

.step-item.active .step-line {
    background-color: var(--primary);
}

.step-item:last-child .step-line {
    display: none;
}

/* =============================================================================
   CARDS & HOVER EFFECTS
   ============================================================================= */
.card {
    transition: all var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.cart-item {
    background: linear-gradient(135deg, var(--bg-gray) 0%, var(--bg-gray-dark) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.cart-item:hover {
    background: linear-gradient(135deg, var(--bg-gray-dark) 0%, var(--border-light) 100%);
    transform: translateX(2px);
}

.stats-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    position: relative;
}

.stats-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    pointer-events: none;
}

.ticket-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: white;
    transition: all var(--transition-fast);
}

.ticket-card:hover {
    box-shadow: var(--shadow-md);
}

/* =============================================================================
   TABLES
   ============================================================================= */
.table-hover tbody tr,
.product-row {
    transition: all var(--transition-fast);
}

.table-hover tbody tr:hover,
.product-row:hover {
    background-color: rgba(13, 110, 253, 0.05);
    transform: scale(1.01);
}

.product-row:hover {
    border-radius: 5px;
}

/* Scrollbar personnalisée */
.table-responsive::-webkit-scrollbar,
.comments-container::-webkit-scrollbar,
.tickets-list::-webkit-scrollbar {
    width: 6px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: var(--radius-lg);
}

.table-responsive::-webkit-scrollbar-thumb,
.comments-container::-webkit-scrollbar-thumb,
.tickets-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: var(--radius-lg);
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.comments-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.comments-container::-webkit-scrollbar-track,
.tickets-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: var(--radius-lg);
}

.tickets-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

/* =============================================================================
   MODALS
   ============================================================================= */
.modal-content {
    border: none;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 2px solid var(--bg-gray);
    background: linear-gradient(135deg, var(--bg-gray) 0%, var(--bg-gray-dark) 100%);
}

.modal-footer .btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =============================================================================
   FORM ELEMENTS
   ============================================================================= */
.form-control:focus,
.form-select:focus,
.comment-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.comment-textarea:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-left: none;
}

.search-input {
    position: relative;
}

.search-input::before {
    content: '\f002';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
    z-index: 5;
}

.search-input input {
    padding-left: 40px;
}

.quantity-input {
    width: 80px;
    text-align: center;
}

.is-invalid {
    border-color: var(--danger);
    background-image: none;
}

.is-valid {
    border-color: var(--success);
    background-image: none;
}

.form-select {
    cursor: pointer;
}

.form-label {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.comment-textarea {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    resize: none;
}

/* ================================
   🎯 Badges : Statut & Priorité
   ================================ */

/* ✅ Style général commun à tous les badges */
.badge {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
}

/* Effet visuel subtil au survol */
.badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ================================
   🟢 Statut du ticket
   ================================ */

/* Ouvert */
.status-open {
    background-color: #dcfce7 !important;  /* vert clair */
    color: #166534 !important;             /* vert foncé */
    border-color: #86efac;
}

/* En cours */
.status-in_progress {
    background-color: #dbeafe !important;  /* bleu clair */
    color: #1e40af !important;             /* bleu foncé */
    border-color: #93c5fd;
}

/* Clôturé */
.status-closed {
    background-color: #f3f4f6 !important;  /* gris clair */
    color: #4b5563 !important;             /* gris foncé */
    border-color: #d1d5db;
}

/* ================================
   🚩 Priorité du ticket
   ================================ */

/* Normal */
.priority-normal {
    background-color: #e0f2fe !important;  /* bleu très clair */
    color: #0369a1 !important;             /* bleu profond */
    border-color: #bae6fd;
}

/* Urgent */
.priority-urgent {
    background-color: #fef3c7 !important;  /* jaune clair */
    color: #92400e !important;             /* brun doré */
    border-color: #fde68a;
}

/* Très urgent */
.priority-tres-urgent {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border-color: #fca5a5;
}


/* ================================
   👤 Badges d’assignation (optionnel)
   ================================ */
.badge-assigned {
    background-color: #ede9fe !important;
    color: #5b21b6 !important;
    border-color: #ddd6fe;
}

/* ================================
   ✨ Accessibilité et design
   ================================ */
.badge i {
    margin-right: 0.4rem;
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Uniformiser les marges entre badges dans une cellule */
td .badge + .badge {
    margin-left: 0.25rem;
}


/* =============================================================================
   ALERTS
   ============================================================================= */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    border-left: 4px solid;
    box-shadow: var(--shadow-xs);
}

.alert-success {
    background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
    border-left-color: var(--success);
    color: #166534;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    border-left-color: var(--danger);
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left-color: var(--warning);
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #b8daff 100%);
    border-left-color: var(--info);
}

.alert-light {
    background-color: var(--bg-gray);
    border-color: var(--border-light);
}

/* =============================================================================
   PROGRESS & LOADING ELEMENTS
   ============================================================================= */
.progress {
    height: 8px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-gray);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    transition: width var(--transition-base);
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    animation: spinner-border 0.75s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =============================================================================
   BUTTONS & INTERACTIVE ELEMENTS
   ============================================================================= */
.btn:disabled {
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ticket-primary) 0%, var(--ticket-secondary) 100%);
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    opacity: 0.9;
}

.btn-outline-primary:hover {
    background: var(--ticket-primary);
    border-color: var(--ticket-primary);
}

.btn-outline-danger:hover {
    background: var(--ticket-danger);
    border-color: var(--ticket-danger);
}

.btn-link {
    text-decoration: none;
}

.contact-floating-btn {
    position: fixed;
    bottom: 50px;
    right: 20px;
    z-index: 1050;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
}

/* =============================================================================
   TEXT & DISPLAY ELEMENTS
   ============================================================================= */
.price-display {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.serial-number {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid var(--border-light);
}

/* =============================================================================
   TOOLTIPS
   ============================================================================= */
.tooltip {
    font-size: 12px;
}

.tooltip-inner {
    background-color: #2c3e50;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

/* =============================================================================
   NAVIGATION & LAYOUT
   ============================================================================= */
.bg-gradient-primary {
    background: linear-gradient(135deg, #495786 0%, #14957b 100%);
}

.text-white-75 {
    color: rgba(255, 255, 255, 0.75) !important;
}

.text-white-25 {
    color: rgba(255, 255, 255, 0.25) !important;
}

.vr {
    width: 1px;
    min-height: 2rem;
    background-color: currentColor;
    opacity: 0.25;
}

.breadcrumb-custom {
    background-color: rgba(0,0,0,0.03) !important;
    border: 1px solid rgba(0,0,0,0.1);
}

.breadcrumb-custom .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--secondary);
}

.main-content-wrapper {
    position: relative;
}

/* =============================================================================
   TICKETING SYSTEM - DETAIL VIEW
   ============================================================================= */
.ticket-detail-wrapper,
.tickets-create-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

.tickets-create-wrapper {
    max-width: 1600px;
}

.ticket-header {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.ticket-description {
    color: var(--text-primary);
    line-height: 1.6;
    margin-top: 0.75rem;
}

/* Attachments */
.attachments-inline {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.attachment-preview {
    display: block;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
}

.attachment-preview:hover {
    border-color: var(--ticket-primary);
    transform: scale(1.05);
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-file {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.attachment-file:hover {
    background: var(--bg-light);
    border-color: var(--ticket-primary);
    color: var(--ticket-primary);
    transform: translateY(-2px);
}

/* =============================================================================
   COMMENTS SECTION
   ============================================================================= */
.comments-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
}

.comment-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.comment-item:hover {
    background: var(--bg-light);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    margin-bottom: 0.75rem;
}

.comment-body {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left;
    padding: 0.25rem 0;
}

.comment-form {
    padding: 1.5rem;
    background: var(--bg-light);
}

/* =============================================================================
   SIDEBAR - PROPERTIES
   ============================================================================= */
.property-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.property-item:last-child {
    border-bottom: none;
}

.property-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.property-value {
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* =============================================================================
   TIMELINE
   ============================================================================= */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: -1.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    z-index: 1;
}

.timeline-content {
    background: var(--bg-light);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
}

.timeline-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}


/* =============================================================================
   TICKETS LIST
   ============================================================================= */
.tickets-list {
    max-height: 800px;
    overflow-y: auto;
}

.ticket-list-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.ticket-list-item:hover {
    background: var(--bg-light);
    transform: translateX(4px);
}

.ticket-list-item:last-child {
    border-bottom: none;
}

.ticket-id-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--ticket-primary) 0%, var(--ticket-secondary) 100%);
    color: white;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.ticket-meta {
    margin-top: 0.5rem;
}

.ticket-actions .dropdown-toggle::after {
    display: none;
}

/* =============================================================================
   DROPDOWN MENU
   ============================================================================= */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    min-width: 200px;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.rounded-circle {
    object-fit: cover;
}

.sticky-top {
    position: sticky;
    z-index: 10;
}

.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
}

.card-header {
    font-weight: 600;
    padding: 1rem 1.5rem;
}

.empty-state {
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #cbd5e1;
}

.shadow-avatar {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25); /* Ombre douce */
}


/* =============================================================================
   MEDIA QUERIES - RESPONSIVE DESIGN
   ============================================================================= */

/* Tablettes */
@media (max-width: 992px) {
    .ticket-detail-wrapper {
        padding: 1rem;
    }

    .ticket-header {
        padding: 1rem;
    }

    .ticket-header .d-flex {
        flex-direction: column;
        gap: 1rem;
    }

    .comment-item {
        padding: 1rem;
    }

    .timeline {
        padding-left: 1.5rem;
    }

    .tickets-list {
        max-height: 600px;
    }
}

/* Mobiles */
@media (max-width: 768px) {
    .attachment-preview {
        width: 80px;
        height: 80px;
    }

    .ticket-id-badge {
        width: 40px;
        height: 40px;
        font-size: 0.75rem;
    }
}

/* Print Styles */
@media print {
    .modal-header, 
    .modal-footer, 
    .btn-close,
    .btn, 
    .card-header, 
    .alert,
    .btn-toolbar, 
    .modal, 
    nav {
        display: none !important;
    }
    
    .modal-body {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .table {
        font-size: 12px;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #ffffff;
        border-color: #dfe9e4;
    }
    
    .table {
        color: #626569;
    }
}

@media (max-width: 768px) {
    .card-body { padding: 0.75rem !important; }
    .card h6 { font-size: 0.9rem; }
    .card .small { font-size: 0.75rem; }
}

#sidebarMenu {
    background: linear-gradient(180deg, #1a1a26 0%, #274235 100%) !important; /* gris foncé vers violet */
    color: #ffffff !important;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
}

/* Liens */
#sidebarMenu .nav-link {
    color: #ffffff !important;
    transition: all 0.3s ease;
}

#sidebarMenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

#sidebarMenu .nav-link.active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    font-weight: 500;
}


#sidebarMenu {
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

