/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.main-nav a:hover {
    background-color: rgba(255,255,255,0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
}

.user-info small {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Alertes */
.alert {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Page de connexion */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #7f8c8d;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.login-footer ul {
    margin-top: 0.5rem;
    padding-left: 1rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ecf0f1;
}

.form-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Tableau de bord */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
}

/* Conteneur de tableau */
.table-container {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
}

/* Filtres améliorés */
.filter-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
}

/* Informations d'équipe */
.team-leader-info {
    background: #3498db;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.no-assignment {
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.9rem;
}

.dashboard-header h1 {
    color: #2c3e50;
}

.user-welcome {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    border-left: 4px solid #3498db;
}

.stat-card.stat-open {
    border-left-color: #e74c3c;
}

.stat-card.stat-progress {
    border-left-color: #f39c12;
}

.stat-card.stat-resolved {
    border-left-color: #27ae60;
}

.stat-card.stat-closed {
    border-left-color: #95a5a6;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Filtres */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Tickets */
.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.ticket-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #3498db;
    transition: transform 0.3s, box-shadow 0.3s;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.ticket-card[data-status="open"] {
    border-left-color: #e74c3c;
}

.ticket-card[data-status="in_progress"] {
    border-left-color: #f39c12;
}

.ticket-card[data-status="resolved"] {
    border-left-color: #27ae60;
}

.ticket-card[data-status="closed"] {
    border-left-color: #95a5a6;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.ticket-header h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-right: 1rem;
}

.ticket-status {
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-open {
    background: #e74c3c;
    color: white;
}

.status-in_progress {
    background: #f39c12;
    color: white;
}

.status-resolved {
    background: #27ae60;
    color: white;
}

.status-closed {
    background: #95a5a6;
    color: white;
}

.ticket-info p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.ticket-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.priority {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.priority-low {
    background: #27ae60;
    color: white;
}

.priority-medium {
    background: #f39c12;
    color: white;
}

.priority-high {
    background: #e74c3c;
    color: white;
}

.priority-critical {
    background: #8e44ad;
    color: white;
}

/* Page de ticket */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.ticket-title-section h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.ticket-title-section h2 {
    color: #7f8c8d;
    font-weight: normal;
}

.ticket-status-section {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.ticket-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.info-card,
.content-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.info-card h3,
.content-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.info-grid {
    display: grid;
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.info-item strong {
    color: #2c3e50;
    min-width: 120px;
}

.description,
.error-message {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #3498db;
    white-space: pre-wrap;
}

.error-message {
    border-left-color: #e74c3c;
}

/* Commentaires */
.comments-list {
    margin-bottom: 2rem;
}

.comment {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #3498db;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.comment-role {
    font-size: 0.8rem;
    color: #7f8c8d;
    background: #ecf0f1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.comment-date {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-left: auto;
}

.comment-content {
    color: #2c3e50;
    line-height: 1.5;
}

.comment-form {
    margin-top: 1.5rem;
}

/* Administration */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.admin-actions {
    display: flex;
    gap: 1rem;
}

.admin-stats {
    margin: 2rem 0;
}

.admin-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.admin-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.stats-list {
    display: grid;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.stat-item:last-child {
    border-bottom: none;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.user-role {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-admin {
    background: #e74c3c;
    color: white;
}

.role-technician {
    background: #3498db;
    color: white;
}

.role-team_leader {
    background: #f39c12;
    color: white;
}

.role-normal_user {
    background: #27ae60;
    color: white;
}

.user-status {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.user-status.active {
    background: #27ae60;
    color: white;
}

.user-status.inactive {
    background: #95a5a6;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-menu {
        flex-direction: column;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .ticket-layout {
        grid-template-columns: 1fr;
    }
    
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .tickets-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .ticket-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .ticket-status-section {
        justify-content: center;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .admin-actions {
        justify-content: center;
    }
    
    .quick-actions {
        justify-content: center;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .comment-date {
        margin-left: 0;
    }
}

/* États vides */
.no-tickets,
.no-comments,
.no-data {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-tickets p,
.no-comments p,
.no-data p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Utilitaires */
.page-header {
    margin: 2rem 0;
    text-align: center;
}

.page-header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Améliorations d'accessibilité */
.btn:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ticket-card,
.stat-card,
.admin-card,
.info-card,
.content-card {
    animation: fadeIn 0.3s ease-out;
}

/* Gestion des équipes */
.team-management {
    display: grid;
    gap: 2rem;
}

/* Réinitialisation de mot de passe */
.password-reset-success {
    text-align: center;
}

.new-password-display {
    margin: 2rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #27ae60;
}

.password-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.password-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.password-warning {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8d7da;
    border-radius: 4px;
    border-left: 4px solid #e74c3c;
}

/* Bouton d'avertissement */
.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.team-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.team-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.team-members-grid,
.available-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.team-member-card,
.user-card {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-info,
.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.member-info strong,
.user-info strong {
    color: #2c3e50;
    font-weight: 500;
}

.member-info span,
.user-info span {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* WebRTC Styles */
.webrtc-section {
    margin: 1rem 0;
}

.webrtc-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.call-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.hidden {
    display: none !important;
}

.webrtc-participants {
    margin-bottom: 1.5rem;
}

.participants-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
}

.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.participant-name {
    font-weight: 500;
    color: #2c3e50;
}

.participant-status {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-style: italic;
}

.webrtc-videos {
    margin-top: 1.5rem;
}

.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.video-container {
    background: #2c3e50;
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
    position: relative;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-wrapper h4 {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 10;
}

#local-video, 
.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a252f;
}

.screen-share-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 2px dashed #bdc3c7;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-share-active {
    width: 100%;
}

.screen-share-active h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center;
}

#screen-share-video {
    width: 100%;
    max-height: 400px;
    border-radius: 4px;
    background: #1a252f;
}

/* Call control button states */
.btn.active {
    background: #27ae60;
    border-color: #27ae60;
}

.btn.muted {
    background: #e74c3c;
    border-color: #e74c3c;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive WebRTC */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .webrtc-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .call-controls {
        justify-content: center;
    }
    
    .video-container {
        min-height: 150px;
    }
    
    #screen-share-video {
        max-height: 250px;
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Bouton de retour */
.back-button-section {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #3498db;
}

@media (max-width: 768px) {
    .back-button-section {
        flex-direction: column;
        align-items: stretch;
    }
}
