/**
 * THEME OXYWEB V3 - Espace Médecin
 * AirO2 Santé - medecin3/
 * Basé sur le cahier des charges Oxyweb v3 (17/12/2025)
 *
 * Palette de couleurs EXACTES selon CDC :
 * - Primary (boutons) : #1976D2 (bleu principal)
 * - Primary dark : #0D47A1 (bleu foncé header)
 * - Accent : #00ACC1 (turquoise/teal - bouton ajouter)
 * - Background : #F5F7FA (fond page)
 * - Card : #FFFFFF
 * - Text Dark : #333333 ou #212121
 * - Text Muted : #666666 ou #757575
 */

/* ===========================================
   VARIABLES CSS - CAHIER DES CHARGES OXYWEB V3
   =========================================== */
:root {
    /* Couleurs principales - BLEU Oxyweb v3 */
    --v3-primary: #1976D2;
    --v3-primary-dark: #0D47A1;
    --v3-primary-light: #42A5F5;

    /* Bleu marine pour nav pills actives */
    --v3-nav-active: #1976D2;

    /* Accent (bouton Ajouter patient) - turquoise/teal */
    --v3-accent: #00ACC1;
    --v3-accent-dark: #00838F;

    /* Fonds */
    --v3-bg-body: #F5F7FA;
    --v3-bg-card: #FFFFFF;
    --v3-bg-login: #003366;

    /* Textes */
    --v3-text-dark: #333333;
    --v3-text-muted: #666666;
    --v3-text-light: #9E9E9E;

    /* Statuts - Couleurs CDC */
    --v3-success: #4CAF50;
    --v3-success-dark: #2E7D32;
    --v3-warning: #FF9800;
    --v3-warning-dark: #F57C00;
    --v3-danger: #F44336;
    --v3-danger-dark: #D32F2F;
    --v3-info: #1976D2;

    /* Bordures */
    --v3-border: #E0E0E0;
    --v3-border-light: #EEEEEE;

    /* Shadows */
    --v3-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --v3-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --v3-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --v3-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Radius */
    --v3-radius-sm: 6px;
    --v3-radius: 8px;
    --v3-radius-lg: 12px;
    --v3-radius-xl: 16px;
    --v3-radius-full: 9999px;

    /* Transitions */
    --v3-transition: all 0.2s ease;
}

/* ===========================================
   RESET & BASE
   =========================================== */
* {
    box-sizing: border-box;
}

body.v3 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--v3-bg-body);
    color: var(--v3-text-dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ===========================================
   PAGE LOGIN V3
   =========================================== */
.v3-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1A1F36 0%, #2D3250 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.v3-login-card {
    background: var(--v3-bg-card);
    border-radius: var(--v3-radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--v3-shadow-lg);
}

.v3-login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.v3-login-logo img {
    height: 50px;
}

.v3-login-logo h1 {
    color: var(--v3-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 10px 0 0 0;
}

.v3-login-logo span {
    display: block;
    color: var(--v3-text-muted);
    font-size: 0.875rem;
    margin-top: 5px;
}

.v3-login-title {
    text-align: center;
    margin-bottom: 30px;
}

.v3-login-title h2 {
    color: var(--v3-text-dark);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.v3-login-title p {
    color: var(--v3-text-muted);
    font-size: 0.875rem;
    margin: 8px 0 0 0;
}

/* ===========================================
   FORMULAIRES V3
   =========================================== */
.v3-form-group {
    margin-bottom: 20px;
}

.v3-form-label {
    display: block;
    color: var(--v3-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.v3-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--v3-border);
    border-radius: var(--v3-radius);
    font-size: 1rem;
    color: var(--v3-text-dark);
    background: var(--v3-bg-card);
    transition: var(--v3-transition);
}

.v3-form-input:focus {
    outline: none;
    border-color: var(--v3-primary);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.v3-form-input::placeholder {
    color: var(--v3-text-light);
}

.v3-form-input-icon {
    position: relative;
}

.v3-form-input-icon .v3-form-input {
    padding-right: 45px;
}

.v3-form-input-icon .icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--v3-text-light);
    cursor: pointer;
}

/* ===========================================
   BOUTONS V3
   =========================================== */
.v3-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--v3-radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--v3-transition);
    text-decoration: none;
}

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

.v3-btn-primary:hover {
    background: var(--v3-primary-dark);
    color: white;
    text-decoration: none;
}

.v3-btn-block {
    width: 100%;
}

.v3-btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.v3-btn-outline {
    background: transparent;
    border: 1px solid var(--v3-border);
    color: var(--v3-text-dark);
}

.v3-btn-outline:hover {
    background: var(--v3-bg-body);
}

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

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

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

/* ===========================================
   HEADER / NAVIGATION V3
   =========================================== */
.v3-header {
    background: var(--v3-bg-card);
    border-bottom: 1px solid var(--v3-border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.v3-header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.v3-header-logo img {
    height: 36px;
}

.v3-header-logo span {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--v3-primary);
}

.v3-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--v3-radius-full);
    color: var(--v3-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: var(--v3-transition);
}

.v3-nav-item:hover {
    background: var(--v3-bg-body);
    color: var(--v3-text-dark);
    text-decoration: none;
}

.v3-nav-item.active {
    background: var(--v3-nav-active);
    color: white;
}

.v3-nav-item i {
    font-size: 1rem;
}

.v3-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.v3-btn-add {
    background: var(--v3-accent);
    color: white;
    padding: 10px 20px;
    border-radius: var(--v3-radius);
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: var(--v3-transition);
}

.v3-btn-add:hover {
    background: var(--v3-accent-dark);
    color: white;
    text-decoration: none;
}

/* Avatar initiales */
.v3-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--v3-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    background: var(--v3-primary);
    cursor: pointer;
}

.v3-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.v3-avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.v3-user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.v3-user-name {
    color: var(--v3-text-dark);
    font-weight: 500;
    font-size: 0.9375rem;
}

/* ===========================================
   CONTENU PRINCIPAL V3
   =========================================== */
.v3-main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.v3-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.v3-page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.v3-page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--v3-text-dark);
    margin: 0;
}

.v3-page-title .count {
    background: var(--v3-bg-body);
    color: var(--v3-text-muted);
    padding: 4px 10px;
    border-radius: var(--v3-radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===========================================
   FILTRES V3 (Pills)
   =========================================== */
.v3-filters {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.v3-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-filter-pill {
    padding: 8px 16px;
    border-radius: var(--v3-radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--v3-transition);
    border: 1px solid var(--v3-border);
    background: var(--v3-bg-card);
    color: var(--v3-text-muted);
    text-decoration: none;
}

.v3-filter-pill:hover {
    background: var(--v3-bg-body);
    text-decoration: none;
}

.v3-filter-pill.active {
    background: var(--v3-text-dark);
    color: white;
    border-color: var(--v3-text-dark);
}

.v3-filter-pill.danger {
    color: var(--v3-danger);
    border-color: var(--v3-danger);
}

.v3-filter-pill.danger.active {
    background: var(--v3-danger);
    color: white;
}

.v3-filter-pill.success {
    color: var(--v3-success);
    border-color: var(--v3-success);
}

.v3-filter-pill.success.active {
    background: var(--v3-success);
    color: white;
}

.v3-filter-pill .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.v3-filter-pill .dot.red { background: #D32F2F; }
.v3-filter-pill .dot.green { background: #4CAF50; }
.v3-filter-pill .dot.orange { background: #F57C00; }

/* Pills colorées CDC Oxyweb v3 */
.v3-filter-pill.red {
    color: #D32F2F;
    border-color: #D32F2F;
}
.v3-filter-pill.red.active {
    background: #D32F2F;
    color: white;
}
.v3-filter-pill.orange {
    color: #F57C00;
    border-color: #F57C00;
}
.v3-filter-pill.orange.active {
    background: #F57C00;
    color: white;
}
.v3-filter-pill.green {
    color: #4CAF50;
    border-color: #4CAF50;
}
.v3-filter-pill.green.active {
    background: #4CAF50;
    color: white;
}

/* Select v3 */
.v3-select {
    padding: 8px 32px 8px 16px;
    border: 1px solid var(--v3-border);
    border-radius: var(--v3-radius);
    font-size: 0.875rem;
    color: var(--v3-text-dark);
    background: var(--v3-bg-card) 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='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
}

/* Vue toggle */
.v3-view-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--v3-bg-body);
    padding: 4px;
    border-radius: var(--v3-radius);
}

.v3-view-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--v3-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--v3-transition);
}

.v3-view-btn.active {
    background: var(--v3-bg-card);
    color: var(--v3-text-dark);
    box-shadow: var(--v3-shadow-sm);
}

/* ===========================================
   CARDS LISTE V3
   =========================================== */
.v3-card {
    background: var(--v3-bg-card);
    border-radius: var(--v3-radius-lg);
    box-shadow: var(--v3-shadow);
    overflow: hidden;
}

.v3-card-body {
    padding: 20px;
}

.v3-list-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--v3-border-light);
    transition: var(--v3-transition);
}

.v3-list-item:hover {
    background: var(--v3-bg-body);
}

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

.v3-list-item-checkbox {
    margin-right: 16px;
}

.v3-list-item-avatar {
    margin-right: 16px;
}

.v3-list-item-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 24px;
}

.v3-list-item-main {
    min-width: 200px;
}

.v3-list-item-name {
    font-weight: 600;
    color: var(--v3-text-dark);
    margin: 0 0 4px 0;
}

.v3-list-item-name a {
    color: inherit;
    text-decoration: none;
}

.v3-list-item-name a:hover {
    color: var(--v3-primary);
}

.v3-list-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--v3-text-muted);
}

.v3-list-item-meta i {
    color: var(--v3-text-light);
}

/* Badges v3 - Couleurs EXACTES CDC Oxyweb v3 */
.v3-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.v3-badge-primary {
    background: #E3F2FD;
    color: #1976D2;
}

/* À signer - Vert */
.v3-badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}

/* À contrôler - Orange */
.v3-badge-warning {
    background: #FFF3E0;
    color: #F57C00;
}

/* En retard - Rouge */
.v3-badge-danger {
    background: #FFEBEE;
    color: #D32F2F;
}

.v3-badge-info {
    background: #E3F2FD;
    color: #1976D2;
}

/* Signée - Gris */
.v3-badge-gray {
    background: #F5F5F5;
    color: #757575;
}

/* Actif - Vert texte */
.v3-badge-actif {
    background: transparent;
    color: #4CAF50;
}

/* Inactif - Gris texte */
.v3-badge-inactif {
    background: transparent;
    color: #9E9E9E;
}

/* Données colonnes */
.v3-list-item-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 80px;
}

.v3-list-item-col-label {
    font-size: 0.6875rem;
    color: var(--v3-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.v3-list-item-col-value {
    font-weight: 500;
    color: var(--v3-text-dark);
}

.v3-list-item-col-value.success { color: var(--v3-success); }
.v3-list-item-col-value.warning { color: var(--v3-warning); }
.v3-list-item-col-value.danger { color: var(--v3-danger); }

/* Actions */
.v3-list-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ===========================================
   TABLEAU V3
   =========================================== */
.v3-table {
    width: 100%;
    border-collapse: collapse;
}

.v3-table thead th {
    background: var(--v3-bg-body);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--v3-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--v3-border);
}

.v3-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--v3-border-light);
    vertical-align: middle;
}

.v3-table tbody tr:hover {
    background: var(--v3-bg-body);
}

/* ===========================================
   PAGINATION V3
   =========================================== */
.v3-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--v3-border-light);
}

.v3-pagination-info {
    color: var(--v3-text-muted);
    font-size: 0.875rem;
}

.v3-pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-pagination-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--v3-border);
    border-radius: var(--v3-radius);
    background: var(--v3-bg-card);
    color: var(--v3-text-muted);
    cursor: pointer;
    transition: var(--v3-transition);
}

.v3-pagination-btn:hover {
    background: var(--v3-bg-body);
}

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

/* ===========================================
   FICHE PATIENT V3
   =========================================== */
.v3-patient-header {
    background: var(--v3-bg-card);
    border-radius: var(--v3-radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--v3-shadow);
}

.v3-patient-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.v3-patient-identity {
    display: flex;
    align-items: center;
    gap: 16px;
}

.v3-patient-info h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-patient-details {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--v3-text-muted);
}

.v3-patient-details i {
    margin-right: 4px;
}

.v3-metrics-wrapper {
    display: flex;
    align-items: center;
    gap: 32px;
}

.v3-patient-metrics {
    display: flex;
    gap: 32px;
}

.v3-metric {
    text-align: center;
}

.v3-metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--v3-primary);
}

.v3-metric-value.success { color: var(--v3-success); }
.v3-metric-value.warning { color: var(--v3-warning); }
.v3-metric-value.danger { color: var(--v3-danger); }

.v3-metric-label {
    font-size: 0.75rem;
    color: var(--v3-text-muted);
}

.v3-metric-sub {
    font-size: 0.6875rem;
    color: var(--v3-text-light);
}

/* Onglets patient */
.v3-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--v3-border);
    margin-bottom: -1px;
}

.v3-tab {
    padding: 12px 20px;
    color: var(--v3-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    border-bottom: 2px solid transparent;
    transition: var(--v3-transition);
}

.v3-tab:hover {
    color: var(--v3-text-dark);
    text-decoration: none;
}

.v3-tab.active {
    color: var(--v3-primary);
    border-bottom-color: var(--v3-primary);
}

/* ===========================================
   ALERTES V3
   =========================================== */
.v3-alert {
    padding: 16px 20px;
    border-radius: var(--v3-radius);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.v3-alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--v3-info);
}

.v3-alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--v3-success);
}

.v3-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--v3-warning);
}

.v3-alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--v3-danger);
}

/* ===========================================
   EMPTY STATE V3
   =========================================== */
.v3-empty {
    text-align: center;
    padding: 60px 20px;
}

.v3-empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    background: var(--v3-bg-body);
    border-radius: var(--v3-radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
}

.v3-empty-icon i {
    font-size: 3rem;
    color: var(--v3-primary-light);
}

.v3-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--v3-text-dark);
    margin: 0 0 8px 0;
}

.v3-empty p {
    color: var(--v3-text-muted);
    margin: 0 0 20px 0;
}

/* ===========================================
   SIGNATURE SIMPLIFIÉE V3
   =========================================== */
.v3-signature-banner {
    background: var(--v3-bg-card);
    border: 1px solid var(--v3-border);
    border-radius: var(--v3-radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--v3-transition);
}

.v3-signature-banner:hover {
    border-color: var(--v3-primary);
}

.v3-signature-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.v3-signature-banner-icon {
    width: 40px;
    height: 40px;
    background: var(--v3-bg-body);
    border-radius: var(--v3-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--v3-primary);
}

.v3-signature-banner-text h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.v3-signature-banner-text p {
    font-size: 0.8125rem;
    color: var(--v3-text-muted);
    margin: 0;
}

/* ===========================================
   PAGES DE LISTE V3 - PATTERNS COMMUNS
   (index.php, mes_ordonnances.php, signature_electronique.php)
   =========================================== */

/* En-tête avec filtres alignés à droite */
.v3-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.v3-list-header-content {
    width: 100%;
}

.v3-list-filters {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

/* Moteur de recherche avec icône */
.v3-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-search-input-wrapper {
    position: relative;
}

.v3-search-input {
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--v3-border);
    border-radius: 8px;
    font-size: 0.875rem;
    width: 280px;
    background: white;
}

.v3-search-input:focus {
    outline: none;
    border-color: var(--v3-primary);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.v3-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--v3-text-muted);
}

.v3-search-btn {
    padding: 10px 16px;
    background: var(--v3-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--v3-transition);
}

.v3-search-btn:hover {
    background: var(--v3-primary-dark);
}

.v3-reset-btn {
    padding: 10px 16px;
    background: #F1F5F9;
    color: var(--v3-text-dark);
    border-radius: 8px;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--v3-transition);
}

.v3-reset-btn:hover {
    background: #E2E8F0;
    text-decoration: none;
}

/* Select filtres */
.v3-filter-select {
    padding: 10px 16px;
    border: 1px solid var(--v3-border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

/* Container tableau (card blanche) */
.v3-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    overflow-x: auto;
}

/* Tableau liste */
.v3-list-table {
    width: 100%;
    border-collapse: collapse;
}

.v3-list-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--v3-text-muted);
    text-transform: uppercase;
    background: #F8FAFC;
    border-bottom: 1px solid var(--v3-border);
}

.v3-list-table th.text-right {
    text-align: right;
}

.v3-list-table td {
    padding: 16px;
    border-bottom: 1px solid #F1F5F9;
}

.v3-list-table tr:last-child td {
    border-bottom: none;
}

/* Lien patient dans tableau */
.v3-patient-link {
    font-weight: 600;
    color: var(--v3-text-dark);
    text-decoration: none;
}

.v3-patient-link:hover {
    color: var(--v3-primary);
}

/* Sous-info patient (date naissance, NIR) */
.v3-patient-meta {
    font-size: 0.75rem;
    color: var(--v3-text-muted);
    margin-top: 2px;
}

.v3-patient-meta .nir {
    font-family: monospace;
}

/* État vide */
.v3-empty-state {
    background: white;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
}

.v3-empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #F1F5F9;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v3-empty-state-icon i {
    font-size: 2rem;
    color: var(--v3-primary-light);
}

.v3-empty-state-icon.search {
    background: #FEF3C7;
}

.v3-empty-state-icon.search i {
    color: #F59E0B;
}

.v3-empty-state-icon.success {
    background: #F1F5F9;
}

.v3-empty-state-icon.success i {
    color: var(--v3-success);
}

.v3-empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.v3-empty-state p {
    color: var(--v3-text-muted);
    margin: 0;
}

/* Légende en bas de page */
.v3-legend {
    background: #F8FAFC;
    border-radius: 12px;
    margin-top: 24px;
    padding: 20px;
}

.v3-legend-content {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    font-size: 0.8125rem;
}

.v3-legend-section {
    display: flex;
    flex-direction: column;
}

.v3-legend-title {
    font-weight: 600;
    color: var(--v3-text-dark);
    margin-bottom: 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.v3-legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--v3-text-muted);
}

.v3-legend-items.horizontal {
    flex-direction: row;
    gap: 16px;
}

/* Alerte danger (éligibilité signature) */
.v3-alert-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.v3-alert-box.danger {
    background: #FEF2F2;
    border: 1px solid #FECACA;
}

.v3-alert-box.danger i {
    color: #DC2626;
    font-size: 1.25rem;
    margin-top: 2px;
}

.v3-alert-box.danger strong {
    color: #991B1B;
}

.v3-alert-box.danger span {
    color: #7F1D1D;
}

.v3-alert-box.danger small {
    color: #991B1B;
}

/* Cards stats (mes_ordonnances.php) */
.v3-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.v3-stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    text-align: center;
    border: 2px solid transparent;
    transition: var(--v3-transition);
}

.v3-stat-card:hover {
    border-color: var(--v3-border);
}

.v3-stat-card.active-warning {
    border-color: #F59E0B;
}

.v3-stat-card.active-primary {
    border-color: #3B82F6;
}

.v3-stat-card.active-success {
    border-color: #22C55E;
}

.v3-stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.v3-stat-value.warning { color: #F59E0B; }
.v3-stat-value.primary { color: #3B82F6; }
.v3-stat-value.success { color: #22C55E; }

.v3-stat-label {
    font-size: 0.75rem;
    color: var(--v3-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Ligne surlignée (jaune pour "À signer") */
.v3-list-table tr.highlight-warning {
    background: linear-gradient(90deg, #FEF3C7 0%, #FFFBEB 100%);
}

.v3-list-table tr.highlight-muted {
    opacity: 0.5;
    background: #F8F8F8;
}

/* Bouton action dans tableau */
.v3-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--v3-transition);
}

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

.v3-action-btn.success {
    background: #22C55E;
    color: white;
}

.v3-action-btn.warning {
    background: #F59E0B;
    color: white;
}

.v3-action-btn.danger {
    background: #DC2626;
    color: white;
}

.v3-action-btn.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #F1F5F9;
    color: var(--v3-text-muted);
}

.v3-action-btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

/* ===========================================
   BADGES ORDONNANCES (ordonnance_helper.php)
   =========================================== */

/* Badges statut signature */
.badge-sign-brouillon {
    background: #E5E7EB;
    color: #374151;
}

.badge-sign-en-cours {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-sign-a-signer {
    background: #FEF3C7;
    color: #92400E;
}

.badge-sign-signe {
    background: #D1FAE5;
    color: #065F46;
}

.badge-sign-annule {
    background: #FEE2E2;
    color: #991B1B;
}

/* Badges mode ordonnance (famille) */
.badge-ordo-o2 {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-ordo-ppc {
    background: #F3E8FF;
    color: #6B21A8;
}

.badge-ordo-vni {
    background: #FEF3C7;
    color: #92400E;
}

.badge-ordo-aerosol {
    background: #D1FAE5;
    color: #065F46;
}

.badge-ordo-aspiration {
    background: #FFE4E6;
    color: #9F1239;
}

/* Badge base pour ordonnances */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge i {
    font-size: 0.7rem;
}

/* Badges statut execution */
.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-primary {
    background: #E0E7FF;
    color: #3730A3;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-secondary {
    background: #E5E7EB;
    color: #374151;
}

/* ===========================================
   RECHERCHE ROW (signature_electronique)
   =========================================== */
.v3-search-row {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.v3-search-row .v3-search-input-wrapper {
    flex: 1;
    min-width: 200px;
}

.v3-search-row .v3-search-btn {
    padding: 10px 18px;
}

.v3-filter-toggle-btn {
    padding: 10px 14px;
    background: #f3f4f6;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
}

/* ===========================================
   GRILLE RÉSUMÉ FICHE PATIENT
   =========================================== */
.v3-resume-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ===========================================
   SPLIT VIEW (Documents / Rapports)
   =========================================== */
.v3-split-view {
    display: flex;
    gap: 24px;
    height: calc(100vh - 340px);
    min-height: 400px;
}

.v3-split-preview {
    flex: 0 0 65%;
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===========================================
   GRILLE 4 COLONNES
   =========================================== */
.v3-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.v3-split-list {
    flex: 0 0 35%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 1024px) {
    .v3-header {
        padding: 0 16px;
    }

    .v3-nav {
        display: none;
    }

    .v3-main {
        padding: 16px;
    }

    .v3-list-item-content {
        flex-wrap: wrap;
        gap: 12px;
    }

    .v3-patient-metrics {
        flex-wrap: wrap;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .v3-login-card {
        padding: 30px 24px;
    }

    .v3-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .v3-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .v3-patient-top {
        flex-direction: column;
        gap: 20px;
    }

    /* Métriques observance : grille 2x2 + sélecteur en dessous */
    .v3-metrics-wrapper {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .v3-patient-metrics {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .v3-metric-value {
        font-size: 1.1rem;
    }

    .v3-metrics-wrapper .v3-select {
        width: 100%;
    }

    .v3-tabs {
        flex-wrap: wrap;
        gap: 6px;
        border-bottom: none;
        padding: 4px 0;
    }

    .v3-tab {
        padding: 6px 12px;
        font-size: 0.75rem;
        border-bottom: none;
        background: #f1f5f9;
        border-radius: 20px;
        color: var(--v3-text-muted);
    }

    .v3-tab.active {
        background: var(--v3-primary);
        color: white;
        border-bottom-color: transparent;
    }

    /* Recherche mobile : pleine largeur */
    .v3-list-filters {
        justify-content: stretch;
    }

    .v3-search-form {
        width: 100%;
    }

    .v3-search-input-wrapper {
        flex: 1;
        min-width: 0;
    }

    .v3-search-input {
        width: 100%;
    }

    /* Recherche row mobile (signature_electronique) */
    .v3-search-row {
        flex-wrap: wrap;
    }

    .v3-search-row .v3-search-input-wrapper {
        min-width: 0;
        flex-basis: 100%;
    }

    .v3-search-row .v3-search-btn {
        flex: 1;
    }

    .v3-filter-toggle-btn {
        flex: 1;
    }

    /* Grille résumé fiche patient : 1 colonne en mobile */
    .v3-resume-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Split-view Documents/Rapports : empilé en mobile */
    .v3-split-view {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .v3-split-preview {
        flex: none;
        height: 300px;
    }

    .v3-split-list {
        flex: none;
    }

    /* Grille 4 colonnes → 2 en mobile */
    .v3-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Pagination mobile */
    .v3-pagination {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        padding: 12px;
    }

    .v3-pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .v3-pagination-btn {
        width: 36px;
        height: 36px;
    }

    /* Header patient : infos empilées en mobile */
    .v3-patient-details {
        flex-direction: column;
        gap: 4px;
    }

    .v3-patient-details span {
        word-break: break-all;
    }

    .v3-patient-info h2 {
        font-size: 1.1rem;
    }
}
