/*
===============================================================================
STYLES COMMUNS POUR TOUTES LES PAGES - VERSION OPTIMISÉE
Fichier: /static/css/pages/common.css
===============================================================================
*/

/* =====================================================
   FIX SCROLL HORIZONTAL
   ===================================================== */

/* =====================================================
   RESET ET BASE
   ===================================================== */

* {
    box-sizing: border-box;
    font-family: "Roboto", sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
}

footer {
    margin-top: auto;
}

/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */

.container-fluid {
    padding: 0 var(--spacing-xl);
}

.row {
    margin: 0;
}

/* =====================================================
   COMPOSANTS DE BASE
   ===================================================== */

/* Section Title */
.section-title {
    align-items: center;
    display: flex;
}

.section-title .material-icons {
    color: var(--secondary-color);
    font-size: var(--font-3xl);
    margin-right: var(--spacing-xs);
}

/* Material Icons */
.material-icons {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.material-icons.black-icon {
    color: var(--bg-dark);
}

.material-wrapper {
    max-height: 38px;
}

/* =====================================================
   CARTES ET CONTENEURS
   ===================================================== */

/* Client Card */
.client-card {
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    box-shadow: 0 1px 3px var(--shadow-color);
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.client-card::-webkit-scrollbar {
    width: 6px;
}

.client-card::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.client-card::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.client-card::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Card Components */
.card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    background-color: var(--bg-white);
}

.card-header:first-child {
    border-radius: 0;
}

.card-other-solutions {
    background: var(--bg-light);
    border-radius: var(--border-radius-sm) !important;
    padding: var(--spacing-md);
}

.card-other-solutions .material-icons {
    font-size: var(--font-3xl) !important;
}

/* =====================================================
   INFORMATIONS CLIENT
   ===================================================== */

.client-info {
    background-color: var(--bg-light);
    margin: var(--spacing-md);
    padding: var(--spacing-xl) var(--spacing-md);
}

.client-info h3 {
    color: var(--text-dark);
    font-size: var(--font-lg);
    font-weight: 800;
    line-height: 1.5rem;
    margin-bottom: var(--spacing-md);
}

.client-info .btn-light {
    background: var(--bg-primary-light);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-xs);
    transition: all 0.2s ease;
}

.client-info .btn-light:hover {
    background-color: var(--bg-primary-light);
    border-color: var(--border-color);
}

.client-info .id-number {
    color: var(--text-dark);
    font-size: var(--font-lg);
    font-weight: 800;
}

.client-info .copy-icon {
    color: var(--primary-color);
    font-size: var(--font-xl);
    opacity: 0;
    transition: opacity 0.7s ease;
}

.client-info .btn-light:hover .copy-icon {
    opacity: 1;
}

.client-info .btn-light.copied {
    background-color: #e8f5e9;
    border-color: #4caf50;
}

.client-info .copied .material-icons {
    color: green;
}

.client-phones {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.client-phones .phone-number {
    align-items: center;
    color: var(--primary-color);
    display: flex;
    font-size: var(--font-sm);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.client-phones .phone-number:hover {
    color: var(--hover-primary);
}

/* Style pour les numéros de téléphone invalides */
.phone-number.invalid {
    color: #b30607 !important;
    text-decoration: line-through;
    opacity: 0.8;
}

.view-client-link {
    align-items: center;
    color: var(--black-color);
    display: flex;
    font-size: var(--font-sm);
    gap: var(--spacing-xs);
    text-decoration: none;
    transition: color 0.2s ease;
}

.view-client-link:hover {
    color: var(--primary-color);
}

.view-client-link .material-icons {
    font-size: var(--font-xl);
}

/* =====================================================
   FORMULAIRES ET CONTROLES
   ===================================================== */

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem var(--shadow-primary);
}

/* Data Protection */
.data-protection-section {
    background-color: var(--white-color);
    border-radius: var(--border-radius-xs);
    padding: var(--spacing-md);
}

.data-protection-section > div {
    background-color: var(--bg-primary-light);
    padding: var(--spacing-md);
}

.data-protection-title {
    color: var(--text-dark);
    font-size: var(--font-base);
    font-weight: 700;
    line-height: 1.5rem;
    margin-bottom: 0;
    padding-right: var(--spacing-2xl);
}

.data-protection-options {
    gap: var(--spacing-xl);
}

.data-protection-options .form-check {
    margin: 0;
    min-height: auto;
    padding: 0;
}

.data-protection-options .form-check-input {
    border: 2px solid var(--primary-color);
    cursor: pointer;
    height: var(--font-xl);
    margin-right: var(--spacing-sm);
    margin-top: 0;
    width: var(--font-xl);
}

.data-protection-options .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.data-protection-options .form-check-label {
    align-items: center;
    color: var(--black-color);
    cursor: pointer;
    display: inline-flex;
    font-size: var(--font-sm);
    font-weight: 400;
    padding-left: 0;
    width: 85%;
}

.data-protection-options .form-check:hover .form-check-input {
    border-color: var(--hover-primary);
}

.data-protection-options .form-check:hover .form-check-label {
    color: var(--primary-color);
}

/* =====================================================
   NAVIGATION ET ONGLETS
   ===================================================== */

/* Navigation Tabs */
.nav-tabs-section {
    background-color: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    transition: box-shadow 0.3s ease;
}

.nav-tabs-section.sticky {
    box-shadow: 0 2px 8px var(--shadow-color);
}

.nav-tabs {
    border: none;
    background-color: white;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    padding: 0 15px;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--black-color);
    font-weight: 400;
    padding: var(--spacing-md) var(--spacing-md);
    position: relative;
    display: flex;
    align-items: center;
}

.nav-tabs .nav-link:hover {
    background: transparent;
    color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--primary-color);
    color: #0d6efd;
    border-bottom: 3px solid #0d6efd;
    font-weight: 500;
    background-color: var(--bg-white);
    cursor: pointer;
}

.nav-link.customer {
    font-weight: 600;
    color: #212529;
    pointer-events: none;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

/* Tab Content */
.tab-content {
    padding: 15px;
    background-color: white;
}

/* Separator */
.vr {
    display: inline-block;
    align-self: stretch;
    height: 100%;
    height: 25px !important;
    margin-top: 20px;
    border-left: 1px solid #A9AEBC;
    opacity: inherit !important;
}

/* =====================================================
   TABLEAUX
   ===================================================== */

.table thead th {
    background-color: #D5E7F5;
    font-weight: 500;
    color: #495057;
    padding: 10px 15px;
    border-bottom: none;
}

.table td {
    padding: 12px 15px;
    vertical-align: middle;
    background-color: var(--bg-white);
}

/* =====================================================
   BOUTONS ET ACTIONS
   ===================================================== */

/* Nouveau Client Button */
.nouveau-client-btn {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background-color: #005BFF;
    color: white;
    border: none;
}

.nouveau-client-btn .material-icons {
    font-size: 18px;
    margin-right: 5px;
}

/* Icon Buttons */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #005BFF;
    background-color: transparent;
    border: none;
}

.btn-icon:hover {
    background-color: #e9ecef;
    color: #495057;
}

/* Focus visible accessible */
.btn-icon:focus-visible {
    outline: 2px solid var(--primary-color, #005BFF);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0,91,255,0.15);
    z-index: 2;
    background-color: #e7f0ff;
}

/* Delete Button Animated */
.btn-delete-animated {
    display: inline-flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-right: 12px;
    transition: background 0.2s;
    gap: 0;
}

.btn-delete-animated .delete-text {
    opacity: 0;
    max-width: 0;
    white-space: nowrap;
    transition: opacity 0.3s, max-width 0.3s, margin-left 0.3s;
    margin-left: 0;
    pointer-events: none;
    font-size: 1rem;
    display: inline-block;
    padding: 0;
}

.btn-delete-animated:hover .delete-text,
.btn-delete-animated:focus .delete-text {
    opacity: 1;
    max-width: 200px;
    margin-left: 0.5rem;
    pointer-events: auto;
    animation: fadeInRight 0.5s;
    padding-left: 0.5rem;
}

.btn-delete-animated .material-icons {
    transition: color 0.2s;
}

.btn-delete-animated:focus-visible {
    outline: 2px solid #d32f2f;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #d32f2f;
}

/* Back to Top Button */
#back-to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

/* =====================================================
   LISTES ET GROUPES
   ===================================================== */

/* List Group */
.list-group-item {
    border: none;
    border-radius: var(--border-radius-sm) !important;
    margin-bottom: var(--spacing-xs);
}

.list-group-item:last-child {
    margin-bottom: 0;
}

.list-group-custom {
    margin-bottom: 1rem;
}

.list-group-custom:last-child {
    margin-bottom: 0;
}

.list-group-custom .list-group-item {
    background: var(--bg-light);
    border-radius: var(--border-radius-sm) !important;
    padding: var(--spacing-md);
}

.list-group-custom .list-group-item .list-group-line {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
}

.list-group-custom .list-group-item .list-group-line > div {
    margin-right: var(--spacing-xs);
    min-width: 20%;
}

.list-group-custom .list-group-item .list-group-line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.list-group-custom .list-group-item .list-group-line:first-child {
    padding-top: 0;
}

.list-group-options {
    border-left: 1px solid var(--border-color);
    padding-left: var(--spacing-md);
}

.list-group-details {
    width: calc(100% - 60px);
}

/* =====================================================
   DROPDOWNS ET MENUS
   ===================================================== */

.dropdown-edf-response .dropdown-menu {
    padding: var(--spacing-md);
}

.dropdown-edf-response .dropdown-item {
    border-bottom: 1px solid var(--border-gray);
    color: var(--text-dark);
    font-size: var(--font-base);
    font-weight: 400;
    line-height: 1.5rem;
    padding: var(--spacing-xs);
}

.dropdown-edf-response li:last-child .dropdown-item {
    border-bottom: 0;
}

.dropdown-item:hover {
    background: var(--bg-primary-light);
    color: var(--primary-color);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* =====================================================
   BADGES ET STATUTS
   ===================================================== */

.badge .material-icons {
    font-size: var(--font-base);
}

.badge-compteur {
    border-radius: 15px;
    padding: 5px 10px;
    margin-left: 8px;
    font-size: 12px;
    background-color: #DBE5FD !important;
    color: #000 !important;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.status-promise {
    background-color: #6c757d;
    color: white;
}

/* Status Cards */
.status-card {
    text-align: center;
    padding: 1rem;
    transition: all 0.3s;
}

.status-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.status-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--edf-blue);
}

.status-label {
    color: #666;
}

.status-arrow {
    color: var(--edf-orange);
}

.week-info {
    color: #666;
    font-size: 0.9rem;
}

.site-structure .material-icons {
    color: var(--edf-orange);
}

/* =====================================================
   ÉTATS ET UTILITAIRES
   ===================================================== */

/* Empty State */
.empty-state {
    background-color: var(--bg-light);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon {
    display: flex;
    margin: 0;
}

.empty-state .message {
    color: var(--text-primary);
    margin: 0;
    padding-left: var(--spacing-lg);
}

/* Disabled States */
.disabled-tab {
    pointer-events: none;
    color: var(--bs-nav-link-color, #6c757d) !important;
    cursor: default;
}

a.disabled, a[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.5;
}

button[disabled], button[aria-disabled="true"] {
    opacity: 0.5;
}

/* Utility Classes */
.text-x-small {
    font-size: 0.5625rem;
    line-height: 0.75rem;
}

.text-small {
    font-size: var(--font-xs);
}

.bg-light {
    background-color: rgb(238, 241, 242) !important;
}

.bg-light-green {
    background-color: #d4edda;
}

.bg-light-red {
    background-color: #f8d7da;
}

.bg-blue-light {
    background-color: var(--bg-primary-light);
    color: var(--primary-color);
}

.bg-orange {
    background-color: var(--edf-orange) !important;
    color: var(--white-color) !important;
}

/* Utility Classes for Borders */
[class^="border-"] {
    border-color: var(--border-color) !important;
}

.border-top, .border-bottom, .border-left, .border-right {
    border-color: var(--border-color) !important;
}

/* =====================================================
   BARS D'ACTIONS STICKY
   ===================================================== */

.user-table-actions-bar,
.habilitation-table-actions-bar,
.user-table-mde,
.mediation-actions-bar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--white-color);
    border-top: 1px solid var(--bs-gray-300);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.09);
}

/* =====================================================
   ACCESSIBILITÉ
   ===================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.client-card .ref-edf {
    font-size: var(--font-xxs);
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1;
}

/* =====================================================
   COULEURS ET THÈMES
   ===================================================== */

/* Bootstrap overrides for color scheme */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}
.bg-success-light {
    background-color: #e8f9dd !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-purple {
    background-color: var(--bg-purple) !important;
}

.bg-moutard {
    background-color: var(--bg-moutard) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-moutard {
    color: var(--bg-moutard) !important;
}

.text-purple {
    color: var(--bg-purple) !important;
}

.text-warning {
    color: var(--edf-orange) !important;
}

.text-orange {
    color: var(--secondary-color) !important;
}

.bg-dark {
    background-color: var(--bg-dark) !important;
}

.bg-blue {
    background-color: var(--blue-color) !important;
}

.bg-light-blue {
    background-color: var(--bg-body) !important;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
    .container-fluid {
        padding: 0 var(--spacing-md);
    }

    .card-custom-left > div > div {
        min-width: 100%;
    }

    .list-group-custom .list-group-item .list-group-line > div {
        min-width: 100%;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding: 0 var(--spacing-sm);
    }

    .card-header-custom {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .data-protection-options {
        flex-direction: column;
        gap: var(--spacing-md);
    }
}

/* =====================================================
   MENUS DÉROULANTS AVANCÉS
   ===================================================== */

/* Style des menus déroulants principaux */
.navbar-nav .dropdown-menu {
    border: none;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
    min-width: 220px;
    padding: var(--spacing-sm) 0;
}

/* Animation d'apparition */
.navbar-nav .dropdown-menu.show {
    animation: dropdownFadeIn 0.2s ease-out;
}

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

/* Style des éléments du menu déroulant */
.navbar-nav .dropdown-item {
    color: var(--text-dark);
    font-size: var(--font-sm);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.navbar-nav .dropdown-item:hover {
    background-color: var(--bg-primary-light);
    color: var(--primary-color);
    transform: translateX(4px);
}

.navbar-nav .dropdown-item:active {
    background-color: var(--primary-color);
    color: var(--white-color);
}

/* Icônes dans les menus déroulants */
.navbar-nav .dropdown-item i {
    font-size: var(--font-base);
    width: 20px;
    text-align: center;
}

/* Séparateurs dans les menus */
.dropdown-divider {
    margin: var(--spacing-xs) 0;
    border-color: var(--border-color);
}

/* Responsive pour les menus déroulants */
@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: none;
        margin-top: 0;
        padding-left: var(--spacing-lg);
    }
    
    .navbar-nav .dropdown-item:hover {
        transform: none;
    }
}

/* Indicateur visuel pour les menus actifs */
.navbar-nav .dropdown-toggle.active {
    background-color: var(--primary-color);
    color: var(--white-color) !important;
}

.navbar-nav .dropdown-toggle.active .dropdown-toggle::after {
    border-top-color: var(--white-color);
}

/* ============================================
   CLASSES DE TAILLE DE POLICE - ACCESSIBILITÉ
   ============================================ */

/* Petite taille - 87.5% de la taille de base */
body.font-small {
    font-size: 87.5%;
}

/* Taille normale - 100% (valeur par défaut) */
body.font-normal {
    font-size: 100%;
}

/* Grande taille - 112.5% de la taille de base */
body.font-large {
    font-size: 112.5%;
}