/* Responsive table styles */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Forcer l'affichage de la colonne Actions sur mobile */
    #utilisateurs .table th:nth-child(5),
    #utilisateurs .table td:nth-child(5) {
        display: table-cell !important;
        min-width: 150px;
        white-space: nowrap;
    }
    
    /* Adapter le formulaire dans la colonne Actions */
    #utilisateurs .table td:nth-child(5) form {
        display: flex;
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }
    
    #utilisateurs .table td:nth-child(5) .form-select {
        width: 100% !important;
        margin-bottom: 5px;
    }
    
    #utilisateurs .table td:nth-child(5) .btn {
        width: 100%;
    }
}

/* Styles personnalisés pour MedFlow */

@font-face {
    font-family: 'Roboto';
    src: url('../images/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('../images/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --primary-color: #2E7D32; /* Vert médical inspiré du logo */
    --primary-light: #4CAF50;
    --primary-dark: #1B5E20;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #2E7D32;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --accent-color: #81C784; /* Vert plus clair pour les accents */
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--light-color);
}

/* Sidebar styles */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    border-radius: 8px;
    margin: 5px 10px;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main content */
.main-content {
    min-height: 100vh;
    padding: 20px;
}

/* Card styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* Form styles */
.form-control {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-1px);
}

/* Table styles */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Badge styles */
.badge {
    font-size: 0.85em;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Alert styles */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* Dashboard stats */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-bottom: 15px;
}

.stat-card.primary .stat-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.stat-card.success .stat-icon {
    background: linear-gradient(135deg, var(--success-color), #146c43);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, var(--warning-color), #d39e00);
}

.stat-card.danger .stat-icon {
    background: linear-gradient(135deg, var(--danger-color), #b02a37);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stat-card {
        margin-bottom: 20px;
    }
    
    /* Mobile table improvements */
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        vertical-align: middle;
    }
    
    /* Hide less important columns on very small screens */
    @media (max-width: 576px) {
        .table th:nth-child(5),
        .table td:nth-child(5),
        .table th:nth-child(6),
        .table td:nth-child(6) {
            display: none;
        }
        
        .btn-sm {
            padding: 0.25rem 0.5rem;
            font-size: 0.75rem;
        }
    }
    
    /* Mobile form improvements */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .row > .col-md-6,
    .row > .col-md-4,
    .row > .col-md-3 {
        margin-bottom: 1rem;
    }
    
    /* Mobile card adjustments */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Mobile stat cards */
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    /* Mobile navigation */
    .navbar {
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    /* Mobile modal improvements */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Mobile badge adjustments */
    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form validation */
.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--danger-color);
}

/* Enhanced Modal Styles */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
    background: #fafafa;
}

.modal-footer {
    border: none;
    background: white;
    padding: 1.5rem;
}

.modal .form-control,
.modal .form-select {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 0.75rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.25);
}

.modal .form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.modal .btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modal .btn-success {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
}

.modal .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3);
}

.modal .btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
}

.modal .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.modal .btn-secondary {
    background: #6c757d;
    border: none;
}

.modal .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Details Modal Specific Styles */
.detail-row {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.detail-row:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.detail-label {
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1.05rem;
    color: #333;
    font-weight: 500;
}

/* Confirmation Modal Styles */
.confirmation-modal .modal-body {
    text-align: center;
    padding: 2rem;
}

.confirmation-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #dc3545, #c82333);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.confirmation-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.confirmation-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
}

.product-info {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--primary-color);
}

.product-info strong {
    color: var(--primary-color);
}

/* Print styles */
@media print {
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Enhanced Table Styles */
.table {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border: none;
    padding: 1.2rem 0.8rem;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(46, 125, 50, 0.05), rgba(46, 125, 50, 0.02));
    transform: scale(1.01);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody td {
    padding: 1rem 0.8rem;
    vertical-align: middle;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(248, 249, 250, 0.5);
}

.table-striped tbody tr:nth-of-type(odd):hover {
    background: linear-gradient(90deg, rgba(46, 125, 50, 0.05), rgba(46, 125, 50, 0.02));
}

/* Enhanced Table Container */
.table-responsive {
    border-radius: 15px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    background: white;
    padding: 0;
}

/* Scrollbar Styling */
.table-responsive::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
    margin: 0 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 10px;
    cursor: pointer;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1B5E20);
}

/* Firefox scrollbar */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}

/* Ensure table is always scrollable on all devices */
@media (min-width: 1px) {
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 900px;
    }
}

/* Enhanced Badge Styles */
.badge {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.bg-success {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #ffc107, #ff9800) !important;
    color: #333 !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
}

.badge.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
}

/* Enhanced Button Group Styles */
.btn-group {
    border-radius: 10px;
    overflow: visible;
    box-shadow: none;
    display: flex;
    gap: 5px;
}

.btn-group .btn {
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    background: white;
    color: #666;
    min-width: 35px;
}

.btn-group .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.btn-group .btn-outline-primary {
    border-color: #007bff;
    color: #007bff;
}

.btn-group .btn-outline-primary:hover {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-color: #007bff;
    color: white;
}

.btn-group .btn-outline-info {
    border-color: #17a2b8;
    color: #17a2b8;
}

.btn-group .btn-outline-info:hover {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border-color: #17a2b8;
    color: white;
}

.btn-group .btn-outline-danger {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-group .btn-outline-danger:hover {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border-color: #dc3545;
    color: white;
}

.btn-group .btn i {
    font-size: 0.9rem;
}

/* Enhanced Card Styles */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    color: var(--primary-color);
}

/* Enhanced Responsive Styles */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Statistics Cards */
    .stat-card {
        margin-bottom: 1rem;
        min-height: 120px;
    }
    
    .stat-card h3 {
        font-size: 1.8rem;
    }
    
    .stat-card p {
        font-size: 0.9rem;
    }
    
    /* Table Responsive */
    .table-responsive {
        border-radius: 15px;
        overflow: hidden;
        box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    }
    
    .table {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    
    .table thead th {
        font-size: 0.75rem;
        padding: 0.8rem 0.5rem;
        white-space: nowrap;
    }
    
    .table tbody td {
        padding: 0.8rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Keep action buttons visible in mobile */
    .table td:last-child {
        display: table-cell !important;
        width: auto !important;
        min-width: 120px;
    }
    
    .btn-group {
        flex-direction: row;
        gap: 3px;
        justify-content: center;
        flex-wrap: nowrap;
    }
    
    .btn-group .btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
        min-width: 30px;
        border-width: 1px;
    }
    
    .btn-group .btn i {
        font-size: 0.8rem;
    }
    
    /* Hide some columns in mobile for better readability */
    .table th:nth-child(5),
    .table td:nth-child(5) {
        display: none;
    }
    
    /* Modal Responsive */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-body .row > div {
        margin-bottom: 1rem;
    }
    
    .modal .form-control,
    .modal .form-select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .modal .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Detail rows in modal */
    .detail-row {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .detail-label {
        font-size: 0.75rem;
    }
    
    .detail-value {
        font-size: 0.9rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .card-header {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Navigation tabs */
    .nav-pills {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-pills .nav-link {
        text-align: center;
        padding: 0.8rem;
        border-radius: 8px;
    }
    
    /* Header buttons */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }
    
    .d-flex.justify-content-between h4 {
        text-align: center;
        margin-bottom: 0;
    }
    
    .d-flex.justify-content-between > div {
        display: flex;
        gap: 0.5rem;
        flex-direction: column;
    }
    
    .d-flex.justify-content-between .btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .table {
        font-size: 0.75rem;
    }
    
    .table thead th {
        font-size: 0.7rem;
        padding: 0.6rem 0.3rem;
    }
    
    .table tbody td {
        padding: 0.6rem 0.3rem;
        font-size: 0.75rem;
    }
    
    .btn-group .btn {
        padding: 0.25rem 0.3rem;
        font-size: 0.7rem;
        min-width: 25px;
    }
    
    .btn-group .btn i {
        font-size: 0.7rem;
    }
    
    .stat-card {
        min-height: 100px;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    .stat-card p {
        font-size: 0.8rem;
    }
}
