/* ========================================
   STYLES CLIENT / VISITEUR (index.php, etc.)
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap');

:root {
    /* Charte Descamps */
    --primary: #7C7C7B;
    /* Gris moyen Descamps */
    --primary-dark: #4A4A49;
    /* Gris foncé Descamps */
    --orange: #EF8000;
    /* Orange Descamps */
    --gray-light: #EDEDED;
    /* Gris clair Descamps (10%) */
    --gray-medium: #7C7C7B;
    /* Gris moyen Descamps */
    --gray-dark: #4A4A49;
    /* Gris foncé Descamps (85%) */

    /* Couleurs fonctionnelles */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Grille de gris */
    --gray-50: #F9F9F9;
    --gray-100: #EDEDED;
    --gray-200: #D4D4D4;
    --gray-400: #9CA3AF;
    --gray-600: #7C7C7B;
    --gray-700: #4A4A49;
    --gray-900: #2D2D2D;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #7C7C7B 0%, #4A4A49 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--gray-900);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Typographie --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--gray-dark);
    line-height: 1.2;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 28px;
}

h3 {
    font-size: 24px;
}

h4 {
    font-size: 20px;
}

p {
    line-height: 1.6;
    color: var(--gray-700);
}

a {
    color: var(--orange);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #D67200;
    text-decoration: underline;
}

/* --- Header --- */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-left: 4px solid var(--orange);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo::before {
    content: '';
    width: 4px;
    height: 30px;
    background: var(--orange);
    display: inline-block;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* --- Boutons --- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Source Sans Pro', sans-serif;
    transition: all 0.3s ease;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--gray-medium) 0%, var(--gray-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gray-dark) 0%, var(--gray-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 74, 73, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-dark);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-medium);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--orange);
    color: white;
}

.btn-success:hover {
    background: #D67200;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 128, 0, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.edit-description-btn {
    background: linear-gradient(135deg, var(--orange) 0%, #D67200 100%);
    color: white;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.edit-description-btn:hover {
    background: linear-gradient(135deg, #D67200 0%, #B85F00 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 128, 0, 0.3);
}

.edit-description-btn:active {
    transform: scale(0.95);
}

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* --- Contenu Principal --- */
.content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--orange);
}

/* --- Formulaires --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: 'Source Sans Pro', sans-serif;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(239, 128, 0, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

input:invalid:not(:focus),
select:invalid:not(:focus),
textarea:invalid:not(:focus) {
    border-color: var(--danger);
}

input:valid,
select:valid,
textarea:valid {
    border-color: var(--success);
}

/* --- Tickets Cards --- */
.ticket-card {
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
    background: white;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.ticket-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--gray-medium);
    transition: all 0.3s;
}

.ticket-card:hover {
    border-color: var(--orange);
    box-shadow: 0 4px 12px rgba(239, 128, 0, 0.15);
    transform: translateY(-2px);
}

.ticket-card:hover::before {
    background: var(--orange);
    width: 6px;
}

.ticket-card.has-unread {
    border-color: var(--orange);
    background: rgba(239, 128, 0, 0.03);
}

.ticket-card.has-unread::before {
    background: var(--orange);
}

/* --- Badges --- */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    animation: fadeIn 0.5s ease;
}

.badge-open {
    background: #dbeafe;
    color: #1e40af;
}

.badge-in-progress {
    background: rgba(239, 128, 0, 0.1);
    color: #D67200;
}

.badge-closed {
    background: #d1fae5;
    color: #065f46;
}

.badge-high {
    background: #fee2e2;
    color: #991b1b;
}

.badge-medium {
    background: rgba(239, 128, 0, 0.1);
    color: #D67200;
}

.badge-low {
    background: var(--gray-100);
    color: var(--gray-dark);
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 74, 73, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    border-top: 4px solid var(--orange);
    box-shadow: 0 20px 60px rgba(74, 74, 73, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-100);
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-600);
    transition: color 0.3s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* --- Messages / Alertes --- */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--gray-50);
    animation: fadeIn 0.3s ease;
    border-left: 4px solid var(--gray-200);
}

.message-admin {
    border-left: 4px solid var(--orange);
    background: rgba(239, 128, 0, 0.05);
}

.message-user {
    border-left: 4px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.success-message {
    background: #d1fae5;
    border-left: 4px solid var(--success);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #065f46;
    animation: slideIn 0.3s ease;
}

.error-message {
    background: #fee2e2;
    border-left: 4px solid var(--danger);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #991b1b;
    animation: slideIn 0.3s ease;
}

.message-system {
    display: none;
    /* Old class */
}

/* Nouveau Design "Pill" pour les messages système */
.msg-bubble.system {
    margin: 15px auto;
    background: #e2e8f0;
    /* Gray-200 equivalent */
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    width: fit-content;
    max-width: 90%;
    text-align: center;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.system-date {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-dark);
    opacity: 0.7;
}

.system-text {
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}

/* --- Statistiques & Tableaux (Client) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--gray-dark) 0%, var(--gray-medium) 100%);
    padding: 25px;
    border-radius: 12px;
    color: white;
    transition: transform 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(74, 74, 73, 0.4);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
}

.tickets-table th,
.tickets-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--gray-100);
}

.tickets-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-dark);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.tickets-table tr:hover {
    background: rgba(239, 128, 0, 0.03);
}

/* --- Drag & Drop --- */
.custom-drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 10px;
    /* Reduced from 15px */
    text-align: center;
    background: var(--gray-50);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.custom-drop-zone:hover,
.custom-drop-zone.drag-over {
    border-color: var(--orange);
    background: rgba(239, 128, 0, 0.05);
}

.custom-drop-zone-icon {
    /* Font size removed as it is now controlled by inline styles on the div */
    margin-bottom: 0;
    color: var(--orange);
    display: inline-block;
}

.custom-drop-zone-text {
    margin: 5px 0 2px 0;
    color: var(--text-main);
    font-size: 13px;
}

.custom-drop-zone-text strong {
    font-weight: 600;
}

.custom-drop-zone-subtext {
    color: var(--text-muted);
    font-size: 10px;
    /* Reduced from 11px */
}

/* --- Notation (Stars) --- */
.rating-stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.rating-stars input {
    display: none;
}

.rating-stars label {
    font-size: 40px;
    color: var(--gray-200);
    cursor: pointer;
    transition: color 0.2s;
}

.rating-stars input:checked~label,
.rating-stars label:hover,
.rating-stars label:hover~label {
    color: #f59e0b;
}

.btn-review {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-review:hover {
    background: #d97706;
}

/* --- Divers & Animations --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-600);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-medium);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .tickets-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}