// Variables ESTAIR Modern Design
$estair-blue: #4AA8DC;
$estair-blue-dark: #3B82F6;
$estair-green: #8DA969;
$tblr-bg: #f8fafc;
$tblr-surface: #ffffff;
$tblr-surface-secondary: #fafbfc;
$tblr-surface-tertiary: #f1f5f9;
$tblr-border-color: #e6e7e9;
$tblr-border-color-light: #f1f5f9;
$tblr-body-color: #1e293b;
$tblr-muted: #64748b;
$tblr-light: #94a3b8;
$shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

::ng-deep .mat-tooltip {
  font-size: 14px !important;
}

// Design moderne
.edit-details.modern-design {
  background: $tblr-bg;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: $tblr-body-color;

  // Variables utilitaires
  .text-primary { color: $estair-blue !important; }
  .text-success { color: #2fb344 !important; }
  .fw-bold { font-weight: 600 !important; }
  .text-muted { color: $tblr-muted !important; }

  // ===========================
  // ENTITY HEADER
  // ===========================
  .entity-header {
    background: $tblr-surface;
    color: $tblr-body-color;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    border: 1px solid $tblr-border-color;
    box-shadow: $shadow-md;

    .loading-indicator {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 10;
      border-radius: 12px 12px 0 0;
    }

    .entity-content {
      position: relative;
      z-index: 1;
      display: flex;
      align-items: flex-start;
      gap: 1.5rem;
    }

    .entity-avatar {
      width: 4rem;
      height: 4rem;
      background: linear-gradient(135deg, $estair-blue, $estair-green);
      border-radius: 0.75rem;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      font-weight: 700;
      color: white;
      box-shadow: 0 2px 8px rgba(74, 168, 220, 0.2);
      flex-shrink: 0;
    }

    .entity-info {
      flex: 1;
      min-width: 0;
    }

    .entity-title {
      font-size: 1.5rem;
      font-weight: 700;
      margin-bottom: 0.375rem;
      line-height: 1.2;
      color: $tblr-body-color;
    }

    .entity-subtitle {
      font-size: 0.875rem;
      color: $tblr-muted;
      margin-bottom: 1rem;
    }

    .entity-badges {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .entity-badge {
      background: $tblr-surface-secondary;
      color: $tblr-muted;
      border: 1px solid $tblr-border-color;
      padding: 0.375rem 0.75rem;
      border-radius: 0.75rem;
      font-size: 0.75rem;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 0.375rem;

      mat-icon {
        font-size: 14px;
        width: 14px;
        height: 14px;
      }
    }

    .entity-actions {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .entity-action {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      padding: 0.5rem 1rem;
      border-radius: 0.375rem;
      font-size: 0.75rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
      border: 1px solid $tblr-border-color;
      background: $tblr-surface;
      color: $tblr-body-color;

      .dropdown-icon {
        margin-left: 0.25rem;
        font-size: 18px;
        width: 18px;
        height: 18px;
      }

      &:hover {
        transform: translateY(-1px);
        box-shadow: $shadow-md;
      }

      &.primary {
        background: $estair-blue;
        border-color: $estair-blue;
        color: white;

        &:hover {
          background: $estair-blue-dark;
          border-color: $estair-blue-dark;
        }
      }

      &.success {
        background: #10B981;
        border-color: #10B981;
        color: white;

        &:hover {
          background: #059669;
          border-color: #059669;
        }
      }

      &.danger {
        background: #dc3545;
        border-color: #dc3545;
        color: white;

        &:hover {
          background: #c82333;
          border-color: #c82333;
        }
      }

      mat-icon {
        font-size: 16px;
        width: 16px;
        height: 16px;
      }
    }

    // Groupe boutons Execute avec dropdown
    .execute-button-group {
      display: flex;
      position: relative;

      .execute-main {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        border-right: none;
        min-width: auto;
      }

      .execute-dropdown {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-left: 1px solid rgba(255, 255, 255, 0.2);
        padding: 0.5rem 0.375rem;
        min-width: auto;

        mat-icon {
          font-size: 14px;
          width: 14px;
          height: 14px;
        }
      }

      &:hover {
        .execute-main,
        .execute-dropdown {
          transform: translateY(-1px);
          box-shadow: $shadow-md;
        }
      }
    }

    .close-btn {
      position: absolute;
      top: 1rem;
      right: 1rem;
      width: 2rem;
      height: 2rem;
      border: none;
      background: $tblr-surface-tertiary;
      border-radius: 0.375rem;
      color: $tblr-muted;

      &:hover {
        background: $tblr-border-color;
      }
    }
  }

  // ===========================
  // CARDS
  // ===========================
  .card {
    background: $tblr-surface;
    border: 1px solid $tblr-border-color;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.15s ease;

    &:hover {
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
  }

  .card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid $tblr-border-color;
    background: $tblr-surface-secondary;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: $tblr-body-color;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    mat-icon {
      color: $estair-blue;
      font-size: 20px;
      width: 20px;
      height: 20px;
    }
  }

  .card-body {
    padding: 1.25rem;
  }

  .card-footer {
    padding: 0.75rem 1.25rem;
    background: $tblr-surface-secondary;
    border-top: 1px solid $tblr-border-color;
    border-radius: 0 0 8px 8px;

    .footer-info {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }

  .card-actions {
    display: flex;
    gap: 0.5rem;
  }

  // ===========================
  // DATAGRID
  // ===========================
  .datagrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
  }

  .datagrid-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: $tblr-surface-secondary;
    border: 1px solid $tblr-border-color-light;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
    cursor: pointer;

    &:hover {
      background: rgba(74, 168, 220, 0.05);
      border-color: $estair-blue;
      transform: translateX(2px);
    }
  }

  .datagrid-title {
    font-weight: 500;
    color: $tblr-muted;
    margin-bottom: 0.125rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex: 0 0 35%;
  }

  .datagrid-content {
    font-weight: 600;
    color: $tblr-body-color;
    flex: 1;
    text-align: right;
  }

  // ===========================
  // TABS MODERNES
  // ===========================
  .nav-tabs {
    border-bottom: 1px solid $tblr-border-color;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: $tblr-muted;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.375rem 0.375rem 0 0;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;

    &:hover {
      color: $estair-blue;
      background: $tblr-surface-secondary;
      border-color: $tblr-border-color;
    }

    &.active {
      color: $estair-blue;
      background: $tblr-surface;
      border-color: $tblr-border-color $tblr-border-color $tblr-surface;
      border-bottom-color: $tblr-surface;
      margin-bottom: -1px;
    }

    mat-icon {
      font-size: 16px;
      width: 16px;
      height: 16px;
    }
  }

  .tab-badge {
    background: rgba(74, 168, 220, 0.1);
    color: $estair-blue;
    padding: 0.125rem 0.5rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;

    &.bg-secondary {
      background: rgba(108, 117, 125, 0.1);
      color: #6c757d;
    }
  }

  .nav-link.active .tab-badge {
    background: $estair-blue;
    color: white;
  }

  .tab-content {
    min-height: 200px;
  }

  .tab-pane {
    display: none;

    &.active {
      display: block;
      animation: fadeIn 0.3s ease-out;
    }
  }

  .tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;

    h4 {
      font-size: 1.125rem;
      font-weight: 600;
      color: $tblr-body-color;
      margin: 0;
    }

    .tab-info {
      display: flex;
      align-items: center;
      gap: 1rem;

      .data-count {
        color: $tblr-muted;
        font-size: 0.875rem;
      }
    }

    .tab-actions {
      display: flex;
      gap: 0.5rem;
    }
  }

  .add-contextual-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;

    mat-icon {
      font-size: 16px;
      width: 16px;
      height: 16px;
    }
  }

  // ===========================
  // EMPTY STATE
  // ===========================
  .empty-state {
    text-align: center;
    padding: 2rem;

    h4 {
      font-size: 1.125rem;
      font-weight: 600;
      color: $tblr-body-color;
      margin-bottom: 1rem;
    }
  }

  .empty-tabs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }

  .empty-tab-card {
    background: $tblr-surface-secondary;
    border: 1px solid $tblr-border-color;
    border-radius: 0.5rem;
    padding: 1rem;
    transition: all 0.15s ease;

    &:hover {
      border-color: $estair-blue;
      transform: translateY(-2px);
    }
  }

  .empty-tab-content {
    text-align: center;
    margin-bottom: 0.75rem;

    .empty-icon {
      font-size: 2rem;
      width: 2rem;
      height: 2rem;
      color: $tblr-muted;
      margin-bottom: 0.5rem;
    }

    .empty-tab-name {
      display: block;
      font-weight: 500;
      color: $tblr-body-color;
      margin-bottom: 0.25rem;
    }

    .empty-tab-status {
      font-size: 0.75rem;
      color: $tblr-muted;
    }
  }

  .empty-tab-actions {
    text-align: center;

    .create-contextual-btn {
      width: 2rem;
      height: 2rem;

      mat-icon {
        font-size: 16px;
        width: 16px;
        height: 16px;
      }
    }
  }

  // ===========================
  // ANIMATIONS
  // ===========================
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .card {
    animation: fadeIn 0.3s ease-out;
  }

  .datagrid-item {
    animation: slideIn 0.2s ease-out;
  }

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

  // ===========================
  // ACCORDION STYLES
  // ===========================
  .accordion-card {
    .accordion-header {
      cursor: pointer;
      transition: all 0.2s ease;
      user-select: none;
      display: flex;
      align-items: center;
      justify-content: space-between;

      &:hover {
        background-color: $tblr-surface-tertiary;
      }

      &.expanded {
        border-bottom: 1px solid $tblr-border-color-light;
      }

      .card-title {
        flex: 1;
        margin: 0;
      }

      .card-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }

      .accordion-toggle {
        display: flex;
        align-items: center;
        color: $tblr-muted;
        transition: transform 0.2s ease, color 0.2s ease;

        mat-icon {
          font-size: 1.25rem;
          width: 1.25rem;
          height: 1.25rem;
        }

        &:hover {
          color: #4AA8DC;
        }
      }

      &.expanded .accordion-toggle {
        color: #4AA8DC;
      }
    }

    .accordion-body {
      overflow: hidden;
      transition: all 0.3s ease-in-out;
    }
  }

  // ===========================
  // RESPONSIVE
  // ===========================
  @media (max-width: 768px) {
    .entity-header {
      padding: 1rem;

      .entity-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
      }

      .entity-avatar {
        align-self: center;
      }

      .entity-actions {
        justify-content: center;
      }
    }

    .card-body {
      padding: 1rem;
    }

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

    .nav-tabs {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    .nav-link {
      white-space: nowrap;
    }
  }

  @media (max-width: 480px) {
    .entity-title {
      font-size: 1.25rem;
    }

    .entity-badges {
      justify-content: center;
    }

    .entity-actions {
      flex-direction: column;
      width: 100%;
    }

    .entity-action {
      justify-content: center;
    }
  }
}

// Header moderne - Couleurs ESTAIR
.detail-header {
  &.modern-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #495057;
    border-radius: 0 0 8px 8px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    border-bottom: 3px solid;
    border-image: linear-gradient(90deg, #007bff 0%, #28a745 100%) 1;
    
    .loading-indicator {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 10;
    }
    
    .header-controls {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 24px;
      
      .design-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        background: #e9ecef;
        padding: 8px 16px;
        border-radius: 8px;
        border: 1px solid #ced4da;
        
        .toggle-design-btn {
          color: #007bff;
        }
        
        .design-label {
          font-size: 0.875rem;
          font-weight: 500;
          color: #495057;
        }
      }
      
      .header-actions {
        display: flex;
        gap: 16px;
        align-items: center;
        
        .ctas-container {
          display: flex;
          gap: 12px;
          align-items: center;
          
          .cta-btn {
            min-width: 120px;
            height: 40px;
            padding: 8px 16px;
            border-radius: 4px;
            font-weight: 500;
            font-size: 0.875rem;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s ease;
            text-transform: none;
            border: none;
            
            mat-icon {
              font-size: 18px;
              width: 18px;
              height: 18px;
            }
            
            span {
              display: inline-block;
            }
            
            &:hover {
              box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            }
          }
          
          // Boutons principaux avec couleurs simples
          .generate-btn {
            background-color: #007bff;
            color: white;
            
            &:hover {
              background-color: #0056b3;
            }
          }
          
          .update-btn {
            background-color: #28a745;
            color: white;
            
            &:hover {
              background-color: #1e7e34;
            }
          }
          
          .delete-btn {
            background-color: #e74c3c; // Rouge-orange
            color: white;
            
            &:hover {
              background-color: #c0392b; // Rouge-orange plus foncé
            }
          }
        }
        
        // Dropdown d'actions
        .actions-dropdown {
          display: inline-block;
          
          .actions-btn {
            min-width: 120px;
            height: 40px;
            padding: 8px 16px;
            border-radius: 4px;
            font-weight: 500;
            font-size: 0.875rem;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s ease;
            text-transform: none;
            background-color: #6c757d;
            color: white;
            border: none;
            
            mat-icon {
              font-size: 18px;
              width: 18px;
              height: 18px;
              
              &.dropdown-arrow {
                font-size: 16px;
                width: 16px;
                height: 16px;
                margin-left: 2px;
              }
            }
            
            &:hover {
              background-color: #5a6268;
              box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            }
          }
        }
        
        .close-btn {
          color: #6c757d;
          margin-left: 8px;
          
          &:hover {
            color: #dc3545;
            background: rgba(220, 53, 69, 0.1);
          }
        }
      }
      
      // Responsive pour les CTAs
      @media (max-width: 768px) {
        .header-actions {
          gap: 8px;
          
          .ctas-container {
            gap: 6px;
            
            .cta-btn {
              min-width: 100px;
              height: 36px;
              padding: 6px 12px;
              font-size: 0.75rem;
            }
          }
          
          .actions-dropdown .actions-btn {
            min-width: 100px;
            height: 36px;
            padding: 6px 12px;
            font-size: 0.75rem;
          }
        }
      }
    }
    
    .modern-header-content {
      .entity-info {
        display: flex;
        align-items: flex-start;
        gap: 20px;
        
        .entity-avatar {
          background: linear-gradient(135deg, #007bff 0%, #28a745 100%);
          border-radius: 16px;
          width: 80px;
          height: 80px;
          display: flex;
          align-items: center;
          justify-content: center;
          box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
          
          mat-icon {
            font-size: 48px;
            width: 48px;
            height: 48px;
            color: white;
          }
        }
        
        .entity-details {
          flex: 1;
          
          .entity-title {
            margin: 0 0 8px 0;
            font-size: 2rem;
            font-weight: 600;
            color: #212529;
          }
          
          .entity-subtitle {
            margin: 0 0 16px 0;
            color: #6c757d;
            font-size: 1rem;
            font-weight: 500;
          }
          
          .entity-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            
            .badge {
              background: #e3f2fd;
              color: #1565c0;
              border: 1px solid #bbdefb;
              padding: 4px 12px;
              border-radius: 12px;
              font-size: 0.875rem;
              font-weight: 500;
              
              &:nth-child(even) {
                background: #e8f5e8;
                color: #2e7d32;
                border-color: #c8e6c9;
              }
            }
          }
        }
      }
    }
  }
  
  &.classic-header {
    .header-controls {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px;
      border-bottom: 1px solid #e0e0e0;
      
      .design-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
      }
    }
  }
}

// Styles pour les champs/valeurs 1/3 - 2/3 avec mise en avant subtile
::ng-deep .field-value-item {
  .mat-list-item-content {
    display: flex !important;
    align-items: center !important;
    padding: 8px 16px !important;
    background: linear-gradient(90deg, #f8f9fa 0%, #f8f9fa 33%, #ffffff 33%, #ffffff 100%);
    border-radius: 4px;
    margin: 2px 0;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
  }
  
  &:hover .mat-list-item-content {
    background: linear-gradient(90deg, #e9ecef 0%, #e9ecef 33%, #f8f9fa 33%, #f8f9fa 100%);
    border-left-color: #dee2e6;
    transform: translateX(2px);
  }
  
  .field-label {
    flex: 0 0 33.333% !important; // 1/3 de l'espace
    font-weight: 500;
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
  }
  
  .field-value {
    flex: 1 1 66.666% !important; // 2/3 de l'espace
    color: #212529;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0, 123, 255, 0.02);
    padding: 4px 8px;
    border-radius: 3px;
    border-left: 2px solid #e3f2fd;
    
    &:empty {
      background: rgba(108, 117, 125, 0.1);
      border-left-color: #e9ecef;
      
      &::before {
        content: '—';
        color: #adb5bd;
        font-style: italic;
      }
    }
    
    // Couleurs selon le type de contenu
    &[title*="@"] { // Email détecté
      background: rgba(23, 162, 184, 0.05);
      border-left-color: #bee5eb;
      color: #0c5460;
    }
    
    &[title*="http"] { // URL détectée
      background: rgba(40, 167, 69, 0.05);
      border-left-color: #c3e6cb;
      color: #155724;
    }
  }
}

// Styles pour les blocs accordéons avec mise en avant subtile
::ng-deep .bloc-field-value-item {
  .mat-list-item-content {
    display: flex !important;
    align-items: center !important;
    padding: 6px 12px !important;
    background: linear-gradient(90deg, rgba(248, 249, 250, 0.5) 0%, rgba(248, 249, 250, 0.5) 33%, rgba(255, 255, 255, 0.8) 33%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 3px;
    margin: 1px 0;
    transition: all 0.15s ease;
  }
  
  &:hover .mat-list-item-content {
    background: linear-gradient(90deg, rgba(233, 236, 239, 0.7) 0%, rgba(233, 236, 239, 0.7) 33%, rgba(248, 249, 250, 0.9) 33%, rgba(248, 249, 250, 0.9) 100%);
    transform: translateX(1px);
  }
  
  .bloc-field-label {
    flex: 0 0 33.333% !important; // 1/3 de l'espace
    font-weight: 500;
    color: #6c757d;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
  }
  
  .bloc-field-value {
    flex: 1 1 66.666% !important; // 2/3 de l'espace
    color: #495057;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0, 123, 255, 0.015);
    padding: 2px 6px;
    border-radius: 2px;
    border-left: 1px solid rgba(0, 123, 255, 0.1);
    
    &:empty {
      background: rgba(108, 117, 125, 0.05);
      border-left-color: rgba(108, 117, 125, 0.2);
      
      &::before {
        content: '—';
        color: #adb5bd;
        font-style: italic;
      }
    }
  }
}

// Styles pour les onglets contextuels
::ng-deep .contextual-tabs {
  .mat-tab-header {
    border-bottom: 1px solid #e0e0e0;
    
    .mat-tab-list {
      overflow-x: auto;
      overflow-y: hidden;
      
      &::-webkit-scrollbar {
        height: 4px;
      }
      
      &::-webkit-scrollbar-track {
        background: #f5f5f5;
      }
      
      &::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
        
        &:hover {
          background: #999;
        }
      }
    }
    
    .mat-tab-label {
      min-width: 120px;
      max-width: 200px;
      padding: 12px 16px;
      
      .tab-label {
        font-weight: 500;
        color: #424242;
      }
      
      .tab-count {
        color: #666;
        font-size: 0.85em;
        margin-left: 4px;
      }
      
      &.mat-tab-label-active {
        .tab-label {
          color: #1976d2;
          font-weight: 600;
        }
        
        .tab-count {
          color: #1976d2;
        }
      }
    }
    
    .mat-ink-bar {
      height: 3px;
      background-color: #1976d2;
    }
  }
  
  .mat-tab-body-wrapper {
    .tab-content {
      padding: 16px 0;
    }
    
    .empty-tab {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 40px;
      color: #666;
      
      mat-icon {
        font-size: 48px;
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
        color: #ccc;
      }
      
      p {
        margin: 0;
        font-style: italic;
      }
    }
  }
}

// Nouvelle interface pour les onglets contextuels
.tabs-summary {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;

  .summary-text {
    display: flex;
    align-items: center;
    margin: 0 0 12px 0;
    color: #495057;
    font-weight: 500;

    mat-icon {
      margin-right: 8px;
      color: #6c757d;
    }
  }

  .tabs-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    .tab-indicator {
      background: #ffffff;
      border: 1px solid #ced4da;
      border-radius: 16px;
      padding: 6px 12px;
      font-size: 0.875rem;
      color: #495057;
      cursor: pointer;
      transition: all 0.15s ease;

      &:hover {
        background: #e3f2fd;
        border-color: #90caf9;
        color: #1976d2;
      }

      &.active {
        background: #1976d2;
        border-color: #1976d2;
        color: white;
      }
    }
  }
}

::ng-deep .contextual-tabs {
  .tab-content {
    .tab-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 0;
      border-bottom: 1px solid #e9ecef;
      margin-bottom: 16px;

      h3 {
        margin: 0;
        color: #495057;
        font-size: 1.25rem;
        font-weight: 600;
      }

      .tab-info {
        display: flex;
        align-items: center;
        gap: 16px;

        .data-count {
          color: #6c757d;
          font-size: 0.875rem;
          background: #f8f9fa;
          padding: 4px 8px;
          border-radius: 12px;
        }

        .tab-actions {
          display: flex;
          align-items: center;
          gap: 12px;

          .add-contextual-btn {
            width: 36px;
            height: 36px;
            
            mat-icon {
              font-size: 20px;
            }
          }

          .expand-btn {
            font-size: 0.875rem;
            
            mat-icon {
              margin-right: 4px;
            }
          }
        }
      }
    }
  }

  .empty-tabs-content {
    padding: 24px;

    h3 {
      color: #495057;
      margin: 0 0 20px 0;
      font-size: 1.1rem;
    }

    .empty-tabs-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 16px;

      .empty-tab-card {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 16px;
        text-align: center;
        transition: all 0.15s ease;
        position: relative;
        overflow: hidden;

        &:hover {
          background: #e9ecef;
          border-color: #1976d2;
          transform: translateY(-2px);
          box-shadow: 0 4px 12px rgba(25, 118, 210, 0.15);

          .empty-tab-actions {
            opacity: 1;
            transform: translateY(0);
          }
        }

        .empty-tab-content {
          .empty-icon {
            font-size: 32px;
            width: 32px;
            height: 32px;
            color: #ced4da;
            margin-bottom: 8px;
          }

          .empty-tab-name {
            display: block;
            font-weight: 500;
            color: #495057;
            margin-bottom: 4px;
          }

          .empty-tab-status {
            font-size: 0.875rem;
            color: #6c757d;
            font-style: italic;
          }
        }

        .empty-tab-actions {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%) translateY(10px);
          opacity: 0;
          transition: all 0.25s ease;
          z-index: 2;

          .create-contextual-btn {
            width: 48px;
            height: 48px;
            box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);

            mat-icon {
              font-size: 24px;
            }

            &:hover {
              transform: scale(1.1);
            }
          }
        }

        &:hover .empty-tab-content {
          opacity: 0.3;
        }
      }
    }
  }
}

// Adaptation responsive
@media (max-width: 768px) {
  .tabs-summary {
    .tabs-indicators {
      .tab-indicator {
        font-size: 0.75rem;
        padding: 4px 8px;
      }
    }
  }

  ::ng-deep .contextual-tabs .tab-content .tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;

    .tab-info {
      width: 100%;
      justify-content: space-between;
    }
  }
  
}

/* Styles pour le menu déroulant des actions */
::ng-deep .mat-menu-panel {
  min-width: 200px !important;
  
  .mat-menu-content {
    .mat-menu-item {
      display: flex !important;
      align-items: center !important;
      gap: 12px !important;
      padding: 12px 16px !important;
      
      mat-icon {
        font-size: 18px !important;
        width: 18px !important;
        height: 18px !important;
        color: #6c757d !important;
      }
      
      span {
        font-weight: 500 !important;
      }
      
      &:hover {
        background-color: #f8f9fa !important;
        
        mat-icon {
          color: #007bff !important;
        }
      }
    }
  }

// Styles pour le menu execute dropdown
::ng-deep .execute-menu {
  .mat-menu-content {
    padding: 0.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
  }

  .mat-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem;
    min-height: auto;
    line-height: 1.5;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.15s ease;

    &:hover {
      background: #f3f4f6;
      color: #059669;
      transform: translateX(2px);

      mat-icon {
        color: #059669;
      }
    }

    mat-icon {
      font-size: 18px;
      width: 18px;
      height: 18px;
      color: #6b7280;
      transition: color 0.15s ease;
    }
  }
}
}

// Styles pour les champs référence cliquables dans la vue détail
.reference-link {
  color: #2563eb !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;

  &:hover {
    color: #1d4ed8 !important;
    text-decoration: underline;
  }

  .reference-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
  }
}