/* =============================================================
   ToolBox — Framework CSS Responsive Mobile-First
   ============================================================= */

/* -----------------------------------------------------------
   Variables CSS
   ----------------------------------------------------------- */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #6c83f2;
    --secondary: #7209b7;
    --success: #06d6a0;
    --success-dark: #05b588;
    --warning: #ffd166;
    --warning-dark: #e6b84d;
    --danger: #ef476f;
    --danger-dark: #d93a5f;
    --info: #118ab2;
    --info-dark: #0e7a9e;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #dee2e6;
    --gray-lighter: #e9ecef;
    --white: #ffffff;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
    --navbar-height: 60px;
}

/* -----------------------------------------------------------
   Reset & Base
   ----------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--dark);
    background-color: var(--light);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* -----------------------------------------------------------
   Typographie
   ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }

/* -----------------------------------------------------------
   Container
   ----------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* -----------------------------------------------------------
   Navbar
   ----------------------------------------------------------- */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--navbar-height);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand:hover {
    color: var(--primary-dark);
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.navbar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--dark);
    transition: var(--transition);
    border-radius: 1px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-link {
    color: var(--gray);
    font-weight: 500;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
}

.navbar-link:hover {
    color: var(--primary);
    background: var(--light);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--gray-light);
}

.navbar-profile-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: background 0.2s;
}

.navbar-profile-link:hover {
    background: var(--gray-lighter);
}

.navbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.navbar-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 600;
}

/* -----------------------------------------------------------
   Sidebar
   ----------------------------------------------------------- */
.layout-with-sidebar {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--navbar-height));
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-light);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-light);
}

.sidebar-header h3 {
    font-size: 1rem;
    color: var(--dark);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    color: var(--gray);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-link:hover {
    color: var(--primary);
    background: var(--light);
}

.sidebar-link.active {
    color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--gray-light);
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    min-width: 0;
}

.main-content.with-sidebar {
    padding: 1.5rem 2rem;
}

/* -----------------------------------------------------------
   Boutons
   ----------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
    font-family: var(--font-family);
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}

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

.btn-success:hover {
    background: var(--success-dark);
    border-color: var(--success-dark);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning-dark);
    border-color: var(--warning-dark);
    color: var(--dark);
}

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

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

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

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

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

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

.btn-outline-warning {
    background: transparent;
    color: var(--warning);
    border-color: var(--warning);
}

.btn-outline-warning:hover {
    background: var(--warning);
    color: var(--dark);
}

.btn-outline-success {
    background: transparent;
    color: var(--success);
    border-color: var(--success);
}

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

.hidden {
    display: none !important;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* -----------------------------------------------------------
   Cartes
   ----------------------------------------------------------- */
.card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header h2,
.card-header h3 {
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.card-link {
    display: block;
    color: inherit;
}

.card-link:hover {
    color: inherit;
}

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

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* -----------------------------------------------------------
   Formulaires
   ----------------------------------------------------------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    font-family: var(--font-family);
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--dark);
    transition: var(--transition);
    line-height: 1.4;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-control::placeholder {
    color: var(--gray);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 2.75rem;
}

.btn-toggle-password {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-left: 1px solid var(--gray-light);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    color: var(--gray);
    transition: color 0.2s, background-color 0.2s;
}

.btn-toggle-password:hover {
    background-color: var(--gray-lighter);
    color: var(--dark);
}

.btn-toggle-password:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.btn-toggle-password.active {
    color: var(--primary);
    background-color: rgba(67, 97, 238, 0.06);
}

.btn-toggle-password i {
    font-size: 1.1rem;
    pointer-events: none;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

/* Toggle switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: var(--gray-light);
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-label input[type="checkbox"]:checked + .toggle-track {
    background: var(--primary);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-label input[type="checkbox"]:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}

/* -----------------------------------------------------------
   Alertes / Messages Flash
   ----------------------------------------------------------- */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: rgba(6, 214, 160, 0.15);
    color: #047857;
    border: 1px solid rgba(6, 214, 160, 0.3);
}

.alert-danger {
    background: rgba(239, 71, 111, 0.15);
    color: #b91c4a;
    border: 1px solid rgba(239, 71, 111, 0.3);
}

.alert-warning {
    background: rgba(255, 209, 102, 0.2);
    color: #92400e;
    border: 1px solid rgba(255, 209, 102, 0.4);
}

.alert-info {
    background: rgba(17, 138, 178, 0.15);
    color: #0e7a9e;
    border: 1px solid rgba(17, 138, 178, 0.3);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    line-height: 1;
}

.alert-close:hover {
    opacity: 1;
}

/* -----------------------------------------------------------
   Badges
   ----------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(67, 97, 238, 0.15);
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-lighter);
    color: var(--gray);
}

.badge-success {
    background: rgba(6, 214, 160, 0.15);
    color: #047857;
}

.badge-warning {
    background: rgba(255, 209, 102, 0.2);
    color: #92400e;
}

.badge-danger {
    background: rgba(239, 71, 111, 0.15);
    color: #b91c4a;
}

.badge-info {
    background: rgba(17, 138, 178, 0.15);
    color: var(--info);
}

/* -----------------------------------------------------------
   Tableaux
   ----------------------------------------------------------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}

.table th {
    font-weight: 600;
    color: var(--gray);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--light);
}

.table tbody tr:hover {
    background: rgba(67, 97, 238, 0.02);
}

.table td .btn-group {
    justify-content: flex-end;
}

/* -----------------------------------------------------------
   Grille de statistiques
   ----------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

/* -----------------------------------------------------------
   Pages
   ----------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-light);
}

.page-header h1 {
    margin: 0;
}

.page-description {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* -----------------------------------------------------------
   Page d'erreur
   ----------------------------------------------------------- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
}

.error-page h1 {
    font-size: 5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.error-page p {
    font-size: 1.25rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

/* -----------------------------------------------------------
   Page d'accueil (non connecté)
   ----------------------------------------------------------- */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.hero p {
    font-size: 1.1rem;
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero .btn-group {
    justify-content: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.feature-card {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.feature-card .feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 0;
}

/* -----------------------------------------------------------
   Auth pages
   ----------------------------------------------------------- */
.auth-container {
    max-width: 420px;
    margin: 2rem auto;
}

.auth-container .card {
    padding: 0;
}

.auth-container .card-body {
    padding: 2rem;
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* -----------------------------------------------------------
   Profil
   ----------------------------------------------------------- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--gray-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--gray);
    flex-shrink: 0;
}

.profile-info h2 {
    margin-bottom: 0.25rem;
}

.profile-info .profile-role {
    color: var(--gray);
    font-size: 0.9rem;
}

/* -----------------------------------------------------------
   Empty state
   ----------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* -----------------------------------------------------------
   Footer
   ----------------------------------------------------------- */
.footer {
    margin-top: auto;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--gray);
    font-size: 0.85rem;
    border-top: 1px solid var(--gray-light);
    background: var(--white);
}

/* -----------------------------------------------------------
   Pagination
   ----------------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--gray-light);
    color: var(--gray);
    background: var(--white);
}

.pagination a:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* -----------------------------------------------------------
   Modal de confirmation
   ----------------------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal h3 {
    margin-bottom: 1rem;
}

.modal p {
    color: var(--gray);
    margin-bottom: 1.5rem;
}

.modal .btn-group {
    justify-content: flex-end;
}

/* -----------------------------------------------------------
   Toast notifications
   ----------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    animation: toastIn 0.3s ease;
    max-width: 350px;
}

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

.toast-success { border-left: 4px solid var(--success); }
.toast-danger { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--info); }

/* -----------------------------------------------------------
   Utilitaires
   ----------------------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.text-success { color: var(--success-dark); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-small { font-size: 0.85rem; }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

/* -----------------------------------------------------------
   Responsive - Tablette
   ----------------------------------------------------------- */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: var(--navbar-height);
        height: calc(100vh - var(--navbar-height));
        z-index: 1500;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content.with-sidebar {
        padding: 1.25rem;
        margin-left: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -----------------------------------------------------------
   Responsive - Mobile
   ----------------------------------------------------------- */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        display: none;
        position: absolute;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        gap: 0.5rem;
        z-index: 999;
    }

    .navbar-menu.open {
        display: flex;
    }

    .navbar-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 0.5rem;
        border-top: 1px solid var(--gray-light);
        width: 100%;
        justify-content: space-between;
    }

    .navbar-link {
        width: 100%;
        padding: 0.5rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .hero h1 { font-size: 1.75rem; }
    .hero { padding: 2.5rem 1rem; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .btn-group {
        width: 100%;
        justify-content: stretch;
    }

    .btn-group .btn {
        flex: 1;
    }
}

/* -----------------------------------------------------------
   Responsive - Petit mobile
   ----------------------------------------------------------- */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .main-content {
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------
   Gestion de Stocks — Styles spécifiques
   ----------------------------------------------------------- */

/* Grille 2 colonnes pour profil */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

/* Checkbox group pour catégories */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.5rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
}

.checkbox-group .form-check {
    margin: 0;
}

/* Séparateur horizontal */
hr {
    border: none;
    border-top: 1px solid var(--gray-light);
}

/* Formulaire avec actions en ligne dans les tableaux */
.table td form {
    display: inline;
}

.table td .d-flex {
    display: flex;
    align-items: center;
}

/* Cartes cliquables améliorées */
.card-link .card {
    height: 100%;
}

.card-link .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

/* Mobile : adaptation des formulaires en ligne */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-container {
        max-width: 100% !important;
        margin: 1rem auto;
    }

    .page-header {
        gap: 0.75rem;
    }

    .page-header .btn-group {
        width: 100%;
    }

    .page-header .btn-group .btn {
        flex: 1;
    }

    /* Tableaux plus lisibles sur mobile */
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .table .btn-group {
        flex-direction: column;
        gap: 0.25rem;
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Formulaire des membres en colonne */
    .table td .d-flex {
        flex-direction: column;
        gap: 0.25rem;
        align-items: stretch;
    }

    .table td select.form-control {
        min-width: auto !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* -----------------------------------------------------------
   Dashboard — Tableau de bord
   ----------------------------------------------------------- */

/* Statistiques rapides */
.dashboard-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    flex: 1;
    min-width: 180px;
}

.stat-card .stat-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.stat-card .stat-info {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--gray);
}

.stat-danger {
    border-left: 4px solid var(--danger);
}
.stat-danger .stat-icon {
    color: var(--danger);
}

.stat-warning {
    border-left: 4px solid var(--warning-dark);
}
.stat-warning .stat-icon {
    color: var(--warning-dark);
}

.dashboard-section {
    margin-bottom: 1.5rem;
}

/* Filtres dashboard */
.dashboard-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--gray);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--gray);
}

.filter-btn.active {
    color: var(--white);
}

.filter-btn-all.active {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-btn-danger.active {
    background: var(--danger);
    border-color: var(--danger);
}

.filter-btn-warning.active {
    background: var(--warning-dark);
    border-color: var(--warning-dark);
}

.filter-btn-success.active {
    background: #047857;
    border-color: #047857;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.75rem;
    font-weight: 600;
}

.filter-btn:not(.active) .filter-count {
    background: var(--gray-lighter);
    color: var(--gray);
}

.text-warning-dark {
    color: var(--warning-dark);
}

/* Légende calendrier */
.calendar-legend {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot-success { background: #06d6a0; }
.legend-dot-warning { background: #ffd166; }
.legend-dot-danger { background: #ef476f; }

/* FullCalendar — surcharges responsive */
#calendar {
    font-size: 0.9rem;
}

.fc .fc-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fc .fc-toolbar-title {
    font-size: 1.1rem !important;
}

.fc .fc-button {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
}

.fc .fc-button-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.fc .fc-button-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.fc .fc-daygrid-event {
    border-radius: var(--border-radius-sm);
    padding: 2px 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc .fc-list-event-title {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .dashboard-stats {
        flex-direction: column;
    }

    .stat-card {
        min-width: 100%;
    }

    #calendar {
        font-size: 0.8rem;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem !important;
        text-align: center;
    }
}
